This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://henrik.nyh.se/2008/12/git-dirty-prompt | |
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
# username@Machine ~/dev/dir[master]$ # clean working directory | |
# username@Machine ~/dev/dir[master*]$ # dirty working directory | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setting up a local solr instance on a mac | |
# install solr with homebrew | |
brew install solr | |
# create the base solr index directory | |
mkdir -p /data/solr | |
# make sure you can write to the solr logs | |
sudo chown -R `whoami` /usr/local/Cellar/solr/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# a messy hack written by Edd Dumbill. http://twitter.com/edd | |
# You may need to rerun this script if you hit a Twitter Error because you | |
# use up API rate limiting. That's why we pickle the results, so we can resume | |
# where we left off. | |
# get the twitter module using 'easy_install twitter' | |
from twitter.api import Twitter, TwitterError | |
from twitter.oauth import OAuth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
dry_run = ARGV.delete('--dry-run') | |
force = ARGV.delete('--force') | |
if ARGV.empty? | |
puts <<-USAGE | |
minify, swiftly concat and minify JavaScript files from the command line | |
Pass a single argument to create a .min.js version: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /your/local/path/to/tweet-search/ | |
rm last-results.html | |
search.py {query} | |
open last-results.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ABOUT: | |
# A script that grabs a list of the friends or followers of a user on Google+, | |
# grabs a sample of their friends, and generates the resulting social graph | |
# USAGE: | |
# Requirements: networkx (see DEPENDENCIES) | |
# Configuration: see CONFIGURATION | |
# Output: files will be save to the reports directory | |
# To run the script: | |
# 1) Download this file to a new directory somewhere as eg gplusESPnet.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Step One | |
Fetch URL based on column: | |
'http://www.datasciencetoolkit.org/maps/api/geocode/json?sensor=false&address=' + escape(value, 'url')' | |
Step Two | |
Parse Json for longitude: | |
value.parseJson()["results"][0]["geometry"]["location"]["lng"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% flash.each do |type, message| %> | |
<div class="alert <%= bootstrap_class_for(type) %> fade in"> | |
<button class="close" data-dismiss="alert">×</button> | |
<%= message %> | |
</div> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from json import load, JSONEncoder | |
from optparse import OptionParser | |
from re import compile | |
float_pat = compile(r'^-?\d+\.\d+(e-?\d+)?$') | |
charfloat_pat = compile(r'^[\[,\,]-?\d+\.\d+(e-?\d+)?$') | |
parser = OptionParser(usage="""%prog [options] | |
Group multiple GeoJSON files into one output file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ruby imap.rb > mail.csv | |
require 'net/imap' | |
username = '' | |
password = '' | |
imap = Net::IMAP.new('imap.gmail.com','993',true) | |
imap.login(username, password) | |
# imap.list("", "*").map{|i| i.name} |
OlderNewer