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 | |
netstat -nr -f inet |
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 | |
# Works on OS X | |
ping -c 2 -i 2 255.255.255.255 | awk ' $4 ~ /[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/{print $4}' \ | |
| sed 's/\(.*\):/\1/g' | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 |
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 | |
ebs_disk="/dev/xvdf" | |
ebs_partition="/dev/xvdf1" | |
vg_name="vg" | |
pv_name="pv1" | |
mount_point="/mnt" | |
# Create a primary partition on $ebs_disk using all space |
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 | |
dpkg -l | grep mysql | awk '{ print $2 }' | xargs -I {} apt-get purge -y {} |
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 | |
diff <(awk -v FS='\t' '{ print $1 }' a1.txt) <(awk -v FS='\t' '{ print $1 }' a2.txt) |
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
cat bundle.txt | xargs -I {} bash -c 'name={}; printf "[submodule \".vim/bundle/%s\"]\n\tpath = .vim/bundle/%s\n\turl = %s\n\n" ${name##*/} ${name##*/} $name' > .gitmodules |
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 | |
# Result: | |
# job_id date command | |
atq | awk '{ printf("%s %s %s %s %s ", $1, $5, $3, $4, $6); \ | |
system("at -c "$1"| tail -2 | head -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
#!/bin/sh | |
escape() { | |
local raw="$1" | |
local quoted=$(printf %s "$raw" | sed 's/[][()\.^$?*+]/\\&/g') | |
echo "$quoted" | |
return 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
class RequestException(IOError): | |
"""There was an ambiguous exception that occurred while handling your | |
request.""" | |
def __init__(self, *args, **kwargs): | |
""" | |
Initialize RequestException with `request` and `response` objects. | |
""" | |
response = kwargs.pop('response', None) | |
self.response = response |
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 pycurl | |
import sys | |
from humanize import naturalsize | |
import time | |
START_TIME = None | |