This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Watching $1 command" | |
PREV="" | |
while sleep 1; do | |
CURRENT=`eval $1` | |
if [ "$CURRENT" != "$PREV" ]; then | |
echo "[`date`]: $CURRENT" | |
PREV=$CURRENT | |
fi | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: arg 1 is number of random lines to generate, arg 2 is length of each line | |
# Stolen from: https://gist.github.com/earthgecko/3089509 | |
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $2 | head -n $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set http-proxy= | |
set https-proxy= | |
set http_proxy= | |
set https_proxy= | |
start cmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import sys | |
pslist = subprocess.check_output("adb shell ps " + sys.argv[1]).decode("utf-8").split() | |
if len(pslist) > 8: | |
pid = pslist[9] | |
print("killing " + pid) | |
subprocess.check_call("adb shell kill " + pid) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import sys | |
import re | |
apkpath = sys.argv[1] | |
print('checking packagename') | |
head = subprocess.check_output('aapt d badging "' + apkpath + '"').decode("utf-8").split("\n")[0] | |
packagename = re.match(r'^package: name=\'([A-Za-z0-9\.]+)\'', head).group(1) | |
print('uninstalling ' + packagename) | |
subprocess.check_call("adb uninstall " + packagename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn exp | |
"exponent of x^n (int n only), with tail recursion and O(logn)" | |
[x n] | |
(if (< n 0) | |
(/ 1 (exp x (- n))) | |
(loop [acc 1 | |
base x | |
pow n] | |
(if (= pow 0) | |
acc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var recursive = "var iterationNum=ITERATION_NUM; console.log('iteration number %s', iterationNum); var recursive = \"REPLACE\"; eval(recursive.replace('REPLACE', recursive.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"').replace(/'/g, '\\\\\\'')).replace('ITERATION_NUM', iterationNum + 1))"; | |
eval(recursive.replace('REPLACE', recursive.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/'/g, '\\\'')).replace('ITERATION_NUM', 0)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zipfile | |
import sys | |
def methods_in_dex(dex_bytes): | |
return int.from_bytes(dex_bytes[88:92], byteorder='little', signed=False) | |
def methods_in_apk(apkfile, dexfile='classes.dex'): | |
with zipfile.ZipFile(apkfile, 'r') as apkzip: | |
dex_bytes = apkzip.read(dexfile) | |
return methods_in_dex(dex_bytes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
laxBrowserPolicy = -> | |
BrowserPolicy.content.allowOriginForAll "localhost:*" | |
BrowserPolicy.content.allowConnectOrigin "ws://localhost:*" | |
BrowserPolicy.content.allowConnectOrigin "http://localhost:*" | |
Meteor.startup -> | |
BrowserPolicy.content.disallowInlineScripts() | |
BrowserPolicy.content.disallowInlineStyles() | |
BrowserPolicy.content.disallowEval() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
observeMutationsHelper = function(targetSelector, done, callback) { | |
var target = document.querySelector(targetSelector); | |
var observer = new MutationObserver(function(mutations) { | |
callback(mutations); | |
observer.disconnect(); | |
done(); | |
}); | |
var config = { | |
attributes: true, | |
childList: true, |