Skip to content

Instantly share code, notes, and snippets.

View pzinovkin's full-sized avatar
🎱

Pavel Zinovkin pzinovkin

🎱
View GitHub Profile
@pzinovkin
pzinovkin / kill-strip.sh
Created April 25, 2022 07:57
kill-strip.sh
ps aux | grep [S]trip | awk '{print $2}' | xargs kill -9
# Credit http://stackoverflow.com/a/2514279
# List old branches
for branch in `git branch -r | grep -v HEAD | grep -v "origin/master"`;
do
echo -e `git show --format="%ci %cr %ae %an" $branch | head -n 1` \\t$branch;
done | sort -r
# Delete local remotes/origin/... branches not on the remote
git remote prune origin
@pzinovkin
pzinovkin / rrepr.py
Last active August 29, 2015 14:03
Python repr customisation
def rrepr(exclude=None, only=None):
"""Just use ``def repr_attr`` to customize repr display for particular
class attribute.
You can exclude attributes:
>>> __repr__ = rrepr(exclude=('attrname', ))
Or show only what you need:
# -*- coding: utf-8 -*-
"""
7
/ \
3 9
/ \
1 2
LCA = lowest common ancestor = common ancestor that is farthest down the tree
LCA(above tree, 1, 2) = 3
perl -e '(map { print "\\x$_" } unpack("(H2)*", pack("C", 1))); print "\n"'
@pzinovkin
pzinovkin / post-receive.py
Created November 12, 2012 15:03
git post-receive hook to trigger builds in Jenkins
#!/usr/bin/env python
import os
import sys
import subprocess
import ConfigParser as configparser
import cStringIO
JENKINS_URL = 'http://jenkins/job'
JENKINS_USER = 'jenkins'
JENKINS_TOKEN = '<token>'
@pzinovkin
pzinovkin / sphinx.py
Created February 13, 2011 15:17
sphinx.conf sample
#!/usr/bin/env python
import os
top = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'sphinx'
)
for root, dirs, files in os.walk(top):
for name in files: