Skip to content

Instantly share code, notes, and snippets.

View shvechikov's full-sized avatar

Leonid Shvechikov shvechikov

View GitHub Profile
__author__ = 'archeg'
import httplib
import urllib
import urllib2
import re
def URLRequest(url, params, headers, method="GET"):
if method == "POST":
from inspect import getattr_static
class dep:
name = None
def __init__(self, type):
self.type = type
def find(diamonds, share, shift=0, skip=()):
for i in range(shift, len(diamonds)):
if i in skip:
continue
d = diamonds[i]
if d > share:
continue
def my_local(init):
key = object()
def getter():
t = _app_ctx_stack.top
l = getattr(t, 'my_locals')
if l is None:
t.my_locals = l = {}
if key not in l:
l[key] = init()
return l[key]
[alias]
st = status
ci = commit
ca = commit --amend
co = checkout
br = branch
d = diff
dc = diff --cached
lg = log -p
lol = log --graph --decorate --pretty=oneline --abbrev-commit
@shvechikov
shvechikov / typograph.py
Created February 17, 2014 04:03
Evgeny Muravjev Typograph, http://mdash.ru
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
###################################################
## Evgeny Muravjev Typograph, http://mdash.ru ##
## Version: 3.2-py (beta) ##
## Release Date: February 6, 2014 ##
## Authors: Evgeny Muravjev & Alexander Drutsa ##
###################################################
@shvechikov
shvechikov / mux.py
Created December 17, 2013 21:07
Mux Youtube DASH audio and video
from __future__ import unicode_literals
import sys
from sh import ffmpeg
from unipath import Path
_, src_dir, dest_dir = sys.argv
src_dir = Path(src_dir)
@shvechikov
shvechikov / pyhash.py
Created December 9, 2013 18:09 — forked from jbenet/pyhash.py
#!/usr/bin/env python2.7
#
# Install this in your PATH as `pyhash`.
#
# curl https://gist.github.com/jbenet/6502583/raw/pyhash.py -o pyhash
# mv pyhash /usr/bin/local/pyhash
# chmod +x /usr/bin/local/pyhash
#
# If you want more cryptographic hashing functions, try the PassLib module.
#
@shvechikov
shvechikov / simple-git-branching-model.md
Last active October 23, 2020 06:17
a simple git branching model

a simple git branching model

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@shvechikov
shvechikov / fmtcsv.py
Created March 27, 2012 12:06 — forked from astanin/fmtcsv.py
Pretty-print CSV file with fixed width columns.
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Usage: %prog [width [columns]] < table.csv
Pretty-print CSV file with fixed width columns.
Arguments: