Skip to content

Instantly share code, notes, and snippets.

@davidrenne
davidrenne / gist:6453471
Created September 5, 2013 17:38
Default git settings
git config --global user.name "David Renne"
git config --global user.email david_renne@yahoo.com
git config --global push.default current
tcpdump -s 100 -n -X host rrcs-71-40-167-210.se.biz.rr.com and port 80
@davidrenne
davidrenne / gist:7468636
Created November 14, 2013 15:21
VMWARE Port forwarding instructions
Testing with Internet Explorer / NAT Port Forwarding
It is possible to connect to the rails server inside the linux virtual machine from the host computer.
This allows testing the development site with Internet Explorer.
Note: This assumes the CentOS vm is running in NAT networking mode.
1) Find out what ip address the vm is using. Open a terminal in the vm and run /sbin/ifconfig
For this example the eth0 inet addr is 192.168.179.128.
2) Open System > Administration > Security Level and Firewall. (Enter the root password if necessary.)
3) On the "Firewall Options" tab, open the "Other ports" section and add ports 3000 and 8080.
4) Click ok and confirm the changes.
2) On the windows host, open C:\ProgramData\VMware\vmnetnat.conf with a text editor.
@davidrenne
davidrenne / gist:9646574
Created March 19, 2014 17:18
Greatest Headache Preventer ONLOAD
if (window.location.hostname == 'localhost') {
$('[id]').each(function(){
var ids = $('[id="'+this.id+'"]');
if(ids.length>1 && ids[0]==this)
alert('Dev Err: Multiple IDs #'+this.id);
});
}
git config --global user.email "davidrenne@gmail.com"
git config --global user.name "David Renne"
git config --global core.editor "vim"
git config --global core.fileMode false
git config --global push.default current
git config --global alias.up 'pull --rebase --autostash'
git config --global alias.cp 'cherry-pick'
git config --global alias.s 'status'
git config --global alias.co 'checkout'
git config --global alias.c 'commit -a'
@davidrenne
davidrenne / gist:1cc1b8db2ad0388c47b5
Created December 29, 2014 19:05
Python log Django Queries
from django.db import connection
for query in connection.queries :
print "\033[1;31m[%s]\033[0m \033[1m%s\033[0m" % (query['time'],
" ".join(query['sql'].split()))
@davidrenne
davidrenne / gist:db6896137a31791b3df6
Created February 2, 2015 23:57
Excel formula for wget grep image source
IF column A is an ID, and column C is a URL. Request the URL and get the single image on the page. Then create a new CSV off of this with the source of the image
=CONCATENATE("random_shit=`tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n1`;wget -O /tmp/html$random_shit ",C2655,"; grep '<img' /tmp/html$random_shit | grep -v 'beach-logo' | grep -oP 'src=""([^""]*)' | cut -b 6- > /tmp/html_$random_shit; value=`cat /tmp/html_$random_shit`; echo """,A2655,",$value"" >> /tmp/all; rm /tmp/html_$random_shit; rm /tmp/html$random_shit;")
#-*-coding:utf-8-*-
# This script requires an existing SQLite DB for output from Facebook Graph API, it should be stored in the same folder of this script if you do not specify the path to DB
"""
Facebook Graph API Explorer (http://developers.facebook.com/tools/explorer)
GO HERE FOR DEFINITIONS OF VARIABLES RETURNED BY API:
https://developers.facebook.com/docs/reference/api/post/
JSON Viewer (http://jsonviewer.stack.hu/)
@davidrenne
davidrenne / gist:6f04054aeadffea496ee
Last active August 29, 2015 14:16
Git Branch Management for multiple repositories in a project
#Repeat these scripts if you want to do branch management across similar repos in the same project obviously change your path /usr/local/repository & /usr/local/repository2 and copy more as needed
alias switch_branch='echo -n "Git branch name?>" && read response && cd /usr/local/repository && git fetch origin && git checkout $response && cd /usr/local/repository2 && git fetch origin && git checkout $response'
alias create_branch='echo -n "Git branch name?>" && read response && cd /usr/local/repository/ && git branch $response && git push origin $response && git checkout $response && cd /usr/local/repository2/ && git branch $response && git push origin $response && git checkout $response'
alias delete_branch='echo -n "Git branch name?>" && read response && cd /usr/local/repository/ && git checkout $response && git checkout master && git branch -d $response && git push origin :$response && cd /usr/local/repository2/ && git checkout $response && git checkout master && git branch -d $response && git push origi
@davidrenne
davidrenne / gist:a84937a091c7cf3084a7
Created March 18, 2015 20:27
Setup mandrillapp on ubuntu with postfix
sudo apt-get install mailutils
sudo apt-get install libsasl2-modules
sudo echo "[smtp.mandrillapp.com] YOURUSER:YOURPASSWORD" > /etc/postfix/sasl_passwd
sudo chmod 600 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd
sudo vim /etc/postfix/main.cf
delete relay host line