Skip to content

Instantly share code, notes, and snippets.

View Spacerat's full-sized avatar

Joe Atkins-Turkish Spacerat

View GitHub Profile
@Spacerat
Spacerat / circuits.ipynb
Last active August 29, 2015 13:58
Circuit tree calculator
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Spacerat
Spacerat / rand.ipynb
Last active August 29, 2015 13:56
Uniform distribution as building block for other distributions
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Spacerat
Spacerat / delete_duplicates.py
Created February 2, 2014 19:04
Delete the newest of files with the same name except for different extensions.
import os, time
import os.path
for path, dirs, files in os.walk('./'):
dups = {}
for x in files:
name, ext = os.path.splitext(x)
fullpath = path+'/'+x
(mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime) = os.stat(fullpath)
if not name in dups:
@Spacerat
Spacerat / delete_orphans.scpt
Last active March 23, 2016 16:28
AppleScript to remove items from iTunes whose files have been deleted
tell application "iTunes"
set selectedTracks to selection
repeat with i from 1 to (length of selectedTracks)
if class of item i of selectedTracks is not shared track then
tell item i of selectedTracks to set {loc} to {get location}
if loc is missing value then
tell application "iTunes"
delete item i of selectedTracks
end tell
end if