Skip to content

Instantly share code, notes, and snippets.

View 140am's full-sized avatar

Manuel Kreutz 140am

View GitHub Profile
@140am
140am / Dockerfile
Created September 24, 2019 02:06
emacs in docker
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 && \

Keybase proof

I hereby claim:

  • I am 140am on github.
  • I am 140am (https://keybase.io/140am) on keybase.
  • I have a public key ASCE_z-ykwDLn4q2e9zGPQYTWu1QxRqRFIHfidc29km9zwo

To claim this, I am signing this object:

@140am
140am / test_amqp.py
Last active August 12, 2016 22:28
Example of a helper to listen & debug the OpenStack MQ event bus
import logging
import json
import dateutil.parser
import pika
FORMAT = '%(asctime)-15s %(levelname)s: %(message)s'
logging.basicConfig(
format = FORMAT,
level = logging.DEBUG
)
@140am
140am / ipc_test.py
Last active June 26, 2023 14:46
Simple Python / ØMQ IPC (Inter Process Communication) performance benchmark
""" 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:
""" 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
@140am
140am / pytumblr_example.py
Created January 23, 2014 06:24
Example of using the Python Tumblr API v2 Client
""" 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'
@140am
140am / gist:7463028
Last active May 3, 2022 16:12
Exampel of arrow Key Navigation via Statechart events in JavaScript. from http://stativ.us
$(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);
});
@140am
140am / butler_service.py
Last active August 12, 2016 22:35
Example of using "butler" Python library to communicate between multiple processes (local or distributed)
""" 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:
@140am
140am / README.md
Created November 14, 2012 23:44
first butler framework example (v0.2)

Installation

virtualenv env; source env/bin/activate
easy_install butler

Use Examples

Save the attached .py files (router.py / worker.py / client.py)

  1. Start Router python router.py
@140am
140am / gist:2249117
Created March 30, 2012 07:55
backbone.js - dynamically set a model attributes based on From selection
class exports.AddTaskTemplateView extends Backbone.View
events:
"change input": "fieldChanged"
"change select": "fieldChanged"
'click #btn-submit' : 'submitInput'
render: (context = {}) ->
$(@el).html require('./templates/user_create') context
this