Skip to content

Instantly share code, notes, and snippets.

View mikelikespie's full-sized avatar

Mike Lewis mikelikespie

View GitHub Profile
@mikelikespie
mikelikespie / nginx.conf
Created December 31, 2011 00:14
using nginx as a websocket reverse proxy
location / {
chunked_transfer_encoding off;
proxy_http_version 1.1;
proxy_pass http://localhost:9001;
proxy_buffering off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host:9001;
proxy_set_header Connection "Upgrade";
proxy_set_header Upgrade websocket;
}
@mikelikespie
mikelikespie / gram.go
Created January 30, 2012 08:45
Gram.y converted to go without types & functions implemented yet... trying to see if I can get Postgres's parser running in go.
//line simplegram.y:2
package main
//line simplegram.y:6
type yySymType struct {
yys int
core_yystype core_YYSTYPE
/* these fields must match core_YYSTYPE: */
ival int
str string
@mikelikespie
mikelikespie / versions.sql
Created February 14, 2012 21:01
Versioned items with rules
drop schema if exists foo cascade;
create schema foo;
CREATE TABLE foo.object (
id uuid primary key,
version int4 not null
);
CREATE TABLE foo.items_base (
@mikelikespie
mikelikespie / argbase.py
Created July 28, 2012 05:34
Interface for Argparse Similar to Declarative base
import abc
import re
import argparse
class ArgBaseError(Exception): pass
def _inject_vals(name, bases, dict):
expected_args = {}
@mikelikespie
mikelikespie / installation.sh
Created August 23, 2012 01:52
Launchctl for ipython notebook (and installation instructions)
# how to set up the virtualenv used in this
# First move org.lolrus.ipython-notebook.plist to ~/Library/LaunchAgents
NOTEBOOK_DIR=${HOME}/notebook
brew install zmq
which virtualenv > /dev/null || sudo easy_install virtualenv # easiest to install virtualenv this way if you dont have it
@mikelikespie
mikelikespie / chrome.crashreport
Created October 23, 2012 03:55
Chrome Crashing
Process: Google Chrome [95295]
Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
Identifier: com.google.Chrome
Version: 24.0.1297.0 (1297.0)
Code Type: X86 (Native)
Parent Process: launchd [128]
User ID: 501
Date/Time: 2012-10-22 20:55:37.493 -0700
OS Version: Mac OS X 10.8.2 (12C54)
@mikelikespie
mikelikespie / NSData+PIOAdditions.h
Created February 14, 2013 06:35
Zero-Copy bridging between dispatch_data_t and NSData
//
// NSData+PIOAdditions.h
// PonyExpress
//
// Created by Michael Lewis on 2/13/13.
//
//
#import <Foundation/Foundation.h>
@mikelikespie
mikelikespie / uio_test.go
Last active August 29, 2015 13:59
Read does not return when FD is closed for UIO
package foo
import (
"io"
"os"
"testing"
"time"
)
func TestReadClosed(t *testing.T) {
@mikelikespie
mikelikespie / fun.swift
Last active August 29, 2015 14:26
infinite hang in swift
public class Promise<T> {
}
/// These are basically promises that won't terminate until they hit the end
public enum MoreOrEnd<T> {
public typealias ValueTuple = (T, Promise<MoreOrEnd<T>>)
case More(ValueTuple)
case End
}
/// Does something special that ViewController_A wants
struct Service_A {
func doSomething() {
}
}
/// Does something special that ViewController_B wants
struct Service_B {
func doSomething() {
}