Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexei Baboulevitch archagon

View GitHub Profile
@archagon
archagon / title.html
Last active Aug 29, 2015
If you have a lot of browser windows open that you're not currently using, open this page and type in a title. Now your browser windows will be annotated. Especially useful if you use OSX spaces.
View title.html
<style>
input {
margin-top: auto;
margin-bottom: auto;
background-color: transparent;
font-size: 150px;
width: 100%;
height: 100%;
text-align: center;
border: none;
@archagon
archagon / dom-filter.js
Last active Feb 4, 2016
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.
View dom-filter.js
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 Jan 1, 2016
An attempt at making a bookmarklet to download any YouTube and/or MP4 videos on a page.
View video-dl-bookmarklet.js
(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 Jan 1, 2016
Pretty CSS tables for my Squarespace site.
View simpletables.css
table
{
text-align:center;
border-collapse:collapse;
border:none;
font-size:0.85em;
display:inline-block;
line-height:1.4em;
}
.tablepadding
@archagon
archagon / robocopy-delete
Created Jun 16, 2013
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.
View robocopy-delete
robocopy /b /mir "C:\EmptyDir" "C:\DirToEmpty"
@archagon
archagon / robocopy-backup
Last active Mar 26, 2022
A bunch of robocopy flags to help backup an external drive.
View robocopy-backup
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 / PDFGenSimple.java
Created Jun 10, 2013
A quick bit of code to generate PDFs from scans, using the iText open-source library.
View PDFGenSimple.java
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 / PDFGenComplex.java
Last active Nov 20, 2018
A quick bit of code to generate PDFs from scans, using the iText open-source library.
View PDFGenComplex.java
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 / abutil.py
Created May 13, 2013
Reusable util file. Now with custom ANSI colors!
View abutil.py
import __main__
import os
_ansi_color_codes = {
"black":30,
"red":31,
"green":32,
"yellow":33,
"blue":34,
"magenta":35,
@archagon
archagon / gdc-encoder.py
Last active Apr 12, 2016
A quick and dirty script to convert GDC Vault videos to a pleasant mobile viewing format.
View gdc-encoder.py
# 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]