Skip to content

Instantly share code, notes, and snippets.

Nathan Witmer zerowidth

Block or report user

Report or block zerowidth

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zerowidth
zerowidth / do-stuff.rb
Created Jan 23, 2018
do-stuff to make git commits for demonstration purposes
View do-stuff.rb
#!/usr/bin/env ruby
require "pathname"
class RandomEditor
def initialize
@files = Pathname.new(".").entries.select(&:file?).map(&:to_s)
end
def run(iterations = 1, commit = false)
iterations.times do
@zerowidth
zerowidth / apple_usb_keyboard.txt
Last active Oct 18, 2015
usbconfig output for apple keyboard
View apple_usb_keyboard.txt
# usbconfig -u 3 -a 3 dump_device_desc
ugen3.3: <Apple Keyboard Apple, Inc> at usbus3, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON (20mA)
bLength = 0x0012
bDescriptorType = 0x0001
bcdUSB = 0x0200
bDeviceClass = 0x0000
bDeviceSubClass = 0x0000
bDeviceProtocol = 0x0000
bMaxPacketSize0 = 0x0008
View hundreds.rb
# From https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour
# Write a program that outputs all possibilities to put + or - or nothing
# between the numbers 1, 2, ..., 9 (in this order) such that the result is
# always 100. For example: 1 + 2 + 34 – 5 + 67 – 8 + 9 = 100.
# Hacky version:
["", "+", "-"].repeated_permutation(8).each do |operations|
string = (2..9).zip(operations).reduce("1") do |str, (operand, operator)|
"#{str}#{operator}#{operand}"
end
@zerowidth
zerowidth / blink.c
Created Feb 16, 2015
minimal blink in avr
View blink.c
@zerowidth
zerowidth / animation.rb
Last active Aug 29, 2015
Rendering animations as combinations of frame generators
View animation.rb
# A demonstration/exploration of generating animation "frames" by combining
# objects that emit sequences of frames, with the following goals:
#
# * Declarative syntax for convenience and readability
# * Composability, for easily assembling larger animations from smaller pieces
# * Interruptability (see Flagged), so an animation sequence can be interrupted
# * Lazily-evaluated combinations so clock-based animations can be mixed.
# A top-level animation.
class Animation
@zerowidth
zerowidth / sql.md
Last active Apr 11, 2017
GitHub::SQL - a helping hand for SQL in a rails app
View sql.md

DEPRECATED

GitHub::SQL has been released as an officially-maintained project and ruby gem: github/github-ds.

@zerowidth
zerowidth / resources.md
Created Mar 10, 2014
Resources for learning git and GitHub
View resources.md

Learning git and GitHub

Tutorial videos

We have an excellent training team at GitHub, and they've produced a series of videos talking about the basics of how to use git and GitHub.

The youtube channel is here.

GitHub guides

@zerowidth
zerowidth / build.sh
Last active Jan 4, 2016
stripe ctf level 3 loves ruby
View build.sh
#!/bin/sh
set -e
# Add or modify any build steps you need here
cd "$(dirname "$0")"
ruby --version
mkdir -p ./gems
@zerowidth
zerowidth / clipboard.vim
Created Sep 4, 2013
filenames + clipboard + vim
View clipboard.vim
""" copy filename of current file to clipboard
map <Leader>cf :silent exe '!echo -n % \| pbcopy'<CR>:echo bufname('%')<CR>
""" edit filename from clipboard
map <silent> <Leader>ef :call EditFromClipboard()<CR>
function EditFromClipboard()
let filename = expand(fnameescape(system('pbpaste')))
if filereadable(filename)
exe 'edit ' . filename
@zerowidth
zerowidth / boulder.md
Created Aug 11, 2013
Boulder Brain Dump
View boulder.md

What even is a Boulder

Here's about 10 minutes of brain dump that could become its own guide with lot more care and attention.

Where to stay

  • Hotel Boulderado: it's right downtown, and walking distance to just about everything
  • Quality Inn & Suites, still downtown-ish.
  • St. Julien, if you're feeling fancy.
You can’t perform that action at this time.