Skip to content

Instantly share code, notes, and snippets.

@oconnor663
oconnor663 / example.py
Last active August 26, 2015 03:31
run asyncio without disrupting other code?
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 August 27, 2015 11:54
Libertarians in Airplanes

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 February 10, 2014 19:32
Jack's solution to the sum of consecutive primes problem
#! /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 February 18, 2014 18:41
gdb stacktrace of QtWebKit crash
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 July 22, 2014 07:18
Buggy sync output for Sean's dotfiles
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 August 29, 2015 14:10
a bug in GitHub's markdown rendering
  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.

@oconnor663
oconnor663 / keybase.md
Created December 21, 2014 23:40
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:

@oconnor663
oconnor663 / gist:eb90a4100385d6f29ddb
Created March 4, 2015 15:52
Exercise the daemon RPC
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 17:30
Go's weird treatment of newlines
package main
import "fmt"
type Foo struct {
Bar int
}
func main() {
var myfoo Foo
@oconnor663
oconnor663 / gist:aa27fe8cf01e05d1d759
Created July 8, 2015 20:17
Equivalent key with different bytes in PyNaCl
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))