Skip to content

Instantly share code, notes, and snippets.

View mihneasim's full-sized avatar

Mihnea Simian mihneasim

  • Bucharest
View GitHub Profile
@mihneasim
mihneasim / call_before_after.py
Created December 17, 2014 07:18
Call before and call after - Python decorators
from functools import wraps
def call_before(before_func, *args, **kwargs):
def call_before_decorator(func):
@wraps(func)
def wrapping(*args2, **kwargs2):
before_func(*args, **kwargs)
return func(*args2, **kwargs2)
return wrapping
@mihneasim
mihneasim / youtube.py
Created July 2, 2014 08:09
Youtube downloader
""" Simple youtube downloader """
import re
import sys
import requests
import urllib
def youtube_info(youtube_id):
""" Raises ValueError when video is not streamable - e.g. VEVO video """
info_url = 'http://www.youtube.com/get_video_info?video_id={0}'
@mihneasim
mihneasim / pre-commit
Last active August 29, 2015 13:56 — forked from adamn/pre-commit
#!/usr/bin/env python
import os
import re
import subprocess
import sys
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)')
CHECKS = [