Skip to content

Instantly share code, notes, and snippets.

@n8foo
n8foo / filesystems.txt
Created March 15, 2012 16:44
Largest Filesystems
sdis1-1# df -kh
Filesystem Size Used Avail Capacity Mounted on
OneFS 27T 18T 8.7T 68% /ifs
sdis01-1# df -kh
Filesystem Size Used Avail Capacity Mounted on
OneFS 32T 23T 9.7T 70% /ifs
@n8foo
n8foo / ssh_limit.sh
Created March 1, 2012 17:46
ssh limit with iptables
#! /bin/bash
# this iptables rules sets an ssh limit of 4 per 60 seconds
IPT=`which iptables`
$IPT -A ssh_limit -p tcp -m recent --set --name ssh --rsource
$IPT -A ssh_limit -p tcp -m recent ! --rcheck --seconds 60 --hitcount 4 --name ssh --rsource -j ACCEPT
$IPT -A ssh_limit -j LOG --log-level info --log-prefix "SSH_LIMIT: "
$IPT -A ssh_limit -j DROP
@n8foo
n8foo / curl_stats.sh
Created March 1, 2012 16:40
Curl Stats Command
#! /bin/bash
curl -L --output /dev/null --write-out "http_code:%{http_code} http_connect:%{http_connect} time_total:%{time_total} time_namelookup:%{time_namelookup} time_connect:%{time_connect} time_appconnect:%{time_appconnect} time_pretransfer:%{time_pretransfer} time_redirect:%{time_redirect} time_starttransfer:%{time_starttransfer} size_download:%{size_download} size_upload:%{size_upload} size_header:%{size_header} size_request:%{size_request} speed_download:%{speed_download} speed_upload:%{speed_upload} content_type:%{content_type} num_connects:%{num_connects} num_redirects:%{num_redirects}\n" --silent $1
@n8foo
n8foo / gist:1891362
Created February 23, 2012 07:43
bash example to redirect stdout to logfile
DATE=`date +%F`
case "$1" in
"-v")
echo "verbose enabled"
;;
"-h")
echo "(description)"
echo $"Usage: $0 (-v|-h)"
exit 1
@n8foo
n8foo / amazon_ip_space.txt
Created February 15, 2012 16:16
Amazon EC2 IP Space
# US East (Northern Virginia):
72.44.32.0/19 (72.44.32.0 - 72.44.63.255)
67.202.0.0/18 (67.202.0.0 - 67.202.63.255)
75.101.128.0/17 (75.101.128.0 - 75.101.255.255)
174.129.0.0/16 (174.129.0.0 - 174.129.255.255)
204.236.192.0/18 (204.236.192.0 - 204.236.255.255)
184.73.0.0/16 (184.73.0.0 – 184.73.255.255)
184.72.128.0/17 (184.72.128.0 - 184.72.255.255)
184.72.64.0/18 (184.72.64.0 - 184.72.127.255)
50.16.0.0/15 (50.16.0.0 - 50.17.255.255)