Skip to content

Instantly share code, notes, and snippets.

View asilachev's full-sized avatar
🤖

Alex Silachev asilachev

🤖
View GitHub Profile
@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
@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:
#
#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;
# 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() {
});
});
});
});
@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
#!/usr/bin/env python
import argparse
import glob
import os
import sys
from transliterate import translit
#! /usr/bin/env python
import json
import os
import re
import urlparse
import configparser
import requests
/usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o '<string>http[s]{0,1}://.*</string>' | grep -v icloud | sed -E 's/<\/{0,1}string>//g'
from django.conf import settings
# Defining alphabet of custom base as [a-z] + [A-Z] + [0-9]
alphabet = map(chr, range(97, 123) + range(65, 91)) + map(str, range(0, 10))
base = len(alphabet)
def encode(str):
reversed_str = str[::-1]
pow_num = 0