Skip to content

Instantly share code, notes, and snippets.

@tailhook
tailhook / context-usage.rs
Created September 21, 2015 16:07
usage-of-context
try!(File::open(&path)
.map_err(|e| SomeError::Io(e, path.to_path_buf())))
import pypm
import time
def listdev(options):
for i in xrange(pypm.CountDevices()):
inf = pypm.GetDeviceInfo(i)
print '{0}.{default} api: {1}, name: {2}, input: {3}, output: {4}'\
.format(i, *inf, default='*' if options.device == i else ' ')
def serve(options):
@tailhook
tailhook / test2.py
Created December 12, 2010 18:15
test.py
import sys
import zmq
import time
import subprocess
import atexit
ctx = zmq.Context(1)
sock = ctx.socket(zmq.XREQ)
sock.bind('tcp://127.0.0.1:12345')
Route:
limits: &limits
method: !Array
element: !String ""
max-body-size: !Int
min: 0
default: 65536 # 64k
responses: &responses
Route:
# Common part
limits: &limits
method: !Array
element: !String ""
max-body-size: !Int
min: 0
default: 65536 # 64k
headers: !Mapping
from __future__ import print_function
import unittest
"""
Proof of concept of versionning database with minimum memory leaked.
Backend, which keeps data on disk should be still just transactional key-value
storage.
We use numbers as uids and fixed strings as value. In each
subsequent transaction we modify first character and character with number of
import sys
from PyQt4 import QtCore, QtGui, QtWebKit
def main():
app = QtGui.QApplication(sys.argv)
win = QtGui.QWidget()
vert = QtGui.QVBoxLayout(win)
tab = QtGui.QTabWidget(win)
view = QtWebKit.QWebView(win)
settings = view.settings() # self.webView is the QWebView
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.10 (GNU/Linux)
hQEMAwJlKOG3XZX4AQf/TpjNhvCHjesNc364oAU6eQXU00EaoRkCkb1GUVN2Y1q4
hJlzbnvwjq1qjOzLORnmBR6risphrDvVRW6P++xpk8F+xYX8yZwhxJOBNT8Zb87s
uNPv6BWZDjlSs+t1s13Tyyc9LMeV8i9TFsQsfP6eRdRk2O10NBXBNrwKWC8XvdK/
L07V5comKFwW03UndBQUPWz2Vol8mq4a2/RQjlBDgXxvtsQr06MBR6M5ocQDPEiF
sLRL6YP+VUNTl0xmxv0cI3Y6mvrGujfuDZVttBhC6HIbt9403v5auu3eQVfF9tpk
AT7nFzDWxqxKNYrx7lVQ7IE5aQcX2KzjvJF6LmuAKtLAtwFjdgvimEglhqoh4V40
yugy3DwI6KSeGH5KUs3jYpFmIgHj1zawGoQZVy79FT6cwXTPFOy4oXjlopr+M9ls
#include <assert.h>
#include <zmq.h>
int main(int argc, char *argv[]) {
void *ctx = zmq_init(1);
assert(ctx);
void *sock = zmq_socket(ctx, ZMQ_PULL);
assert(sock);
int rc = zmq_connect(sock, "tcp://127.0.0.1:5555");
containers:
printer:
setup:
- !Ubuntu trusty
- !Sh "dpkg -i brdcp7030lpr-2.0.2-1.i386.deb"
- !Sh "dpkg -i cupswrapperDCP7030-2.0.2-1.i386.deb"