Skip to content

Instantly share code, notes, and snippets.

package jeromq.bugs;
import org.zeromq.ZContext;
import org.zeromq.ZMQ;
import org.zeromq.ZMQ.Socket;
public class BindIssue {
public static void main(String[] args) {
System.out.printf("zeromq v%s\n",ZMQ.getVersionString());
@jason-s
jason-s / samplestruct python
Last active August 29, 2015 13:57
samplestruct.mat
>>> import scipy.io
>>> S=scipy.io.loadmat('samplestruct.mat')
>>> S['foo']
array([[ ([[(array([[1, 2, 3]], dtype=uint8), array([[-1, -2, -3]], dtype=int16)
)]], [[123]])]],
dtype=[('bar', 'O'), ('quux', 'O')])
>>> S['foo']['bar']
array([[ array([[([[1, 2, 3]], [[-1, -2, -3]])]],
dtype=[('tweedledee', 'O'), ('tweedledum', 'O')])]], dtype=object)
>>> S['foo']['bar']['tweedledee']
{%- extends 'html_basic.tpl' -%}
{%- block header -%}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>[{{nb.metadata.name}}]</title>
import zmq
import codecs
import logging
logger = logging.getLogger(__name__)
def rot13(s):
return codecs.encode(s,'rot_13')
class Rot13Server(object):
@jason-s
jason-s / png_add_dpi.py
Created October 21, 2014 15:43
Add DPI to PNG files
'''
Copyright 2014 Jason M. Sachs
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
<html>
<head>
<style type="text/css">
div.item {
display: block;
border: 1px solid #888;
border-radius: 5px;
padding: 2px 15px;
}
span.rotated {
import enaml
from enaml.widgets.api import Window, Form, Label, Field, ComboBox
from enaml.stdlib.fields import IntField
from enaml.qt.qt_application import QtApplication
from atom.api import Int, Long, Atom
class Model(Atom):
longvalue = Long()
enamldef Main(Window):
@jason-s
jason-s / tweedle.py
Last active August 29, 2015 14:11
possible circular import problem
from tweedledum import Model, ModelAdapter, Thingy
if __name__ == '__main__':
model = Model()
model.thingy = Thingy(dee_count = 42, dum_count = 24)
import enaml
import enaml.qt.qt_application
app = enaml.qt.qt_application.QtApplication()
@jason-s
jason-s / jit2.py
Last active August 29, 2015 14:12
jit test
import numba
def foo(x):
return 1 < x < 7
def bar(x):
_x_0 = x
_x_1 = 1 < _x_0
if not _x_1:
_x_2 = False
import numba
import numba.types
src = '''
from __future__ import division
import numba.types
def f(x):
j = numba.types.int32(0)
return j+x