Skip to content

Instantly share code, notes, and snippets.

View asilachev's full-sized avatar

Alex Silachev asilachev

View GitHub Profile
#!/usr/bin/env python
import argparse
import glob
import os
import sys
from transliterate import translit
@asilachev
asilachev / .bash_profile
Last active December 15, 2015 06:49
Displaying Git and Mercurial branches in command prompt
# Show git branch
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}
# Show hg branch
function parse_hg_branch {
if [ "$(hg root 2> /dev/null)" ]; then
printf "[$(hg branch)]"
fi
@asilachev
asilachev / gist:3447577
Created August 24, 2012 08:37
JavaScript horizontal sliding effect
$(".news-wall._photos").hide("slide", { direction: "left" }, 500, function() {
$(".news-wall._list").show("slide", { direction: "right" }, 250, function() {
$(".news-wall._list").hide("slide", { direction: "left" }, 250, function() {
$(".news-wall._map").show("slide", { direction: "right" }, 500, function() {
});
});
});
});
# Show git branch
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}
# Show hg branch
function parse_hg_branch {
if [ "$(hg root 2> /dev/null)" ]; then
printf "[$(hg branch)]"
fi
#include <stdio.h>
void find_deviation(int *v, int v_length, int d) {
int i;
int j;
int max_deviation = 0;
int value;
int min;
@asilachev
asilachev / gitcompletion.sh
Created May 31, 2014 11:01
Git completion
#!bash
#
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@asilachev
asilachev / hb-test.py
Created May 31, 2014 11:00
HeartBleed test
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select