Skip to content

Instantly share code, notes, and snippets.

View idan's full-sized avatar
💫
Prototypin'

Idan Gazit idan

💫
Prototypin'
View GitHub Profile
@gasman
gasman / gfm.py
Created March 6, 2011 00:57 — forked from mvasilkov/gfm.py
import re
from hashlib import md5
def gfm(text):
# Extract pre blocks.
extractions = {}
def pre_extraction_callback(matchobj):
digest = md5(matchobj.group(0).encode('utf-8')).hexdigest()
extractions[digest] = matchobj.group(0)
return "{gfm-extraction-%s}" % digest
@carljm
carljm / install-gems.sh
Created May 18, 2011 19:29
ghetto gem-installer that reads something similar to a pip requirements file
#!/bin/bash
vfile=$1
for line in `cat ${vfile}`; do
gem=${line%%=*}
version=${line##*=}
if gem list | grep ${gem} | grep "(${version})"; then
echo "${gem} (${version}) is already installed"
else
gem install ${gem} -v ${version} --no-rdoc --no-ri
fi
@idan
idan / oauthlib_twitter_example.py
Created May 2, 2012 22:50
Requests + OAuth, sample usage
import requests
from requests.auth import OAuth1
url = u'https://api.twitter.com/1/account/settings.json'
client_key = u'...'
client_secret = u'...'
resource_owner_key = u'...'
resource_owner_secret = u'...'
@ib-lundgren
ib-lundgren / gist:2584789
Created May 3, 2012 09:52
OAuth1 using requests, OAuthLib and RSA signatures
import requests
from requests.auth import OAuth1
from oauthlib.oauth1.rfc5849 import SIGNATURE_RSA
client_key = u'...'
# You need to register your key with the OAuth provider first,
# in this case Google at https://accounts.google.com/ManageDomains
key = open("your_rsa_key.pem").read()
@danparsons
danparsons / gist:3195652
Created July 29, 2012 01:46
How to stream the London 2012 Olympics

How to stream the London 2012 Olympics

There have been several HOWTOs posted regarding streaming the 2012 Olympics using HTTP / SOCKS proxies via SSH and other similar methods. None of these actually work using the latest Flash on Mountain Lion (with Firefox, Chrome or Safari). Additionally, the third-party streaming sites don't provide BBC's amazing interface, which lets you quickly skip to individual competitors and events. However, setting up an OpenVPN server does work, with some tweaks. You'll get the exact same UX that people in England receive.

@toastdriven
toastdriven / haystack.sh
Created October 9, 2009 05:30
haystack.sh
#!/bin/sh
# First, open up GitX
cd ~/Code/Python/django-haystack; gitx
tmux start-server
tmux new-session -d -s Haystack -n git
tmux new-window -tHaystack:1 -n test
tmux new-window -tHaystack:2 -n solr
tmux new-window -tHaystack:3 -n docs
tmux new-window -tHaystack:4 -n runserver
@idan
idan / gist:793789
Created January 24, 2011 19:34
Google Docs Companywide Sharing

Sharing the document with "People at <my domain> can find and view" permission:

  • will make it possible for users to search for the document in Google Docs If the user knows the name or part of the name of the document, he can enter it in the Search field at the top of the Google Docs view and click on 'Search <my domain> Docs', If the user doesn't know the name, he can click on 'Show search options' to find other ways to find the document.
  • will add the document to users' Docs view once opened (under 'All Items' and 'Opened by me')
  • to avoid users' Google Docs view to be overflown by files they do not need, the file created by another user will not appear in the Google Docs view until searched and opened.

If you would like the document to appear in the user's Google Docs view without the user having to search for it first, you will need to share the document with him on an individual basis or with a group he is part of.

A quick way to do so is to add the document to a folder shared with the user. For mo

@jezdez
jezdez / djpatch.py
Created August 25, 2011 10:21
A helper script to apply patches from Django's trac
#!/usr/bin/env python
"""
Obviously this is only useful if you have to deal with Django's
Trac a lot.
Mostly stolen from Jacob Kaplan-Moss, but improved by Jannis Leidel
and Aymeric Augustin.
Reads a config file at ~/.djpatchrc, e.g.:
@mbostock
mbostock / .block
Last active October 19, 2020 23:31
Gist API Latency
license: gpl-3.0
@jacobian
jacobian / pip-cache-install.py
Created May 1, 2012 05:22
Install a package from your local pip download cache without touching the 'net.
#!/usr/bin/env python
"""
Install a package from your local pip download cache without having to touch
the 'net at all.
You'll need to be using a pip download cache; that is, you'll need the
following in your ~/.pip/pip.cfg:
[install]