Skip to content

Instantly share code, notes, and snippets.

Avatar

Jack O'Connor oconnor663

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

A response to http://www.ginandtacos.com/2008/08/31/atheistsfoxholes-libertariansairplanes/

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
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
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 <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/>...
Reading symbols from /usr/bin/python3.3...Reading symbols from /usr/lib/debug/usr/bin/python3.3...done.
@oconnor663
oconnor663 / gist:fffb0f2fcd7ca472b589
Created Jul 22, 2014
Buggy sync output for Sean's dotfiles
View gist:fffb0f2fcd7ca472b589
git clone https://github.com/seebi/dircolors-solarized
git checkout https://github.com/seebi/dircolors-solarized
git clone https://github.com/altercation/vim-colors-solarized.git
git checkout https://github.com/altercation/vim-colors-solarized.git
git clone https://github.com/kien/ctrlp.vim.git
git checkout https://github.com/kien/ctrlp.vim.git
git clone https://github.com/tpope/vim-fugitive.git
git checkout https://github.com/tpope/vim-fugitive.git
git clone https://github.com/scrooloose/nerdtree.git
git checkout https://github.com/scrooloose/nerdtree.git
@oconnor663
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.

View keybase.md

Keybase proof

I hereby claim:

  • I am oconnor663 on github.
  • I am oconnor663 (https://keybase.io/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"
else
c = new rpc.Client x, "keybase.1"
await c.invoke 'config.getCurrentStatus', [{}], defer err, response
@oconnor663
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
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.