Skip to content

Instantly share code, notes, and snippets.

View nmariz's full-sized avatar

Nuno Mariz nmariz

View GitHub Profile

Keybase proof

I hereby claim:

  • I am nmariz on github.
  • I am nmariz (https://keybase.io/nmariz) on keybase.
  • I have a public key ASD2QauB_l2uHGtA3ywACJ4KsFt7O6bd7t4LO4Kv7RRAVwo

To claim this, I am signing this object:

#!/bin/sh
# on ubuntu: need some utils & dev libs
sudo apt-get install apache2-utils openssl libssl-dev libpcre3-dev
# compile nginx
cd /tmp
curl http://nginx.org/download/nginx-0.7.64.tar.gz | tar xz
cd nginx*
./configure --with-http_ssl_module --with-http_dav_module \
from django.contrib.auth.hashers import BCryptPasswordHasher
from django.utils.crypto import constant_time_compare
from django.utils.encoding import force_bytes
class DjangoBCryptPasswordHasher(BCryptPasswordHasher):
"""
Handles legacy passwords wich were hashed with the 'bc$' algorithm via
django-bcrypt.
"""
@nmariz
nmariz / singleton.py
Created October 15, 2012 11:20
Python Singleton Metaclass
class Singleton(type):
instance = None
def __call__(cls, *args, **kwargs):
if cls.instance is None:
cls.instance = super(Singleton, cls).__call__(*args, **kwargs)
return cls.instance
if __name__ == '__main__':
@nmariz
nmariz / gist:1682240
Created January 26, 2012 11:00
MongoDB crash
Wed Jan 25 00:57:06 Got signal: 7 (Bus error).
Wed Jan 25 00:57:06 Backtrace:
0x824629 0x7f90e0f07f60 0x6e6288 0x727ad2 0x728659 0x636097 0x63d899 0x63ef39 0x63f3b0 0x63ee21 0x63f3b0 0x63ee21 0x63f3b0 0x63ee21 0x63f3b0 0x720a9b 0x7290c1 0x72f52f 0x7067aa 0x70ac19
/opt/mongodb/bin/mongod(_ZN5mongo10abruptQuitEi+0x399) [0x824629]
/lib/libc.so.6 [0x7f90e0f07f60]
/opt/mongodb/bin/mongod(_ZN5mongo9HashTableINS_9NamespaceENS_16NamespaceDetailsENS_16MemoryMappedFile7PointerEE5_findERKS1_Rb+0xd8) [0x6e6288]
/opt/mongodb/bin/mongod(_ZN5mongo11DataFileMgr17allocFromFreeListEPKcib+0xf2) [0x727ad2]
/opt/mongodb/bin/mongod(_ZN5mongo11DataFileMgr6insertEPKcPKvibRKNS_11BSONElementEb+0x5e9) [0x728659]
/opt/mongodb/bin/mongod(_ZN5mongo11BtreeBucket9addBucketERNS_12IndexDetailsE+0x77) [0x636097]