Skip to content

Instantly share code, notes, and snippets.

@Lanny
Lanny / pool.js
Created June 14, 2014 02:20
Because accessibility is for dweebs
var wordPool
;(function() {
EFFECT_DISTANCE = 100
MAGNITUDE_COEFFICIENT = 2.5
function distance(p1, p2) {
var asq = Math.pow(p1.top - p2.top, 2)
bsq = Math.pow(p1.left - p2.left, 2)
@Lanny
Lanny / iTunesRenamer.py
Last active January 2, 2016 02:18
Utility to programmatically rename multiple tracks in iTunes using regular expressions.
import win32com.client
import re
from Tkinter import *
CHAR_WIDTH = 60
EXPL_TEXT = ('This is a little utility to rename track names in iTunes (on '
'Windows). To use it select some tracks in iTunes (click a track, '
'hold shift, click another track), enter match and replace '
'patterns and click "Execute Rename". Groups identified in the '
'match pattern will be available in the repl pattern. For example '
@Lanny
Lanny / ode.py
Last active December 25, 2015 11:38
Generate a really crappy .wav containing the main theme of Ode to Joy. Can generate other crappy .wav's as long as they only use the same 5 notes.
#!/usr/bin/python
import wave
import random
from math import pi, sin, cos
OPTIONS = {}
Hz_MAP = {
'c': 130.813,
@Lanny
Lanny / ConwaysLife.py
Created June 2, 2013 01:07
A poorly optimized implementation of Conway's Game of Life in Python with PyGame.
#! /usr/bin/env python
# Conway's game of life
# Copyright(c) 2012 Ryan Jenkins
import pygame, time
from pygame.locals import *
class lifeGrid() :
def __init__(self, width, height) :
@Lanny
Lanny / iTunesArtworkConsistencyChecker.py
Created April 22, 2013 04:43
A really hacky script to check for inconsistencies in album art in an iTunes library. Verification uses md5 hashes, so different resolutions of the same artwork will be considered inconsistent.
import win32com.client
import sys
import hashlib
if __name__ == '__main__' :
itunes = win32com.client.Dispatch("iTunes.Application")
tracks = itunes.LibraryPlaylist.tracks
track_count = tracks.Count
inconsistent_albums = []
@Lanny
Lanny / gist:5175573
Last active December 15, 2015 00:49
Silly little projected thing using canvas.
<html>
<head>
</head>
<body>
<canvas id="primary_canvas" width=800 height=600></canvas>
<script>
function loadAssets(callback) {
var urls = {
'n.png':'http://i.imgur.com/vEgk9O5.png',
'e.png':'http://i.imgur.com/lIbMfuW.png',