Skip to content

Instantly share code, notes, and snippets.

@brianr
brianr / gist:82ff15b17c839ff14748
Created October 27, 2014 18:14
Rollbar RQL: Search for occurrences in last 24 hours by url pattern
select *
from item_occurrence
where timestamp >= unix_timestamp() - 24 * 60 * 60
and request.url like '%mydomain.com%'
@dannyroberts
dannyroberts / git-aliases.sh
Last active December 16, 2015 20:10
My git-related shortcuts
source /usr/local/git/contrib/completion/git-completion.bash
alias g="git"; __git_complete g _git
alias l="git status"
alias d="git diff"; __git_complete d _git_diff
alias ds="git diff --cached"
alias m="git commit -m "
alias am="git commit -am "
alias a="git add "
alias o-="git checkout --"
alias o="git checkout"; __git_complete o _git_checkout
function delete-pyc() {
find . -name '*.pyc' -delete
}
function pull-latest-master() {
git checkout master; git pull origin master
git submodule update --init
git submodule foreach --recursive 'git checkout master; git pull origin master &'
until [ -z "$(ps aux | grep '[g]it pull')" ]; do sleep 1; done
}
function update-code() {
@czue
czue / prof.py
Created February 13, 2013 19:14
profile analysis utilitiy
import hotshot.stats
import sys
DEFAULT_LIMIT = 200
def profile(filename, limit=DEFAULT_LIMIT):
print "loading profile stats for %s" % filename
stats = hotshot.stats.load(filename)
# normal stats
@adamlogic
adamlogic / gist:1435139
Created December 5, 2011 20:07
Setup instructions for developer machine (Ruby)

My setup for Rails dev on OS X Lion

  1. Back up

    A few things to think about:

    • media
      • photos, music, and videos should all be on external drive
    • projects/code
  • make sure all Git repos are pushed up
@erans
erans / get_lat_lon_exif_pil.py
Created May 20, 2011 21:16
Get Latitude and Longitude from EXIF using PIL
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
def get_exif_data(image):
"""Returns a dictionary from the exif data of an PIL Image item. Also converts the GPS Tags"""
exif_data = {}
info = image._getexif()
if info:
for tag, value in info.items():
decoded = TAGS.get(tag, tag)