This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"testing" | |
) | |
func assertEqual(t *testing.T, a interface{}, b interface{}, message string) { | |
if a == b { | |
return |
This file contains hidden or 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
# Add this to your ~/.bashrc (or ~/.zshrc) | |
pycheck () { | |
type flake8 > /dev/null || { | |
echo "pip install flake8" | |
return | |
} | |
find . -name '*.py' -type f -exec flake8 {} \; | |
} |
This file contains hidden or 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 workqueue:workqueue_queue_work > /sys/kernel/debug/tracing/set_event | |
cat /sys/kernel/debug/tracing/trace_pipe > out.txt | |
(Leave it running a couple of seconds, then Ctrl+C; this is just to flush the buffer) | |
cat /sys/kernel/debug/tracing/trace_pipe > out.txt | |
(Leave it running a couple of seconds, then Ctrl+C; this is to recover the data) | |
cut -d- -f2 out.txt | awk '{print $1}' | sort | uniq -c | sort -n |
This file contains hidden or 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
#!/bin/bash | |
cd $SERVICE_APPROOT | |
[ -d ~/env ] || | |
virtualenv --python=python2.7 ~/env || exit 1 | |
. ~/env/bin/activate | |
[ -f requirements.txt ] && | |
pip install --download-cache=~/.pip-cache -r requirements.txt || exit 1 |
This file contains hidden or 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 StringIO | |
from paramiko import DSSKey | |
def generate_ssh_key(): | |
dss = DSSKey.generate() | |
out = StringIO.StringIO() | |
dss.write_private_key(out) | |
private_key = out.getvalue() | |
out.close() | |
public_key = 'ssh-dss {0}'.format(dss.get_base64()) |
This file contains hidden or 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 escapeInput = function (str) { | |
return str.replace(/['"<>]|^\s+|\s+$/g, ''); | |
}; |
NewerOlder