This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Simple IPC benchmark test | |
Test throughput of 512 KB messages sent between two python processes using: | |
- multiprocessing pipe | |
- zeroMQ PUSH/PULL | |
- zeroMQ DEALER/DEALER | |
Result: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).bind('keydown', function(evt){ | |
var myStatechart = window.myStatechart, kid, | |
keyKey = {'38':'Up', '39': 'Right', '40':'Down', '37': 'Left', '13': 'Enter'}; | |
console.log('Which: ', evt.which); | |
kid = keyKey[evt.which]; | |
if (kid) myStatechart.sendEvent('key'+kid); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# OSX VPN monitor | |
# | |
# requires: | |
# - http://www.chungwasoft.com/shimo/ | |
# - http://growl.info/ | |
# - http://appscript.sourceforge.net/ | |
import sys | |
import socket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Python HTTP client implementations benchmark | |
# Bandwidth Throughput | |
INFO:__main__:TEST: pycurl | |
INFO:__main__:pycurl: Returned status in 17 ms | |
INFO:__main__:Completed read of 1527248057 bytes in 15410 ms at 756 Mbps | |
INFO:__main__:TEST: urllib2 | |
INFO:__main__:urllib2: Returned status in 18 ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:16.04 | |
MAINTAINER Manuel Kreutz <manuel@140.am> | |
RUN apt-get update && \ | |
apt-get install -y curl git software-properties-common build-essential && \ | |
apt-get clean | |
# install emacs 26 from ppa | |
RUN add-apt-repository ppa:kelleyk/emacs && \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pdb | |
import time | |
import threading | |
class Event(object): | |
pass | |
class Observable(object): | |
def __init__(self): | |
self.callbacks = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Tumblr API Example - Python CLI | |
""" | |
import oauth2 | |
import urlparse | |
import pytumblr | |
REQUEST_TOKEN_URL = 'http://www.tumblr.com/oauth/request_token' | |
AUTHORIZATION_URL = 'http://www.tumblr.com/oauth/authorize' | |
ACCESS_TOKEN_URL = 'http://www.tumblr.com/oauth/access_token' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from sqlalchemy.schema import CreateTable | |
>>> print CreateTable(model.TrafficLog.__table__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Example of how to get started with the `butler` library for RPC calls | |
Defines 3 example classes we want to expose for RPC use (ServiceA, ServiceB, ServiceC) | |
which all have a 'test' method. | |
Start a Router and register all the Service classes (`services_objects`) | |
python butler_service.py --service | |
Start only a Router process: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import json | |
import dateutil.parser | |
import pika | |
FORMAT = '%(asctime)-15s %(levelname)s: %(message)s' | |
logging.basicConfig( | |
format = FORMAT, | |
level = logging.DEBUG | |
) |
NewerOlder