Skip to content

Instantly share code, notes, and snippets.

View minrk's full-sized avatar

Min RK minrk

View GitHub Profile
# Quick python script to send a single message to the PAIR socket
# this will crash the device
import zmq
ctx = zmq.Context()
s = ctx.socket(zmq.PAIR)
s.connect('tcp://127.0.0.1:5555')
s.send('invalid')
@minrk
minrk / test_i33.py
Created January 13, 2011 23:59
stress test script for pyzmq issue 33
#!/usr/bin/env python
"""Script to connect req/rep pair, close them, then try to send/recv.
This should raise ENOTSUP, but sometimes did not in zeromq < 2.0.10."""
import zmq
ctx = zmq.Context()
def create_bound_pair(ta, tb):
a = ctx.socket(ta)
@minrk
minrk / zmq_cli.py
Created January 17, 2011 08:34 — forked from amacleod/zmq_cli.py
#!/usr/bin/python
"""
zmq_cli - 0MQ Server interruptability test case, client module.
"""
import zmq
@minrk
minrk / checkconstants.py
Created January 27, 2011 04:47
compare constants in zmq.h to czmq.pxd
#!/usr/bin/env python
"""A simply script to scrape zmq.h and zmq/core/czmq.pxd for constants,
and compare the two. This can be used to check for updates to zmq.h
that pyzmq may not yet match.
"""
from __future__ import with_statement
import os
import sys
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@minrk
minrk / ss2sftp.js
Created February 3, 2011 06:26
Strongspace to SFTP bookmarklet
javascript:function ss_to_sftp(){
var host=document.location.host;
var path=document.location.hash;
if (host!='www.strongspace.com'){
alert('You do not appear to be at strongspace!');
return;
}
var m=path.match(/^#\w+/i);
if (m==null){
alert('you do not appear to be viewing a file');
class Two(object):
def __init__(self, x, y):
self.x = x
self.y = y
def __add__(self, b):
return Sum(self, b)
#!/usr/bin/env bash
info(){
echo "****************************************"
echo "INFO: $@"
}
fail(){
echo "****************************************"
echo "FAILED: $@"
exit -1
// ==UserScript==
// @name UnGawker
// @namespace net.minrk.ungawker
// @description Automatically view all Gawker articles via Instapaper
// @include http://*deadspin.com/*
// @include http://*gawker.com/*
// @include http://*gizmodo.com/*
// @include http://*io9.com/*
// @include http://*jalopnik.com/*
// @include http://*jezebel.com/*
#
# Hello World client in Python
# Connects REQ socket to tcp://localhost:5555
# Sends "Hello" to server, expects "World" back
#
import zmq
context = zmq.Context()
# Socket to talk to server