Skip to content

Instantly share code, notes, and snippets.

View brendannee's full-sized avatar

Brendan Nee brendannee

View GitHub Profile
@brendannee
brendannee / file1.sql
Created November 3, 2011 17:46
General find/replace in mySQL
update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, 'find this string', 'replace found string with this string');
@brendannee
brendannee / file1.sql
Created November 3, 2011 17:47
Find/replace links in Wordpress posts for changing a sites URL
update wp_posts set post_content = replace(post_content, 'find this string', 'replace found string with this string');
@brendannee
brendannee / file1.sql
Created November 3, 2011 17:47
Find/replace links in Wordpress posts for changing a sites URL (Example)
update wp_posts set post_content = replace(post_content, 'http:\/\/www.oldsite.com\/blog', 'http:\/\/newsite.com');
@brendannee
brendannee / gist:2053603
Created March 16, 2012 23:33
Track TCP traffic on macbook pro
sudo tcpdump -vv -i en1
@brendannee
brendannee / gist:2065571
Created March 17, 2012 21:45
neo4j attempts

#Installing neo4j Spatial Warning: None of this works

##Setup Linode ##Update packages $ sudo apt-get update ##Install dependencies $ sudo apt-get install git-core $ sudo apt-get install openjdk-6-jdk $ sudo apt-get install lsof

@brendannee
brendannee / 8bit.js
Created March 31, 2012 17:13
Get Google Maps 8bit tile layer into your own project
var eightbitOptions = {
getTileUrl: function(coord, zoom) {
return "http://mt1.google.com/vt/lyrs=8bit,m@174000000&hl=en&src=app&s=Galil&" +
"z=" + zoom + "&x=" + coord.x + "&y=" + coord.y;
},
tileSize: new google.maps.Size(256, 256),
isPng: true
};
var eightbitMapType = new google.maps.ImageMapType(eightbitOptions);
@brendannee
brendannee / getreferer.clj
Created April 27, 2012 21:59
Function to get referer from header in Noir using Clojure
(:use noir.request)
(defn get-referer []
((:headers (ring-request)) "referer"))
@brendannee
brendannee / confirmation_email.js
Created July 18, 2012 01:30
Google Forms Confirmation Email
function formSubmissionResponseEmail(event) {
var form = SpreadsheetApp.getActiveSpreadsheet();
var sheet = form.getActiveSheet();
var formName = form.getName();
var timestamp = event.values[20];
var admin = "[email protected]"; // reply-to and errors email address
var emailContent = "Thank you. We have received your request for free $10 BART tickets. Your tickets will be sent to the mailing address you provided via U.S. Postal Service within four business days. For Questions call Corinne at 925-969-1193. This BART ticket offer is funded by the Contra Costa Transportation Authority's Half Cent Sales Tax For Transportation Improvements (Measure J) and the Bay Area Air Quality Management District's Transportation Fund for Clear Air.";
var recipient = event.values[20];
@brendannee
brendannee / gist:3204799
Created July 30, 2012 04:52
Useful network commands on OS X
#see who else is on the network with you
arp -a
#list the network interfaces on your computer
ifconfig
#change the mac address of an interface on your computer to 00:00:00:00:00:00
sudo ifconfig en1 ether 00:00:00:00:00:00
@brendannee
brendannee / gist:3764710
Created September 22, 2012 00:48
Start and Stop redis on OS X
launchctl unload -w io.redis.redis-server.plist
# do stuff, replace .rdb in /usr/local/var/db/redis/
launchctl load -w io.redis.redis-server.plist