Skip to content

Instantly share code, notes, and snippets.

Justin Dorfman jdorfman

Block or report user

Report or block jdorfman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View .Xdefaults
# transparency - true or false (default)
# tint with any color; i.e., blue, red, tomato4, olivedrab2, etc.
# some nice listings are at:
# shading - 0 to 99 darkens, 101 to 200 lightens.
jdorfman / forloop-inet_ntoa
Created Feb 18, 2012
just in case you need to convert many IPs from numbers to addresses
View forloop-inet_ntoa
for i in `cat ip-addresses`; do echo "SELECT INET_NTOA(${i});" |mysql -uanonymous |awk "NR==2" >> /tmp/ntoa; done
jdorfman / gist:1886408
Created Feb 22, 2012
Convert an IP Address to a Number using a Bash function
View gist:1886408
# insert in .bashrc or .bash_profile & run source ~/.bashrc
function aton {
echo "SELECT INET_ATON('$1');" |mysql -uanonymous > /tmp/aton
awk "NR==2" /tmp/aton
View gist:1946026
# if the request starts with our frontcontroller, pass it on to fastcgi
location ~ ^/index.php
fastcgi_param SCRIPT_FILENAME /var/www/default/pub$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
include /usr/local/nginx/conf/fastcgi_params;
View gist:2153867
//$domain = $_SERVER['HTTP_HOST'];
$base = "/netdna_api";
//$base_url = "http://$domain$base";
View gist:2159366
# Echo a Range
echo 192.168.0.{2..102} > file.txt
# Replace spaces with newlines
tr ' ' '\n' < file.txt
# Remove a line (386) from a file
View gist:2164631
for i in `cat list`; do echo "select * from db.table where value = ${i}" |mysql -umysqluser -ps3cur3p@$$w0rd; done
View gist:2296415
# nginx vhost conf
# redirect images with DMCA complaints
location ~ ^/attach/201204.*\.jpg$ {
alias /usr/local/nginx/html/suspend.html;
jdorfman /
Created Apr 10, 2012 — forked from aaronshaf/
Install ElasticSearch on Ubuntu 10.10-11.04
cd /tmp/
sudo apt-get update
sudo apt-get install unzip curl python-software-properties -y
#sudo add-apt-repository "deb lucid partner"
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin -y
wget -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
jdorfman / gist:2403041
Created Apr 17, 2012
bash function to run sshuttle asap
View gist:2403041
# get it here:
# put this in your .bash_profile and smoke it && source ~/.bash_profile
function p () { /path/to/sshuttle/sshuttle -r you@server -vv; }
# p for proxy (change it to whatever you want I guess)
You can’t perform that action at this time.