Skip to content

Instantly share code, notes, and snippets.

View gourneau's full-sized avatar
🎯
Focusing

Joshua Gourneau gourneau

🎯
Focusing
View GitHub Profile
@n0wak
n0wak / konami_code_jquery
Created November 9, 2011 16:31
Twitter Length JS Konami Code (using jquery)
k=[];$("*").keydown(function(e){d=k.push(e.keyCode);if(d>11)k.shift();if(k.join()=="38,38,40,40,37,39,37,39,66,65,13")alert("!")})
@westurner
westurner / setup_pandas_notebook.sh
Created July 29, 2012 07:53
Setup IPython Notebook and Pandas for OSX
#!/bin/sh
setup_brew () {
if ![-f "/usr/local/bin/brew"]; then
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
fi
}
setup_ipython () {
brew install readline
@jiaaro
jiaaro / script.bash
Created April 24, 2013 14:45
Embed Python in a bash script
#!/bin/bash
export FOO=100
python - <<END
import os
print "foo:", os.environ['FOO']
END
@c0ldlimit
c0ldlimit / gist:5164171
Created March 14, 2013 19:00
#python #flask #pandas Using flask to return a csv response from a dataframe
import StringIO
from flask import Flask, Response
@app.route('/some_dataframe.csv')
def output_dataframe_csv():
output = StringIO.StringIO()
some_dataframe.to_csv(output)
def run_pg_fouine():
info = host_info[env.host_string]
db_name = info.tags.get('Name')
sudo('perl -pi -e "s/log_min_duration_statement = .*/log_min_duration_statement = 0/" /etc/postgresql/9.*/main/postgresql.conf')
sudo('/etc/init.d/postgresql reload')
time.sleep(30)
sudo('perl -pi -e "s/log_min_duration_statement = .*/log_min_duration_statement = 500/" /etc/postgresql/9.*/main/postgresql.conf')
sudo('/etc/init.d/postgresql reload')
run('tail -n 100000 /var/log/postgresql/postgresql-9.*-main.log > /tmp/pgfouine.txt')
run('gzip -f /tmp/pgfouine.txt')
@chengyin
chengyin / linkedout.js
Last active July 11, 2021 15:23
Unsubscribe all LinkedIn email in "one click". For an easier to use version, you can check out the bookmarklet: http://chengyin.github.io/linkedin-unsubscribed/
// 1. Go to page https://www.linkedin.com/settings/email-frequency
// 2. You may need to login
// 3. Open JS console
// ([How to?](http://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers))
// 4. Copy the following code in and execute
// 5. No more emails
//
// Bookmarklet version:
// http://chengyin.github.io/linkedin-unsubscribed/
@techtonik
techtonik / findfiles.py
Created June 2, 2013 20:23
Python - case-insensitive glob
# snippet is placed into public domain by
# anatoly techtonik <techtonik@gmail.com>
# http://stackoverflow.com/questions/8151300/ignore-case-in-glob-on-linux
import fnmatch
import os
import re
def findfiles(which, where='.'):
@jimhester
jimhester / insensitive.R
Created October 5, 2015 16:43
Case-insensitive joins for dplyr
a <- data.frame(letter = letters[1:10], num = 1:10)
b <- data.frame(letter = LETTERS[1:5], num2 = c(1:3, 9:10), val = 11:15)
library(dplyr)
insensitive <- function(fun = inner_join) {
new_fun <- fun
body(new_fun) <- substitute({
by <- dplyr:::common_by(by, x, y)
@kanzure
kanzure / bitcoin_spray.py
Created May 29, 2014 04:26
Send bitcoin from coinbase.com to a deterministic wallet by "spraying", so as to achieve a better distribution of eggs in baskets or something equally tasty.
"""
Bitcoin spray: distribute BTC from a coinbase.com account into many addresses
generated by a deterministic wallet (an electrum wallet).
1.0 BTC ->
0.01 BTC
0.01 BTC
0.01 BTC
etc..
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.