This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Parker Square! :) | |
# Randomly try to get lucky and find a magic square with all square numbers. | |
# Idea came from here: https://www.youtube.com/watch?v=G1m7goLCJDY | |
import sys, random, pprint | |
rand = random.SystemRandom() | |
square_size = 3 | |
square_step_x = list(range(square_size)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import calendar | |
# Martin Luther King, Jr. Day was established in 1986, so the first presidential inauguration to be affected was | |
# George Bush I on Jan 20, 1989. King's birthday was the 15th, but we celebrate it on the 3rd Monday of each January. | |
# So, to me, the interesting days would be when MLK is on the 19th, 20th, or 21st. | |
# Let's go until the year 2089, just to get a full 100-year period since MLK started. | |
start_year = 1989 | |
end_year = 2089 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
# This script is meant to be used to monitor a button on the | |
# Raspberry Pi. I connected the button between pins 13 and 14, | |
# chosen because BCM 27 is not used for anything else and it is | |
# right next to a ground, so I can use a single connector. | |
# | |
# If the button is pressed breifly (less than 5 seconds), the Pi | |
# will reboot. If the button is held down longer, it will shut down (halt). | |
# After a halt, you will need to cycle power to restart. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This has been edited to work with python3. Some of the tested combinations will not work in python2. | |
import pandas as pd | |
df = pd.DataFrame({'text': [str(i % 1000) for i in range(1000000)], | |
'numbers': range(1000000)}) | |
import pickle | |
# Python 3 has no cPickle | |
#import cPickle | |
import json | |
from functools import partial |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python | |
# convert any video file recognized by ffmpeg to divx | |
import subprocess, json, argparse, tempfile, os | |
import pprint | |
# Check arguments | |
parser = argparse.ArgumentParser(description="Convert any video file recognized by ffmpeg into a legacy DIVX") | |
parser.add_argument('--iphone',help='Convert to iPhone-compatible mp4 instead of Divx',action='store_true') | |
parser.add_argument('--kindlefirehd', help='Convert to Kindle Fire compatible mp4 instead of Divx', action='store_true') | |
parser.add_argument('--subtitles', help='Name of subtitles file to burn into video.') |