Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
"""
Usage:
add this to your setup.py:
...
cmdclass={'bundle': BundleInstall},
...
Will add a bundle setup.py command that create a bundle archive in dist directory by running
#!/usr/bin/env python
from nltk.corpus import verbnet
import sys
class CommitException(Exception):
def __init__(self, msg, line, start, end, fatal=False):
Exception.__init__(self,msg)
self._line = line
self._start = start
./make-distribution.sh --tgz -Pyarn -Dhadoop.version=2.6.0-cdh5.4.3
./make-distribution.sh --tgz -Pyarn -Dhadoop.version=2.0.0-cdh4.3.2

Perfect vim/git setup for clean commit messages

Install vim-git plugin (dopuskh3/vim-git add fancy color for commit message title) but the official plugin is fine too.

If you use Vundle:

Bundle "dopuskh3/vim-git"
@dopuskh3
dopuskh3 / git-commit-validator.py
Last active August 29, 2015 14:07
git commit validator
#!/usr/bin/env python
from nltk.corpus import verbnet
import sys
class CommitException(Exception):
def __init__(self, msg, line, start, end, fatal=False):
Exception.__init__(self,msg)
self._line = line
self._start = start
import soundcloud
import sys
from pprint import pprint
from gmusicapi import Mobileclient
import re
track_regex = r"(\d+)*\s*[-_]\s*(.+)\s*[-_]\s*(.+)\s*[-_]\s*(.+){,1}"
REG = re.compile(track_regex)
api = Mobileclient()
import re
wkt_regex = re.compile(r'^(SRID=(?P<srid>\-?\d+);)?'
r'(?P<wkt>'
r'(?P<type>POINT|LINESTRING|LINEARRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION)'
r'[ACEGIMLONPSRUTYZ\d,\.\-\(\) ]+)$',
re.I)
with open('test.wkt', 'r') as fd:
wkt=fd.read().strip('\n').strip(' ')
import random
_init=lambda: "This is my value (%i)" % random.randrange(0, 100)
_my=_init()
get=lambda: _my
if __name__ == "__main__": # A minimal test.
myvalue=get()
for _ in xrange(0, 100): assert(get() == myvalue)
#!/usr/bin/env python
import sys
import fnmatch
import logging
import subprocess
def Logger():
return logging.getLogger("post-recieve-hook")
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_AV_CONFIG_H
#undef HAVE_AV_CONFIG_H
#endif
#include "libavcodec/avcodec.h"