Skip to content

Instantly share code, notes, and snippets.


Jack O'Connor oconnor663

View GitHub Profile
oconnor663 /
Last active Aug 26, 2015
run asyncio without disrupting other code?
import asyncio
import contextlib
def my_coroutine(loop, text):
p = yield from asyncio.create_subprocess_shell("echo " + text, loop=loop)
yield from p.communicate()
oconnor663 /
Last active Aug 27, 2015
Libertarians in Airplanes

A response to

First and foremost, this post is about the author's experiences talking to a bunch of libertarians at AEI. It sounds like those folks were dismissive of important left-leaning arguments, and generally annoying to be around. That's a shame, and no amount of the-free-market-being-awesome is going to make the author's experience anything other than a bad memory.

So with the caveat that I'd always want to acknowledge that up front before I started playing with ideas, here goes. There's a very common mistake that pro-regulation people make when they think about markets that don't exist yet. The steps go something like this.

  1. consider the way something works right now
  2. change one part of it to resemble a market
  3. observe that it wouldn't work very well
oconnor663 / gist:8922568
Created Feb 10, 2014
Jack's solution to the sum of consecutive primes problem
View gist:8922568
#! /usr/bin/env python3
import sys
upper_bound = 1000000
# Optionally take the upper bound from the command line.
if len(sys.argv) > 1:
upper_bound = int(sys.argv[1])
# Computes the list of all primes using Sundaram's Sieve. This is a *lot*
oconnor663 / gist:9077080
Created Feb 18, 2014
gdb stacktrace of QtWebKit crash
View gist:9077080
GNU gdb (GDB) 7.6.1-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
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:
Reading symbols from /usr/bin/python3.3...Reading symbols from /usr/lib/debug/usr/bin/python3.3...done.
oconnor663 / gist:fffb0f2fcd7ca472b589
Created Jul 22, 2014
Buggy sync output for Sean's dotfiles
View gist:fffb0f2fcd7ca472b589
git clone
git checkout
git clone
git checkout
git clone
git checkout
git clone
git checkout
git clone
git checkout
oconnor663 / gist:958b41d45ab781c9e1b8
Last active Aug 29, 2015
a bug in GitHub's markdown rendering
View gist:958b41d45ab781c9e1b8
  1. This is some text.

  2. This is some text.

  3. This example has more space around it than it really should

    code code code

    because it has code in it.

  4. This is some text.


Keybase proof

I hereby claim:

  • I am oconnor663 on github.
  • I am oconnor663 ( on keybase.
  • I have a public key whose fingerprint is 58A2 45D3 D8B2 5C15 F6CE 3FFF 7187 6B68 AD48 2D32

To claim this, I am signing this object:

View gist:eb90a4100385d6f29ddb
rpc = require 'framed-msgpack-rpc'
assert = require 'assert'
x = rpc.createTransport { path: '/run/user/1000/keybased.sock' }
await x.connect defer err
if err
console.log "error connecting"
c = new rpc.Client x, "keybase.1"
await c.invoke 'config.getCurrentStatus', [{}], defer err, response
oconnor663 / gist:b7987d336d99d6a17dfe
Created May 22, 2015
Go's weird treatment of newlines
View gist:b7987d336d99d6a17dfe
package main
import "fmt"
type Foo struct {
Bar int
func main() {
var myfoo Foo
oconnor663 / gist:aa27fe8cf01e05d1d759
Created Jul 8, 2015
Equivalent key with different bytes in PyNaCl
View gist:aa27fe8cf01e05d1d759
import nacl.utils
import nacl.public
sender_key = nacl.public.PrivateKey.generate()
recipient_key_1 = nacl.public.PrivateKey.generate()
# Construct the second recipient by changing one bit from the first.
key_bytes = bytearray(recipient_key_1.encode())
key_bytes[0] ^= 1
recipient_key_2 = nacl.public.PrivateKey(bytes(key_bytes))
You can’t perform that action at this time.