Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@davemenninger
davemenninger / sdl2demo.c
Created January 27, 2021 00:46
SDL2 Demo in 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;
#!/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
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 October 25, 2016 19:45
findintext and 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 '*~$'

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 July 11, 2014 13:28
make a directory of asciidoc files into html and pdf and deploy to somewhere with a script
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 August 29, 2015 14:02
Hive13 supybot plugin. uses hackerspace api, so usable by any hackerspace.
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 December 6, 2013 16:10
for a given address, find what cincinnati public school you would be assigned
#!/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 December 6, 2013 16:01
gets temperatures from odot road sensors around cincinnati
#!/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 July 17, 2013 18:12
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.
#!/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