Skip to main content

Posts

NodeJS Cheatsheet

Remote debug nodejs app / use chrome developers to detect memory leaks Step 1 enable remote debug on a running nodejs process kill -SIGUSR1 $NODEJS_PID Now your nodejs process (V8) is listening on port 5858 Step 2 run node-inspector # node-inspector --web-port=8081 Node Inspector v0.12.8 Visit http://127.0.0.1:8081/?port=5858 to start debugging.
Recent posts

Python cheatsheet

Get content of URL importurllib2printurllib2.urlopen('http://google.com').read() Remove chars and split by , from a string convert to list 'jshfjshfjsh[]'.translate(None,'[] "\n').split(',') Diff between two arrays set(['first','second','third'])-set(['first','second'])

Java Cheatsheet

Initialize 2 dim array int[][]arr=newint[2][2]; print two dim array java.util.Arrays.deepToString(table) Read stdin Scannersc=newScanner(System.in);while(sc.hasNextLine()){System.out.println(sc.nextLine());} spaced delimeted string to stream importjava.util.stream.*;importjava.util.regex.*;Streamstream=Pattern.compile(" ").splitAsStream(scanner.nextLine());