Skip to content

Instantly share code, notes, and snippets.

🏏

Saul Shanabrook saulshanabrook

🏏
Block or report user

Report or block saulshanabrook

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@saulshanabrook
saulshanabrook / Convert Movies.py
Created Jan 22, 2012
Converts, imports, and then removes downloaded video files in a folder, and its subfolders, into Python.
View Convert Movies.py
import os
from os.path import join
from subprocess import call
source_directory = '/Users/ygbhygb/Documents/Torrents/To Be Converted'
output_directory = '/Users/ygbhygb/Music/iTunes/iTunes Media/Automatically Add to iTunes'
video_endings = ['.avi', '.mkv']
hb_options = '--preset="universal"'
hbcli_path = '/Applications/HandBrakeCLI'
@saulshanabrook
saulshanabrook / .gitignore
Created Jul 6, 2012
Analyze Unison log, and send email of changed files
View .gitignore
unison.log.old
unison.log
View example.py
# Note: this isn't python. It just has some syntax highlighting to make it more readable
# First pair is stocks x, y with a difference of z (ex. 60, 80 with a difference of 20)
x + z == y # 80 - 20 = 60
z == y - x # 20 = 80 - 60
# Buy smaller (x), sell larger (y)
balance == -(x + (100 - y)) # -(60 + (100 - 80))
== -(x + 100 - y) # -(60 + 100 - 80)
== -(-(y - x) + 100 ) # -(-(20 - 60) + 100))
@saulshanabrook
saulshanabrook / .gitignore
Created Sep 4, 2012
Test Project for issue #134 on rq
View Preferences.sublime-settings
{
"close_windows_when_empty": true,
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow.tmTheme",
"create_window_at_startup": false,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"find_selected_text": true,
"fold_buttons": false,
"folder_exclude_patterns":
[
@saulshanabrook
saulshanabrook / save_images.py
Created Oct 5, 2013
Create a range of JPEG image sizes and save them to the disk. I wrote this to test my image uploading and processing capabilities for https://github.com/saulshanabrook/django-canadanewyork
View save_images.py
import os
from PIL import Image
IMAGE_SIZES = range(500, 20000, 2000)
JPEG_SAVE_QUALITY = 100
DIRECTORY = '~/Desktop/temp/'
COLOR = 'red'
View 12.10.04 Vector Adventure Lab.py
# Included in LaTeX document, but also I put it here for better code highlighting
import math
import operator
import itertools
import numpy
def polar_to_cartesian(point):
r, theta = point
@saulshanabrook
saulshanabrook / README.md
Last active Aug 29, 2015
Artwork Names and Descriptions from PP
View README.md

For my art history class, my teacher gave me a large PP with a slide for each artwork we needed to learn, so that I could use upload the images plus the artwork identifications and classifications to Memrise for virtual study cards.

I grew tired of copying the two lines from each slide, so I decided to try to parse the PP in python to export a list of artwork IDs and classifications. For example, here El Greco I wanted the output to be El Greco: Mannerism.

I found out that a .ppx file is really just a .zip, so once I extracted the PP it was easy to find the slide files, which were all .xml.

https://asciinema.org/a/8098

@saulshanabrook
saulshanabrook / README.md
Last active Aug 29, 2015
Prolific Genetic Programers
View README.md
View helpers.py
from collections import namedtuple
Parents = namedtuple('Parents', ['mother', 'father'])
from itertools import zip_longest
from collections import Counter, abc
class FrozenCounter(Counter):
'''
You can’t perform that action at this time.