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
from unittest import TestCase | |
import nose.tools as nt | |
def foo(x,y): | |
return (x+y), (x*y) | |
class FooTests_0(TestCase): | |
def test_foo_does_add(self): |
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
: > app.log && ls -halt app.log |
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
require 'gimme' | |
class C | |
def f | |
return 1 | |
end | |
end | |
l = [ 2, 3, 4, 5 ] | |
c = gimme(C) |
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
#!/bin/bash | |
rm -f x.dat | |
for id in $( diff new.care_logs.ids old.care_logs.ids | grep ">" | awk '{print $2}' | grep -e "^[0-9]" ); do | |
jq ".[] | select(.id == $id)" old/care_logs.jsonl | jq .updated | cut -c1-12 >> y.dat | |
done | |
cat y.dat | sort | uniq |
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
#!/bin/bash | |
rm -f x.dat | |
for id in $( diff new.shifts.ids old.shifts.ids | awk '{print $2}' | grep -e "^[0-9]" ); do | |
jq ".[] | select(.id == $id)" old/shifts.jsonl | jq .updated | cut -c1-12 >> x.dat | |
done | |
cat x.dat | sort | uniq |
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
End of development play, crumbling away | |
I’m your source of code-destruction | |
Veins that pump with fear, sucking darkest clear | |
Leading on your death’s construction | |
Taste me you will see | |
More is all you need | |
You’re dedicated to | |
This build is killing you | |
Come crawling faster |
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
#!/bin/sh | |
email_to=${1:-default@yourdomain.com} | |
limit=${2:-90} | |
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output; | |
do | |
usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 ) | |
partition=$(echo $output | awk '{ print $2 }' ) | |
if [ $usep -ge $limit ]; then | |
echo "Running out of space \"$partition ($usep%/$limit%)\" on $(hostname) as on $(date)\n\nThe machine needs more disk or it will eventually crash!\n\nSend someone in to clean up log files and/or other files that are gobbling up the space.\n\nDetails:\n$output" | | |
mail -s "Alert: Almost out of disk space $usep%/$limit%" $email_to |
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
server { | |
listen 80; | |
root /var/www/nginx; | |
index index.html; | |
server_name ender.noradltd.com; | |
rewrite ^/e/(\d+)$ /f?id=$1 last; |
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
a = [ { :items => [{ 'item' => 'junk' },{ 'item' => 'junk' },{ 'item' => 'junk' }] }] | |
# => [{:items=>[{"item"=>"junk"}, {"item"=>"junk"}, {"item"=>"junk"}]}] | |
a[0][:items].count # => 3 | |
d = [] # => [] | |
d.push a[0][:items] # => [[{"item"=>"junk"}, {"item"=>"junk"}, {"item"=>"junk"}]] | |
d.count # => 1, not 3 | |
d.push a[0][:items] # => [[{"item"=>"junk"}, {"item"=>"junk"}, {"item"=>"junk"}], [{"item"=>"junk"}, {"item"=>"junk"}, {"item"=>"junk"}]] | |
d.count # => 2, not 6 | |
d.flatten.count # => 6 |
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
# with a progress bar | |
dd if=/Users/rich/Downloads/kali-linux-2016.1-amd64.iso | pv | dd of=/dev/disk2 bs=1m |