Skip to content

Instantly share code, notes, and snippets.

View ionelmc's full-sized avatar
🙃
wat

Ionel Cristian Mărieș ionelmc

🙃
wat
View GitHub Profile
#!/bin/bash -eEx
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: $0 local-alias http://host/path/to/svn/project"
exit 1
fi
SVN_ALIAS=$1
SVN_PATH=/var/www/svn/$1
SVN_URL=$2
"""
For tracemalloc see: https://github.com/wyplay/pytracemalloc
Quick apply guide (ubuntu)::
apt-get source python2.7
cd python2.7-2.7.3
patch -p1 < ../pytracemalloc/python2.7_track_free_list.patch
debuild -us -uc
cd ..
@ionelmc
ionelmc / .gitignore
Last active December 16, 2015 11:49
celery-bug-1316
.builds
celeryd*.log
celeryd*.pid
*.deb
*.komodoproject
.komodotools
./*.log
:memory
./*.pid
.pip-cache
@ionelmc
ionelmc / pytracemalloc.log
Created April 21, 2013 17:39
pytracemalloc dump for celery asynwrite (based on 3.0.19 ?) + billiard 2.7 + amqp leaking memory
2013-04-21 20:37:53: Top 5000 allocations per file and line
#1: .../site-packages/kombu/serialization.py:74: size=77407 KiB, count=11559 (+0), average=6 KiB
#2: .../site-packages/amqp/method_framing.py:68: size=76325 KiB, count=1684 (+0), average=45 KiB
#3: .../site-packages/amqp/connection.py:124: size=1903 KiB, count=1814 (+0), average=1 KiB
#4: .../celery/bin/celery.py:79: size=1165 KiB, count=11019 (+0), average=108 B
#5: .../python2.7/encodings/utf_8.py:16: size=1020 KiB, count=30328 (+0), average=34 B
#6: .../site-packages/amqp/serialization.py:446: size=890 KiB, count=26292 (+0), average=34 B
#7: .../site-packages/amqp/serialization.py:121: size=876 KiB, count=27077 (+0), average=33 B
#8: .../site-packages/amqp/serialization.py:199: size=852 KiB, count=3515 (+0), average=248 B
#9: .../site-packages/amqp/channel.py:94: size=817 KiB, count=48 (+0), average=17 KiB
@ionelmc
ionelmc / active-line.js
Last active December 16, 2015 16:18
Quick Google FusionTables sql editor
// Because sometimes you need to style the cursor's line.
//
// Adds an option 'styleActiveLine' which, when enabled, gives the
// active line's wrapping <div> the CSS class "CodeMirror-activeline",
// and gives its background <div> the class "CodeMirror-activeline-background".
(function() {
"use strict";
var WRAP_CLASS = "CodeMirror-activeline";
var BACK_CLASS = "CodeMirror-activeline-background";
import os
import time
import itertools
import socket
import tempfile
name = tempfile.mktemp('.sock')
sr, ss = socket.socketpair(socket.AF_UNIX, socket.SOCK_DGRAM)
pids = []
@ionelmc
ionelmc / requirements.txt
Created May 9, 2013 15:33
golden celery
# celery and it's dependencies
amqp==1.0.8
anyjson==0.3.3
kombu==2.5.6
python-dateutil==1.5
billiard==2.7.3.21
celery==3.0.15
class Highlander(type):
immortal = None
def __call__(cls, *args, **kwargs):
if cls.immortal is not None:
raise RuntimeError("THERE CAN BE ONLY ONE !") # You cannot make more than 1 instance of a Highlander class, it's too dangerous to have 2 !
cls.immortal = super(Highlander, cls).__call__(*args, **kwargs)
return cls.immortal
class MacLeod(object):
class Highlander(type):
born = False
def __call__(cls, *args, **kwargs):
if cls.born:
raise RuntimeError("THERE CAN BE ONLY ONE !") # You cannot make more than 1 instance of a Highlander class, it's too dangerous to have 2 !
cls.born = man = super(Highlander, cls).__call__(*args, **kwargs)
return man
class MacLeod(object):
"""
Run:
python xeon.py worker -Q q0
python xeon.py worker -Q q1
python xeon.py worker -Q q2
python xeon.py worker
python xeon.py produce-test
"""
import sys