Skip to content

Instantly share code, notes, and snippets.

View jpic's full-sized avatar
💾
Searching for my Monkey Island II floppy disks

Yacht Shaver jpic

💾
Searching for my Monkey Island II floppy disks
View GitHub Profile
@jpic
jpic / log
Created September 9, 2011 11:13
>>> rm -rf '/srv/bet.yourlabs.org/main/var/test-tasks/*' && uwsgi --ini uwsgi.ini
[uWSGI] getting INI configuration from uwsgi.ini
*** Starting uWSGI 1.0-dev-1488 (32bit) on [Fri Sep 9 11:14:11 2011] ***
compiled with version: 4.6.0 20110513 (prerelease) on 09 September 2011 10:11:57
detected binary path: /srv/bet.yourlabs.org/bet_env/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your memory page size is 4096 bytes
spawned uWSGI http 1 (pid: 16796)
HTTP router/proxy bound on 0.0.0.0:7000
@jpic
jpic / x.py
Created September 19, 2011 16:05
# context processor
def acknowledge(request):
if not request.user.is_authenticated():
return {}
if 'acknowledge' in request.GET.keys():
b = RedisBackend()
b.acknowledge(request.user, request.GET['acknowledge'])
return {}
import datetime
class BaseNotification(object):
def __init__(self, **kwargs):
for k, v in kwargs.items():
setattr(self, k, v)
if 'timestamp' in kwargs.keys():
self.sent_at = datetime.datetime.fromtimestamp(kwargs['timestamp'])
import datetime
class BaseNotification(object):
def to_dict(self, user, sent_at):
return {
'timestamp': datetime.time.mktime(sent_at.timetuple()),
}
def from_dict(self, data):
self.timestamp = data['timestamp']
self.b.emit(notifications.TextNotification(
text=u'%(follower)s follows %(followed)s',
follower=self.u2, followed=self.u3
),
queues=[
'friends_dropdown::' + self.u3.pk,
['feed::' + u.id for u in Subscription.objects.subscribers_of(self.u2)],
['user_detail_activities_tab::' + u.id for u in (self.u2, self.u3)]
'all_site_activities',
],
class RedisBackend(base.BaseBackend):
def __init__(self, prefix='subscription'):
self.prefix = prefix
@property
def redis(self):
if not hasattr(self, '_redis'):
self._redis = redis.Redis()
return self._redis
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python3.2/tkinter/__init__.py", line 1399, in __call__
return self.func(*args)
File "steinitz.py", line 69, in <lambda>
'command':lambda :self.match.deiconify()
AttributeError: 'App' object has no attribute 'match'
Exception in Tkinter callback
Traceback (most recent call last):
0928 2102 Topic for #calculus: Welcome to our relaxed calculus channel; if you have a question, ask and wait, and help will come. We talk about any subject. | <afat>
19 years old he was a hermit liking on the streets doing math. <afat> a math junky.
0928 2102 Topic set by joo ; Tue Sep 20 02:40:01 2011
0928 2102 Irssi: #calculus: Total of 23 nicks ; 1 ops, 0 halfops, 0 voices, 22 normal
0928 2102 ChanServ| [#calculus] Worms Do Calculus To Find Meals Or Avoid Unpleasantness http://www.sciencedaily.com/releases/2008/07/080702132219.htm
0928 2102 Channel #calculus created Fri Jan 29 04:37:49 2010
0928 2102 Irssi: Join to #calculus was synced in 1 secs
0928 2102 Tau| hello is_null.
0928 2103 Tau| i am playing a game now.
0928 2103 Tau| let me finish it then we can talk.
@jpic
jpic / kisscli.py
Created September 29, 2011 22:23
Non blocking GNU readline usage example for python, proof of concept
import sys
from select import select
import socket
import readline
# HACK - python doesn't include a binding to rl_callback_read_char
import readline
import ctypes
rl_lib = ctypes.cdll.LoadLibrary("libreadline.so")
@jpic
jpic / telnet.py
Created September 29, 2011 22:47
import sys
from select import select
import socket
import readline
# HACK - python doesn't include a binding to rl_callback_read_char
import readline
import ctypes
rl_lib = ctypes.cdll.LoadLibrary("libreadline.so")