Skip to content

Instantly share code, notes, and snippets.

View iperelivskiy's full-sized avatar

Ivan Perelivskiy iperelivskiy

  • Almaty, Kazakhstan
View GitHub Profile
@iperelivskiy
iperelivskiy / hash.js
Created November 19, 2012 14:39
JS simple hash function
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;
@iperelivskiy
iperelivskiy / base64_string_regex.py
Created November 21, 2012 12:24
Base64 string regex
BASE64_STRING_REGEX = ''.join((r'(?:[A-Za-z0-9+/]{4})*',
r'(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?'))
@iperelivskiy
iperelivskiy / osx-pip-install-m2crypto.sh
Last active June 7, 2016 07:10
Installing m2crypto with pip on El Capitan
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
ln -sf /System/Library/Frameworks/Python.framework/Versions/2.x/Extras/lib/python/OpenSSL lib/python2.x/
Verify Github on Galaxy. gid:hQKKLBSoUMz27TezvaLL7Z