Skip to content

Instantly share code, notes, and snippets.

View gunthercox's full-sized avatar

Gunther Cox gunthercox

View GitHub Profile
@gunthercox
gunthercox / filecolor.py
Created September 29, 2014 14:11
Converts a file name to a color code.
def filecolor(filename):
colors = ("#f15501", "#f15501", "#f3ca0a", "#199c4b",
"#0298c3", "#ca2afe", "#6e4a7e", "#701516",
"#6594b9", "#0d3c6e", "#3ebc27", "#a9188d",
"#f15501", "#543978", "#37775b", "#0579aa",)
# if the filename has an extension, use it for the hash
if "." in filename:
filename = filename.split(".")[1]
@gunthercox
gunthercox / imageFileTest.py
Last active August 29, 2015 13:57
Generates a graph based on the file size of image formats for different dimensions of images.
from PIL import Image
import turtle
import os
def make_image(imagename, imagetype, imagesize):
"""
Creates a new square RGB image.
"""
size = (imagesize, imagesize)
@gunthercox
gunthercox / Sonic Screwdriver
Created December 1, 2012 01:13
Arduino code for a sonic screwdriver.
// Sonic Screw Driver
// CONSTANTS AND VARIABLES
const int button2 = 2;
const int button3 = 3;
const int speaker = 4;
const int inputVoltagePin = 6;
const int IREMITTER = 7;
const int IRRECEIVER = 8;
const int LED = 9;