Window 10 – Your PC couldn’t start properly – Solution

Screen Shot 2017-07-21 at 12.02.34 PM

Solution

1. Boot machine with Windows 10 CD
2. Repair (don’t click install)
3. Goto advanced option
4. Start Command Prompt
5. If asked login with your one of the account in that machine, otherwise it will go to command prompt itself
6. Run these command one by one

bootrec /fixmbr

bcdedit /export c:\bcdbackup

attrib c:\boot\bcd bcd.old

bootrec /rebuildbcd

(Press Y when asked question for above command)

7. You are done and reboot it.

Keep Windows Machine without going idle – Busy Bee Screen

I wanted to keep my Windows PC all time up & running without going idle. Here the script which does

var WshShell = WScript.CreateObject("WScript.Shell");
for (var i=0; i<60; i++) // 60 minutes { WshShell.SendKeys('+'); WScript.Sleep (60000); }

1.Create a new text file (xxx.js) with above code

2. Double click it xxx.js
3. The script will run 60 times at every minute and keep the machine on which it runs on from going idle.

OR

2. Add above script file through Windwos schedule to run upon Login
3. Note - it stops upon Logout / Shutdown. So make sure start the script after login.

Javascript Array of Objects Sorting by Key

> var input = [];
> input.push({key:’z’, value:’zzz’});
> input.push({key:’a’, value:’aaa’});
> input.push({key:’b’, value:’bbb’});
> input.push({key:’x’, value:’xxx’});
> input.push({key:’m’, value:’mmm’});

> JSON.stringify(input);
“[{“key”:”z”,”value”:”zzz”},{“key”:”a”,”value”:”aaa”},{“key”:”b”,”value”:”bbb”},{“key”:”x”,”value”:”xxx”},{“key”:”m”,”value”:”mmm”}]”

> var output = _.object(_.map(input, function(item){ return item.key}), _.map(input, function(item){return item.value}));
> output
a:”aaa”
b:”bbb”
m:”mmm”
x:”xxx”
z:”zzz”

Sniffing Proxy

To implement a sniffing proxy used to reverse engineer the private API, I’ll use tool called mitmproxy. You can use any other transparent HTTPS proxy. Charles is another example with a nice GUI. To make this work we need to set up the following things:

Configure your phone’s WiFi connection default gateway to be the proxy (so that the proxy is in middle and all the packets pass through) Install proxy’s certificate on the phone (so that the client has the proxy’s public key in its trust store)

Check your proxy’s documentation about installing the certificate. Here are the instructions for mitmproxy. And here is the certificate PEM file for iOS.

There isa script that reads mitmproxy dump file and generates a curl string – https://gist.github.com/nderkach/bdb31b04fb1e69fa5346

Regex to find count from CLOB field in oracle

eval function –
———————-

SELECT xmlquery(REPLACE( '1+2+5', '/', ' div ' ) returning content) FROM dual

regex to find the count from CLOB –
———————————-

CASE WHEN LST_LOG LIKE '%logical record count%' THEN regexp_replace(lst_log,'(.*)(logical record count )([0-9]{1,})(.)(.*)','\3',1,0, 'mn') END AS REC_COUNT,

sum regex counts –
———————-

WITH t1(col) AS(
SELECT 'Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. Save data point reached - logical record count 10000.
Load completed - logical record count 36342.
' FROM dual
)
SELECT xmlquery(REPLACE(REPLACE(REPLACE(regexp_replace(t1.col, '((.*)(logical record count )([0-9]{1,})(.)(.*))|.', ',\4\5'), ',', ''), '.', '+') || '0+0', '/', ' div ') returning content) res
FROM t1;

Sqldeveloper setting to avoid profile space limit and speedup

Need to add config setting in sqldeveloper.conf, which is located here

C:\[Installation Folder]\sqldeveloper\sqldeveloper\bin\sqldeveloper.conf

add below config setting

AddVMOption -Dide.user.dir=C:\[Your Own Folder]\ApplicationData\SQLDeveloper
AddVMOption -Xmx300M

C:\[Your Own Folder]\ApplicationData\SQLDeveloper – is where the application data stored to avoid increasing user profile space. Preferably inside the installation folder, since sqldeveloper is portable