Skip to content

Instantly share code, notes, and snippets.

View schmichael's full-sized avatar

Michael Schurter schmichael

View GitHub Profile
(palm)(git:fix-repeated-codegen) ~/src/palm$ nosetests test/test.py
.............EE......................................
======================================================================
ERROR: test.TestProto.test_enum
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/schmichael/src/palm/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/schmichael/src/palm/test/test.py", line 225, in test_enum
o.cls = test_palm.Test.BUSINESS

PALM - Protobufs Are Lightweight Messages

This is a lightweight, fast library for using Google's protobufs in Python.

How fast?

Palm, 10,000 decodes: 0.224280118942
Palm, 10,000 encodes: 0.0757548809052
foo = map(lambda s:
# lol my lambda's body is indented
s = s.upper()
print s
return s
, ['does', 'the', 'lambda', 'implicitly', 'end', 'after', 'toplevel', 'returns?'])
class D(dict):
def __init__(self, *args, **kwargs):
dict.__init__(self, *args, **kwargs)
def keys(self):
print 'lolkeys'
return dict.keys(self)
d = D()
d['a'] = 'b'
def foo(**kwargs):
print kwargs
@schmichael
schmichael / smplsrv.go
Created August 24, 2012 06:50
Simple TCP server demonstrating how to read a byte buffer
package main
import (
"log"
"net"
)
func main() {
ln, err := net.Listen("tcp", ":8080")
set rtp+=$GOROOT/misc/vim

History

next

  • cleanstats now defaults to DEFAULT_GLOB if no files are passed on the command line
  • CounterField.inc(n=...) has been deprecated in favor of CounterField.incr(amount=...)
digraph {
A [label=A];
B [label=B];
A -> B [label="hi"];
B -> A [label="bye"];
}
@schmichael
schmichael / gist:4283242
Created December 14, 2012 06:51
#go-nuts to the rescue
06:43 < schmichael> aw, no recursive closures? http://play.golang.org/p/0l9j3RNyle
06:45 < smw> schmichael, http://play.golang.org/p/p2bDJWh1HZ
06:45 < burntsushi> schmichael: http://play.golang.org/p/XEntShM_WW