Skip to content

Instantly share code, notes, and snippets.

View jdorfman's full-sized avatar

Justin Dorfman jdorfman

View GitHub Profile
# transparency - true or false (default)
URxvt*transparent:true
# tint with any color; i.e., blue, red, tomato4, olivedrab2, etc.
# some nice listings are at:
# http://www.nisrv.com/modules.php?name=Hex_Colors
# http://www.htmlgoodies.com/tutorials/colors/article.php/3478921
URxvt*tintColor:blue
# shading - 0 to 99 darkens, 101 to 200 lightens.
@jdorfman
jdorfman / forloop-inet_ntoa
Created February 18, 2012 02:01
just in case you need to convert many IPs from numbers to addresses
for i in `cat ip-addresses`; do echo "SELECT INET_NTOA(${i});" |mysql -uanonymous |awk "NR==2" >> /tmp/ntoa; done
@jdorfman
jdorfman / gist:1886408
Created February 22, 2012 18:09
Convert an IP Address to a Number using a Bash function
# 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
}
# if the request starts with our frontcontroller, pass it on to fastcgi
location ~ ^/index.php
{
fastcgi_pass 127.0.0.1:9000;
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;
}
<?php
require_once("OAuth.php");
require_once("OAuthServer.php");
//$domain = $_SERVER['HTTP_HOST'];
$base = "/netdna_api";
//$base_url = "http://$domain$base";
# 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
for i in `cat list`; do echo "select * from db.table where value = ${i}" |mysql -umysqluser -ps3cur3p@$$w0rd; done
# nginx vhost conf
# redirect images with DMCA complaints
location ~ ^/attach/201204.*\.jpg$ {
alias /usr/local/nginx/html/suspend.html;
}
@jdorfman
jdorfman / es.sh
Created April 10, 2012 22:39 — forked from aaronshaf/es.sh
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 http://archive.canonical.com/ 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 https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.18.7.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
@jdorfman
jdorfman / gist:2403041
Created April 17, 2012 02:39
bash function to run sshuttle asap
# get it here: https://github.com/apenwarr/sshuttle
# put this in your .bash_profile and smoke it && source ~/.bash_profile
function p () { /path/to/sshuttle/sshuttle -r you@server 0.0.0.0/0 -vv; }
# p for proxy (change it to whatever you want I guess)