Skip to content

Instantly share code, notes, and snippets.

import multiprocessing
import os
import requests
BASE_URL = 'http://www.bigozine2.com/{folder}/GHlondon/GHlondon{song_id}.mp3'
SONGS = {
110: 'I Want To Tell You',
111: 'Old Brown Shoe',
112: 'Taxman',
info = {
'seats' => 85,
'votes' => {
'psc' => 420623,
'jxsi' => 1107398,
'cup' => 254246,
'cs' => 579850,
'csqep' => 311612,
'pp' => 272280
@joanfont
joanfont / git.sh
Created April 2, 2015 17:27
Git bash completion on OS X 10.10
# Put this snippet in your .bash_rc
if [ -f /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash ]; then
. /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash
fi
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh
PS1='\h:\W $(__git_ps1 "(%s)") \u$ '
@joanfont
joanfont / psoe.py
Last active August 29, 2015 14:15
PSOE's site scrapper to get provinces and towns in Spain
import requests
import itertools
def get_provinces():
data = requests.post('https://afiliate.psoe.es/Resource/GetProvinces')
return data.json()
def get_municipalities(province):
_id = province.get('Id')
data = requests.post('https://afiliate.psoe.es/Resource/GetMunicipalities', params = {'idProvince': _id})
@joanfont
joanfont / youtube.py
Created February 1, 2015 11:52
Django YouTube embed tag
from django import template
import re
register = template.Library()
@register.simple_tag
def youtube_embed(video):
YOUTUBE_REGEX = r'(https?://)?(www\.)?(youtube|youtu|youtube-nocookie)\.(com|be)/(watch\?v=|embed/|v/|.+\?v=)?([^&=%\?]{11})'
def _get_id(video):