Skip to content

Instantly share code, notes, and snippets.

@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',
@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 / 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 / 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 / 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 / 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 / .zshrc
Created September 11, 2014 00:23
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="mh"
# Uncomment the following line to use case-sensitive completion.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BackgroundBlur</key>
<real>0.0</real>
<key>BackgroundColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGISJYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKUHCBMXHlUkbnVsbNUJCgsMDQ4PEBESVk5TQ01ZS1xOU0NvbXBvbmVudHNcTlND
int MARGIN = 30,
HEAD_SIZE = 200, // Jenkins, you bigheaded bastard
DRUM_ROWS = 3,
DRUM_COLS = 3,
SPACING = 10;
ArrayList<DrumHead> drums = new ArrayList<DrumHead>();
ArrayList<PressArea> pressAreas = new ArrayList<PressArea>();
class PressArea {
@Lanny
Lanny / fine.sh
Created August 18, 2015 17:31
A utility to view the output of find in vim's fs explorer
#!/usr/bin/env bash
targ_dir=`mktemp -d /tmp/fine_dir.XXXX`
find . -name "*$@*" | while read line; do
ln -s "$(pwd)/$line" "$targ_dir"
done
mvim "$targ_dir"