Skip to content

Instantly share code, notes, and snippets.

View archagon's full-sized avatar

Alexei Baboulevitch archagon

View GitHub Profile
@archagon
archagon / gdc-downloader.py
Last active March 21, 2024 19:04
A quick and dirty script to download GDC Vault videos.
# 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
@archagon
archagon / robocopy-backup
Last active January 22, 2024 03:38
A bunch of robocopy flags to help backup an external drive.
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
@archagon
archagon / gdc-encoder.py
Last active March 10, 2023 13:44
A quick and dirty script to convert GDC Vault videos to a pleasant mobile viewing format.
# 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]
@archagon
archagon / playlist-to-podcast.py
Created September 28, 2012 07:03
A script that downloads videos from YouTube playlists, extracts their audio, and only downloads missing files each time it's run. Also generates an iTunes-compliant podcast xml file for private hosting purposes. Requires youtube-dl, ffmpeg, and ffprobe.
# 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.
@archagon
archagon / robocopy-delete
Created June 16, 2013 08:03
Sometimes Windows has trouble deleting directories with very long paths down in the lower depths. Fortunately, robocopy can magically circumvent this! Simply create an empty directory and mirror it into the directory you wish to delete.
robocopy /b /mir "C:\EmptyDir" "C:\DirToEmpty"
@archagon
archagon / PDFGenComplex.java
Last active November 20, 2018 00:14
A quick bit of code to generate PDFs from scans, using the iText open-source library.
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;
@archagon
archagon / dom-filter.js
Last active February 4, 2016 06:36
The start of a generic DOM filtering bookmarklet, along with sample code. Useful if a website's filters aren't specific enough. SEL is the selector for the main list item and COND is a filtering function that you can customize.
var PRINT = false;
var LOG = 1;
var SEL = ".pin";
var COND = function($node) {
var ret = true;
ret = checkNum($node, ".pinPrice", ">=", 10);
if (!ret) { return false; }
@archagon
archagon / video-dl-bookmarklet.js
Last active January 1, 2016 12:29
An attempt at making a bookmarklet to download any YouTube and/or MP4 videos on a page.
(function() {
var appName = "";
var jQueryVersion = "2.0.3";
var jQueryUIVersion = "1.10.3";
var jQueryUITheme = "redmond";
function loadPrerequisites(callback)
{
loadJQuery(function() {
@archagon
archagon / simpletables.css
Last active January 1, 2016 00:29
Pretty CSS tables for my Squarespace site.
table
{
text-align:center;
border-collapse:collapse;
border:none;
font-size:0.85em;
display:inline-block;
line-height:1.4em;
}
.tablepadding
@archagon
archagon / PDFGenSimple.java
Created June 10, 2013 11:05
A quick bit of code to generate PDFs from scans, using the iText open-source library.
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;