Skip to content

Instantly share code, notes, and snippets.

View di's full-sized avatar

Dustin Ingram di

View GitHub Profile
@di
di / index.mkdn
Created September 15, 2010 01:59
Description of a test gist. This is a test gist. Do not adjust your internet
#!/usr/bin/python
# Gist-test by Dustin Ingram
def main() :
print "%s,%s" % ('Hello', 'World')
if __name__ == "__main__" :
main() :
@di
di / Screenshot.java
Created February 17, 2012 17:53
The whole screenshot class
import java.io.File;
import java.io.IOException;
import com.android.ddmlib.AndroidDebugBridge;
import com.android.ddmlib.IDevice;
import com.android.ddmlib.RawImage;
import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
import java.awt.Dimension;
import java.awt.image.BufferedImage;
#!/usr/bin/python
def z(a, c):
r[a] = 0
return c + 1
def i(a, c):
r[a] += 1
return c + 1
@di
di / oneeyedrobot.py
Created May 6, 2013 17:21
JGC's "one-eyed robot" problem, implemented in Python. See http://dustingram.com/articles/2013/05/02/z-machines-and-one-eyed-robots/
#!/usr/bin/python
import random
class ball:
def __init__(self, color):
self.color = color
self.examined = 0
<html>
<head>
<script type="text/javascript">
function reloadpic() {
document.images["screen"].src = "screen.png?random=" + new Date().getTime();
setTimeout("reloadpic();", 500);
}
onload = reloadpic;
</script>
</head>
@di
di / xkcd.py
Last active December 22, 2015 07:49
XKCD hash breaking competition. See http://xkcd.com/1193/
#!/home/dustin/bin/py
from skein import skein1024
import random, string
import requests
a="0"+bin(int('5b4da95f5fa08280fc9879df44f418c8f9f12ba424b7757de02bbdfbae0d4c4fdf9317c80cc5fe04c6429073466cf29706b8c25999ddd2f6540d4475cc977b87f4757be023f19b8f4035d7722886b78869826de916a79cf9c94cc79cd4347d24b567aa3e2390a573a373a48a5e676640c79cc70197e1c5e7f902fb53ca1858b6',16))[2:]
def rando():
c = string.digits+string.ascii_letters
@di
di / tlds
Created December 4, 2014 20:01
Valid Two-Letter Top Level Domains
ac
ad
ae
af
ag
ai
al
am
an
ao
@di
di / cheryl.py
Created April 15, 2015 20:57
Chery's Birthday Problem
class Date:
def __init__(self, day, month):
self.day = day
self.month = month
def __repr__(self):
return "(%d, %s)" % (self.day, self.month)
dates = [
Date(15, 'may'),
Date(16, 'may'),

Keybase proof

I hereby claim:

  • I am di on github.
  • I am dustingram (https://keybase.io/dustingram) on keybase.
  • I have a public key whose fingerprint is 321D E2BA 9BA7 5C06 AF95 53F6 93D2 B8D4 930A 5E39

To claim this, I am signing this object:

@di
di / coins.py
Created December 4, 2015 15:38
consolidated coins script
import cv2
import numpy as np
img = cv2.imread("coins.png", cv2.IMREAD_GRAYSCALE)
circles = cv2.HoughCircles(
img,
cv2.cv.CV_HOUGH_GRADIENT,
dp=1.5,
minDist=30,