Skip to content

Instantly share code, notes, and snippets.

Avatar

Ivan Perelivskiy iperelivskiy

  • Almaty, Kazakhstan
View GitHub Profile
View osx-virtualenv-openssl.sh
ln -sf /System/Library/Frameworks/Python.framework/Versions/2.x/Extras/lib/python/OpenSSL lib/python2.x/
@iperelivskiy
iperelivskiy / osx-pip-install-m2crypto.sh
Last active Jun 7, 2016
Installing m2crypto with pip on El Capitan
View osx-pip-install-m2crypto.sh
env LDFLAGS="-L$(brew --prefix openssl)/lib" \
CFLAGS="-I$(brew --prefix openssl)/include" \
SWIG_FEATURES="-cpperraswarn -includeall -I$(brew --prefix openssl)/include" \
pip install m2crypto
View base64_string_regex.py
BASE64_STRING_REGEX = ''.join((r'(?:[A-Za-z0-9+/]{4})*',
r'(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?'))
@iperelivskiy
iperelivskiy / hash.js
Created Nov 19, 2012
JS simple hash function
View hash.js
var hash = function(s) {
/* Simple hash function. */
var a = 1, c = 0, h, o;
if (s) {
a = 0;
/*jshint plusplus:false bitwise:false*/
for (h = s.length - 1; h >= 0; h--) {
o = s.charCodeAt(h);
a = (a<<6&268435455) + o + (o<<14);
c = a & 266338304;