Skip to content

Instantly share code, notes, and snippets.

View paulsmith's full-sized avatar
😀
Hi, friends

Paul Smith paulsmith

😀
Hi, friends
View GitHub Profile
@paulsmith
paulsmith / make-precommit.log
Last active January 6, 2017 19:03
Running `make precommit` on commit 335c7b6863046ecd92bb1e4c384b23e13adf0403
************* Module grumpy.compiler.block
compiler/block.py:443: Unused argument 'unused_node' (unused-argument)
************* Module grumpy.compiler.block_test
compiler/block_test.py:81: Using deprecated method assertRegexpMatches() (deprecated-method)
compiler/block_test.py:83: Using deprecated method assertRegexpMatches() (deprecated-method)
compiler/block_test.py:85: Using deprecated method assertRegexpMatches() (deprecated-method)
compiler/block_test.py:87: Using deprecated method assertRegexpMatches() (deprecated-method)
compiler/block_test.py:89: Using deprecated method assertRegexpMatches() (deprecated-method)
compiler/block_test.py:91: Using deprecated method assertRegexpMatches() (deprecated-method)
compiler/block_test.py:93: Using deprecated method assertRegexpMatches() (deprecated-method)
@paulsmith
paulsmith / README
Last active December 2, 2016 04:58
day 1 of 2016 advent of code solution, parts 1 & 2
for http://adventofcode.com/2016/day/1
$ # copy day 1 puzzle input to file
$ make day1
$ ./day1 < day1.input
# part 1 output
$ touch day1.c && make CFLAGS=-DPART2 day1
$ ./day1 < day1.input
# part 2 output
@paulsmith
paulsmith / wopr-scenarios.txt
Created September 29, 2016 18:35
WOPR nuclear war scenarios
U.S. FIRST STRIKE
USSR FIRST STRIKE
NATO / WARSAW PACT
FAR EAST STRATEGY
US USSR ESCALATION
MIDDLE EAST WAR
USSR CHINA ATTACK
INDIA PAKISTAN WAR
MEDITERRANEAN WAR
HONGKONG VARIANT
@paulsmith
paulsmith / tcpproxy.go
Created May 10, 2016 17:18
simple TCP forwarder, go run tcpproxy.go
package main
import (
"flag"
"io"
"log"
"net"
)
func main() {
@paulsmith
paulsmith / keyboards.md
Last active March 18, 2016 16:36
I'm frustrated about keyboards

I'm frustrated about keyboards dot text

I've yet to find a keyboard with which I'm really happy. Going back a few years, I started with a generic Model M-like tank of a keyboard, with buckling spring keys. I eventually became unsatisfied with the typing noise (it was distracting to me and my office-mate) and its sheer size. A large part of the footprint of the keyboard was its plastic border, which served no function. It also wasted space with its numeric keypad, which I never used. The problem with keyboard footprint is, while I try to keep my hands on the keyboard as much as possible, when I reach for the mouse or trackpad I don't want to swing my hand and arm too far to the right -- too slow, too much of a context switch, and too painful in the long run. Having to move past a numeric keypad was a pain.

Speaking of pain, I also worried about the position of my hands, so for my next keyboard I bought an ergonomic wireless model by Microsoft. It solved the footprint problem by having the numeric

@paulsmith
paulsmith / keyboards.md
Created February 10, 2016 17:48
I'm frustrated about keyboards

I'm frustrated about keyboards dot text

When I'm working at my desk, I put my laptop on a stand and hook it up to an external monitor and a USB hub with a keyboard and mouse

@paulsmith
paulsmith / assert.go
Last active August 29, 2015 14:26
assert in Go
package main
import (
"fmt"
"os"
"runtime"
)
func main() {
foo(0)
import Text exposing (..)
import Color exposing (..)
import Graphics.Element exposing (..)
import Graphics.Collage exposing (..)
import List
import Time exposing (Time, fps, timestamp)
import Signal exposing ((<~))
main =
let
@paulsmith
paulsmith / README.md
Last active August 29, 2015 14:19
Latency and packet loss report

If you are experiencing poor or degrading home network performance, it's good to come armed with evidence when talking with your friendly neighborhood ISP.

Usage:

From your cable or DSL modem, find out the gateway, aka your ISP's router between you and them. Usually you can just run netstat -rn and the entry next to destination==0.0.0.0 is the gateway. (Be sure to be plugged directly into your modem, not going through your WiFi router, or you'll just be getting the gateway of your internal private network, which will be the WiFi router itself.) Armed with that IP address, log a few hours worth of ping(8) to a file, and then run ping_report.sh on it.

$ ping -D <gwipaddress> | tee ping.log
# wait a few hours
@paulsmith
paulsmith / scrape.py
Last active August 29, 2015 14:18
scrape april 7 2015 chicago mayoral runoff election results
from __future__ import print_function
from collections import namedtuple
import csv
import sys
import time
from urllib import urlopen
from bs4 import BeautifulSoup