This file contains 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 sys | |
import operator | |
import os | |
from random import shuffle | |
def main(args): | |
try: | |
if (len(args) == 2): | |
data = parse(args[1]) | |
rank(data) |
This file contains 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
#include <stdio.h> | |
#include <string.h> | |
int main(void) | |
{ | |
char* code = "#include <stdio.h>\n#include <string.h>\n\nint main(void)\n{\n char* code = \"%s\";\n\n int len = strlen(code);\n int tokenStarted = 0;\n for (int i = 0; i < len; i++)\n {\n char c = code[i];\n\n if (tokenStarted == 1)\n {\n if (c == 's')\n {\n for (int j = 0; j < len; j++)\n {\n char d = code[j];\n\n if (d == '\\n')\n {\n putchar('\\\\');\n putchar('n');\n }\n else if (d == '\\\"')\n {\n putchar('\\\\');\n putchar('\\\"');\n }\n else if (d == '\\\\')\n {\n putchar('\\\\');\n putchar('\\\\');\n }\n else\n |
This file contains 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
# YouTube playlist audio retreiver and iTunes-compliant podcast XML generation tool. | |
# This script will download each video file from the specified YouTube playlist, losslessly extract | |
# the audio, delete the video, and ultimately produce an iTunes-compliant podcast XML with the | |
# appropriate metadata, including chapter markers (if provided in the description). If you run the | |
# script again, only videos that haven't already been converted will be downloaded, allowing you to | |
# schedule the script to run as often as needed without stressing your internet connection or | |
# hard drive space. After generating the files and xml, you can easily host them on a local server | |
# in order to use them with iTunes or your favorite podcast aggregator -- but that's beyond this | |
# script's jurisdiction. |
This file contains 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
# GDC Vault videos can't be watched on mobile devices and this is a very sad thing indeed! | |
# (Note: this has changed for GDC2013, which lets you watch raw MP4 streams. Kudos!) | |
# This script is designed to circumvent this by downloading the lecture and slideshow | |
# videos which can then be re-encoded into whatever format you wish. Obviously, you | |
# won't be able to do this without access to the Vault. This is strictly for the | |
# convenience of legitimate Vault users! | |
# Note: this code is rather flimsy and was written as fast as possible for my own personal use. | |
# The code only works for the most recent GDC Vault videos, since they all use the same player | |
# format. If the XML format used to run the player is changed (as it has in the past), the code |
This file contains 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/python | |
# This script takes a video and remuxes it as an iOS-compatible video, re-encoding the audio if necessary. | |
# Note that the video WILL NOT be re-encoded. The script will fail if the video is not h264. | |
# | |
# Requires ffmpeg, ffprobe, and afconvert to be installed. | |
import re | |
import os | |
import sys |
This file contains 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 script continues the work of gdc-downloader.py and actually combines the video and audio | |
# into a single video file. The underlay.png file specifies the dimensions of the video. | |
# Personally, I use an all-black 1024x768 rectangle for optimal iPad viewing. | |
# As with gdc-downloader.py, code quality is crappy and quickly assembled to work for my | |
# nefarious purposes. | |
# Usage is as follows: | |
# | |
# gdc-encoder.py [video name] [video path] [output name] [GDC name] |
This file contains 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 __main__ | |
import os | |
_ansi_color_codes = { | |
"black":30, | |
"red":31, | |
"green":32, | |
"yellow":33, | |
"blue":34, | |
"magenta":35, |
This file contains 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 java.io.IOException; | |
import java.io.FileOutputStream; | |
import java.io.File; | |
import java.io.FilenameFilter; | |
import java.util.Map; | |
import java.util.HashMap; | |
import com.itextpdf.text.Document; | |
import com.itextpdf.text.DocumentException; | |
import com.itextpdf.text.Image; | |
import com.itextpdf.text.Rectangle; |
This file contains 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 java.io.IOException; | |
import java.io.FileOutputStream; | |
import java.io.File; | |
import java.io.FilenameFilter; | |
import java.util.Map; | |
import java.util.HashMap; | |
import com.itextpdf.text.Document; | |
import com.itextpdf.text.DocumentException; | |
import com.itextpdf.text.Image; | |
import com.itextpdf.text.Rectangle; |
This file contains 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
robocopy /b /e /xa:s /xjd /sl /a-:hs /mt /v /fp /eta /log:"D:\To\Directory\transfer.log" /tee "C:\From\Directory" "D:\To\Directory" | |
(Note that the paths don't have a trailing backslash.) | |
/b -- backup mode (there's a /zb option for restart mode, but it's a whole lot slower) | |
/e -- copies subdirectories (including empty directories) in addition to files | |
/xa:s -- exclude system files | |
/xjd -- exclude junction points | |
/sl -- copy symbolic links as links | |
/a-:hs -- remove hidden/system attributes from files |
OlderNewer