-XX:NativeMemoryTracking=detail
jps
ps -p <PID> -o pcpu,rss,size,vsize
chrome.tabs.query({'active': true, 'lastFocusedWindow': true, 'currentWindow': true}, function (tabs) { | |
var url = tabs[0].url; | |
console.log(url); | |
}); |
diff -r -U3 -I "String to exclude" <directory-1> <directory-2> |
After ssh into linux box from Mac OS X terminal. Add the following lines to .screenrc | |
defscrollback 5000 | |
termcapinfo xterm* ti@:te@ |
#!/usr/bin/python | |
import sys,operator,getopt | |
class bcolors: | |
HEADER = '\033[95m' | |
OKBLUE = '\033[94m' | |
OKGREEN = '\033[92m' | |
WARNING = '\033[93m' | |
FAIL = '\033[91m' |
# Licensed to the Apache Software Foundation (ASF) under one | |
# or more contributor license agreements. See the NOTICE file | |
# distributed with this work for additional information | |
# regarding copyright ownership. The ASF licenses this file | |
# to you under the Apache License, Version 2.0 (the | |
# "License"); you may not use this file except in compliance | |
# with the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
set vpn_name to "'VPN_NAME'" | |
tell application "System Events" | |
set rc to do shell script "scutil --nc status " & vpn_name | |
if rc starts with "Connected" then | |
do shell script "scutil --nc stop " & vpn_name | |
else | |
-- get current clipboard contents as a string | |
set CurrentClipboard to the clipboard as string | |
-- hot reload init.lua script | |
function reloadConfig(files) | |
doReload = false | |
for _,file in pairs(files) do | |
if file:sub(-4) == ".lua" then | |
doReload = true | |
end | |
end | |
if doReload then | |
hs.reload() |
# PDSH Usage | |
export PDSH_SSH_ARGS_APPEND="-q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/private.key" | |
pdsh -R ssh -w ^slaves.txt | |
# parallel-ssh Usage | |
parallel-ssh -x "-oStrictHostKeyChecking=no -i ~/.ssh/private.key" -i -h slaves.txt "sudo -u root jps | grep "LlapDaemon" | cut -f1 -d' '" | |
# remote heap-dump | |
# Add the following contents to jcmds.sh and use parallel-scp to copy the script to all hosts | |
#!/bin/bash |
These are tunings from https://github.com/basho/leveldb | |
Video: https://www.youtube.com/watch?v=vo88IdglU_8 | |
https://github.com/google/leveldb/blob/master/include/leveldb/options.h#L83 | |
- write buffer size - default 4MB (increase this for higher performance) (try 10x or 100x will get 72% performance) | |
https://github.com/google/leveldb/blob/master/db/skiplist.h#L98 | |
- if increasing write buffer size, also increase skip list max height. Since skip list is probabilistic, | |
expected number of keys in write buffer has to specified ahead. (change it from 2^12 to 2^17, affects read and write performance) |