Skip to content

Instantly share code, notes, and snippets.

View sdl2demo.c
#include <SDL2/SDL.h>
#include <stdio.h>
/* Screen dimension constants */
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
int error(char *msg, const char *err) {
printf("Error %s: %s\n", msg, err);
return 1;
View branch-and-migration.bash
#!/usr/bin/env bash
GIT_ROOT=`git rev-parse --show-toplevel`
MIGRATION_FILENAME="$GIT_ROOT/migrations/$1.sql"
git checkout -b $1
touch $MIGRATION_FILENAME
vim $MIGRATION_FILENAME
View orbits.rb
def position( speed: , time:)
(speed * time) % 576
end
planets = [
{ name: "A", speed: 24, },
{ name: "B", speed: 15, },
{ name: "C", speed: 9, },
{ name: "D", speed: 6, },
{ name: "E", speed: 4, },
@davemenninger
davemenninger / TODO
Created Oct 25, 2016
findintext and TODO
View TODO
#!/bin/bash │- # TODO line_item_number, event, description
│- # $order->$method(
here=`pwd` │- # line_item_numbers => [ $message->{line_item_number} ],
cd `git rev-parse --show-toplevel` │- # description => $message->{event}->{description},
findintext TODO | egrep -v '*~$'
View keybase.md

Keybase proof

I hereby claim:

  • I am davemenninger on github.
  • I am davemenninger (https://keybase.io/davemenninger) on keybase.
  • I have a public key whose fingerprint is 2054 5168 14F3 E5E3 6A1C C390 7310 F86F A989 BBBA

To claim this, I am signing this object:

@davemenninger
davemenninger / Makefile
Created Jul 11, 2014
make a directory of asciidoc files into html and pdf and deploy to somewhere with a script
View Makefile
HTML = $(patsubst %.asciidoc,%.html,$(shell find . -name '*.asciidoc' ))
PDF = $(patsubst %.html,%.pdf,$(shell find . -name '*.html' ))
all: $(HTML) $(PDF)
%.html: %.asciidoc
asciidoc -a toc $(<F)
%.pdf: %.html
xhtml2pdf $(<F)
@davemenninger
davemenninger / plugin.py
Last active Aug 29, 2015
Hive13 supybot plugin. uses hackerspace api, so usable by any hackerspace.
View plugin.py
import supybot.utils as utils
from supybot.commands import *
import supybot.plugins as plugins
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
from urllib2 import urlopen
from json import load
class Hive13(callbacks.Plugin):
@davemenninger
davemenninger / gist:7827320
Created Dec 6, 2013
for a given address, find what cincinnati public school you would be assigned
View gist:7827320
#!/usr/bin/python
import urllib
import urllib2
from bs4 import BeautifulSoup
url = "http://slg.cps-k12.org/slg/school-lookup.asp"
#url = "http://slg.cps-k12.org/slg/school-lookup-nextyear.asp"
values = {
@davemenninger
davemenninger / gist:7827177
Created Dec 6, 2013
gets temperatures from odot road sensors around cincinnati
View gist:7827177
#!/bin/bash
curl 'http://www.ohgo.com/Dashboard.aspx/getRoadSensorMarkers' \
-X POST \
-H 'Accept: */*' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Accept-Language: en-US,en;q=0.5' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json; charset=utf-8' \
@davemenninger
davemenninger / gist:6022994
Created Jul 17, 2013
Uses tesseract, hocr2pdf, and pdfconcat to build a OCR'ed ( searchable ) PDF from a dir full of tif files. Inteded use is with the output of a diybookscanner and ScanTailor.
View gist:6022994
#!/bin/bash
for img in *.tif; do tesseract $img $img hocr; done
for img in *.tif; do hocr2pdf -i $img -o $img.pdf < $img.html; done
pdfconcat -o merged.pdf ./*.pdf