Skip to content

Instantly share code, notes, and snippets.

View schmichael's full-sized avatar

Michael Schurter schmichael

View GitHub Profile
CHUNK = 512
def pipe(fd1, fd2):
while 1:
buf = fd1.read(CHUNK)
fd2.write(buf)
if len(buf) < CHUNK:
break

Keybase proof

I hereby claim:

  • I am schmichael on github.
  • I am schmichael (https://keybase.io/schmichael) on keybase.
  • I have a public key whose fingerprint is 214D 6D16 F891 E42E B369 19B2 B4C3 1870 224A 71DF

To claim this, I am signing this object:

...$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7f9aa31ae5f1 schmichael/nsq:latest nsqadmin -lookupd-ht 26 hours ago Up 5 hours 0.0.0.0:4171->4171/tcp nsqadmin
fad014521cf4 schmichael/nsq:latest nsqd -lookupd-tcp-ad 26 hours ago Exit 0 nsqd
ee66ee370491 schmichael/nsq:latest nsqlookupd 26 hours ago Up 5 hours 0.0.0.0:4160->4160/tcp, 0.0.0.0:4161->4161/tcp nsqlookupd
...$ docker start nsqd
Error: Cannot start container nsqd: no such file or directory
2014/03/21 15:14:15 Error: failed to start one or more containers
...$ docker start fad014521cf4
Error: Cannot start container fad014521cf4: no such file or directory
@schmichael
schmichael / gist:9745170
Last active August 29, 2015 13:57
Thoughts on go-nsq
  • I don't understand why you'd want more than one type of Handler per Reader, so why not add Handler to Reader's constructor with an optional concurrency int on Reader?
  • A HandlerFunc function type would be a nice alternative interface for stateless handlers or closures.
  • Graceful shutdown is confusing and awkward. A (non-blocking) 30 second sleep in Stop must be followed by blocking on the ExitChan (which should be a struct{})? Why not simply make Stop block until handlers have exited gracefully?
  • Reader.Configure is awkward, but makes sense if you want to provide validation for Reader fields. However, it seems strange to make the fields public and provide a setter with no indication which is the proper mechanism to use.
  • Perhaps a separate ReaderConfig type (like tls.Config) which could be built as a struct literal and passed to Reader.Configure (or a constructor?) would allow for validation and public fields.
  • Proper Reader initialization is non-obvious. I *t
@schmichael
schmichael / gist:9918706
Last active August 29, 2015 13:57
Notes for History of Concurrency talk
...$ gdb some.test
GNU gdb (GDB) 7.6.1-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
sudo mv /usr/local/go/src/pkg/runtime/runtime-gdb.py /usr/local/go/src/pkg/runtime/runtime-gdb.py.orig
cd /usr/local/go/src/pkg/runtime/
sudo wget https://go.googlecode.com/hg/src/pkg/runtime/runtime-gdb.py
set nocompatible
filetype off " Required by vundle
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'scrooloose/syntastic'
" Disable golang checkers in syntastic; use vim-go instead
let g:syntastic_disabled_filetypes=['go']
Bundle 'tpope/vim-fugitive'
#!/usr/bin/env python3
hearts = "\u2661\u2665"
colors = list(map(str, range(30, 38)))
prefix = "\x1B["
mid = "m"
def cycle(x):
while 1:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2IHw/oMqA3Bb7tulsZvlGUYH8DVPxXbSLS3NHntrYDHMhGpB2WOBq+EK5A+aOoMObTVVr8BAGV8/L35fa1IsXJUkmf5PxAfAZzLxI12icJ0YAYSn8/JBGESiwFOwojHO2IxwNMuIUN0S3KvJOkdrw5fiYama4HEszCffXE+dquaz2N7+DGS+3Zv7jiPNekKlwWoREZMOpRuGGqs8AlNiDiawKzF9h12WEy6pgvNY2qg+LW+kGLiMjtr711/cSwp7pvBYPAglj4wGTNIqYTFR5Bb4F43Z+/zoFcEvz8+cZerepulivTs4RyC1st3wkurR7hhKxzF0QpKolp87V4DZt schmichael@lytics-d5