Skip to content

Instantly share code, notes, and snippets.

@Satshabad
Satshabad / urls.py
Created May 9, 2012 01:58
fix for gunicorn static files
urlpatterns += patterns('',
(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),)
@Satshabad
Satshabad / server.py
Created May 16, 2012 02:09
A liitle bit of python for the server.
# All of our imports
import bottle
# 'route' is for the anotation (@route), request there so we can get the json, run is there so we can run this thing
from bottle import route, run, request
# This lets us connect to the db
import pymongo
from pymongo import Connection
@Satshabad
Satshabad / gist:3615628
Created September 4, 2012 01:35
Problems with the Facebook API

Paging

Organization

Id's

pid vs aid vs ownerid_post_id

Documentation

Permissions

@Satshabad
Satshabad / asas
Created September 4, 2012 01:44
gist.io tes
asasasas
asd
@Satshabad
Satshabad / gist:3615676
Created September 4, 2012 01:50
Problems with the Facebook API
adasdad
@Satshabad
Satshabad / index.html
Created September 6, 2012 00:01
my d3 playground
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<style type="text/css">
body {
font: 300 13px "Helvetica Neue", Helvetica;
}
form {
@Satshabad
Satshabad / gist:4685253
Created January 31, 2013 18:47
Worklist algorithm
def worklist(graph, s, get_edge_state):
q = [s]
v = set()
enter_state = {}
old = None
while q:
curr = q.pop(0)
@Satshabad
Satshabad / gist:4965201
Created February 16, 2013 02:25
finds IP addresses
map(lambda x: ".".join(map(str, x)), filter(lambda nums: all(map(lambda num: num < 256, nums)), map(lambda nums: map(int, nums), map(lambda x: x.split("."), re.find("\d\d\d\.\d\d\d\.\d\d\d\.\d\d\d\.")))))
@Satshabad
Satshabad / gist:5022019
Created February 24, 2013 00:25
Small script to mute your volume for a small amount of time and then unmuting. Useful for beating Spotify ads.
import time
import subprocess
import re
start_time = int(time.time())
cmd = ['amixer', 'get', 'Master']
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)