Skip to content

Instantly share code, notes, and snippets.

Avatar

Leonid Shvechikov shvechikov

View GitHub Profile
View gist:6c339ddaf143ed5ac468
__author__ = 'archeg'
import httplib
import urllib
import urllib2
import re
def URLRequest(url, params, headers, method="GET"):
if method == "POST":
View gist:c28a08db6aac6f65a72e
from inspect import getattr_static
class dep:
name = None
def __init__(self, type):
self.type = type
View olimp_128.py
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
View local.py
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]
View .gitconfig
[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 Feb 17, 2014
Evgeny Muravjev Typograph, http://mdash.ru
View typograph.py
#!/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 Dec 17, 2013
Mux Youtube DASH audio and video
View mux.py
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)
View 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 Oct 23, 2020
a simple git branching model
View simple-git-branching-model.md

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 Mar 27, 2012 — forked from astanin/fmtcsv.py
Pretty-print CSV file with fixed width columns.
View fmtcsv.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Usage: %prog [width [columns]] < table.csv
Pretty-print CSV file with fixed width columns.
Arguments: