Skip to content

Instantly share code, notes, and snippets.

View vchahun's full-sized avatar

Victor Chahuneau vchahun

View GitHub Profile
@vchahun
vchahun / mubi.py
Last active December 25, 2015 05:39
Do some dark magic.
import os
import argparse
import requests
import progressbar
def main():
parser = argparse.ArgumentParser(description='All your MUBI are belong to us.')
parser.add_argument('film_id', type=int)
parser.add_argument('resolution', choices=('360p', '480p', '640w', '720w', '1280w'))
parser.add_argument('output_file')
@vchahun
vchahun / profanity-gen.bash
Created August 14, 2013 02:06
One-liner of the day
python -c "import sys, random, pattern.en.wordlist; print(' '.join(w+' '+random.choice(pattern.en.wordlist.PROFANITY) if len(w) > 4 and random.random() > 0.8 else w for w in sys.stdin.read().split()))"
@vchahun
vchahun / word-classes.ipynb
Created July 20, 2013 20:03
Unsupervised word classes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vchahun
vchahun / NumbaCython.ipynb
Created June 15, 2013 18:31
python array benchmarks
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vchahun
vchahun / kitty-website.png
Last active December 17, 2015 10:39
Template
kitty-website.png
@vchahun
vchahun / multiprocessing-proto.py
Created April 21, 2013 03:19
Multiprocessing example
import multiprocessing as mp
data1 = None
data2 = None
def load_data():
global data1, data2
data1 = 1 # read some data
data2 = 1 # read more data
@vchahun
vchahun / pyfst-basic.ipynb
Last active December 16, 2015 03:59
pyfst - basic creation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vchahun
vchahun / pyfst-banana.ipynb
Created April 9, 2013 16:38
Banana lattices.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vchahun
vchahun / plot
Last active December 15, 2015 23:29
Quick script to serve a plot of the input via HTTP.
#!/usr/bin/env python
import sys
import argparse
import re
import pylab
import random
import socket
from StringIO import StringIO
from base64 import b64encode
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
@vchahun
vchahun / stuff.txt
Created February 21, 2013 19:49
Python regex fail - Regex from Wikipedia markup removal library - Text from Wikipedia revisions
import re
pattern = re.compile('\[\w+.*? (.*?)\]')
with open('stuff.txt') as f:
assert pattern.sub(r'\1', s) == s