Skip to content

Instantly share code, notes, and snippets.

@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)
@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 / 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 / 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 / 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 / gist:2439647
Created April 21, 2012 21:18
nashvl.org GA code
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-31087507-1']);
_gaq.push(['_setDomainName', 'nashvl.org']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
@n8foo
n8foo / es.sh
Created April 25, 2012 22:32 — forked from kajic/es.sh
Install ElasticSearch on Ubuntu 10.04/11.04
cd ~
sudo apt-get update
sudo apt-get install curl python-software-properties -y
sudo apt-get install openjdk-6-jre-headless
curl -L https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.18.7.tar.gz | tar -xz
sudo mv elasticsearch-* /usr/local/share/elasticsearch
curl -L http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master | tar -xz
sudo mv *servicewrapper*/service /usr/local/share/elasticsearch/bin/
rm -Rf *servicewrapper*
@n8foo
n8foo / ec2-metadata.sh
Created May 29, 2012 21:45
ec2-metadata
#!/bin/bash
#
#########################################################################
#This software code is made available "AS IS" without warranties of any #
#kind. You may copy, display, modify and redistribute the software #
#code either by itself or as incorporated into your code; provided that #
#you do not remove any proprietary notices. Your use of this software #
#code is at your own risk and you waive any claim against Amazon #
#Digital Services, Inc. or its affiliates with respect to your use of #
#this software code. (c) 2006-2007 Amazon Digital Services, Inc. or its #
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################
sudo apt-get update
sudo apt-get upgrade
@n8foo
n8foo / class.pp
Created November 14, 2012 20:32
puppet user.pp example
define add_user ( $email, $uid, $name, $key) {
$username = $title
user { $username:
comment => "$name,$email",
home => "/home/$username",
shell => "/bin/bash",
uid => $uid
}