Skip to content

Instantly share code, notes, and snippets.

View zacharyliu's full-sized avatar

Zachary Liu zacharyliu

View GitHub Profile
@zacharyliu
zacharyliu / mediakeys.ahk
Created March 17, 2014 05:26
Media key shortcuts inspired by the CODE Keyboard
AppsKey & Insert::Send {Media_Play_Pause}
AppsKey & Home::Send {Media_Stop}
AppsKey & Delete::Send {Media_Prev}
AppsKey & End::Send {Media_Next}
AppsKey & PgUp::Send {Volume_Up}
AppsKey & PgDn::Send {Volume_Down}
AppsKey Up::Send {AppsKey}
@zacharyliu
zacharyliu / cscp.js
Created June 18, 2014 05:47
PhantomJS script for rendering Cambridge Latin Course online textbooks into a multi-page PDF
var url = 'http://cambridgescp.com/singles/webbook/s47/sdfg47jkl51poa.html';
var page = require('webpage').create();
page.paperSize = { width: '480px', height: '620px', border: '0px' };
page.open(url, function () {
page.evaluate(function() {
document.getElementById('navigation_instructs').style.display = 'none';
document.body.style.cssText = 'font-family: "Times New Roman" !important';
document.querySelector('#frm').style.position = 'relative';
Verifying that +zacharyliu is my Bitcoin username. You can send me #bitcoin here: https://onename.io/zacharyliu
@zacharyliu
zacharyliu / waitlist_lottery_acceptances.js
Last active August 29, 2015 14:08
HackPrinceton Fall 2014 second round acceptances script
var rawData = require('./all_users_data_2014_10_24.json');
// console.log(rawData);
var skipTeams = process.argv;
skipTeams.splice(2);
var teams = {};
var sizes = {};
var mappings = {
"MIT": "MIT",
@zacharyliu
zacharyliu / elucidate.js
Created January 26, 2015 07:03
Elucidate Solution (Node.js)
var fs = require('fs');
var e = fs.readFileSync('elucidate.txt', 'utf8');
var gcd = function(a, b) {
if ( ! b) {
return a;
}
return gcd(b, a % b);
@zacharyliu
zacharyliu / facebook-autopoker.js
Created February 5, 2015 03:14
Facebook Autopoker
document.querySelector('#poke_live_new').addEventListener("DOMSubtreeModified", function() {
[].slice.call(document.querySelectorAll('#poke_live_new a[ajaxify^="/pokes/inline/?dom_id_replace"]')).forEach(function(elem) {
elem.click();
});
}, false);
@zacharyliu
zacharyliu / git-squash.sh
Last active November 4, 2023 02:44
oneliner to squash all commits ahead of origin/master into one commit
git reset --hard `git merge-base --fork-point origin/master` && git merge --squash HEAD@{1} && git commit
@zacharyliu
zacharyliu / watermark.sh
Created April 5, 2016 05:31
Apply watermark.png at 25% size in lower left corner, and rename output to EXIF date
#!/bin/bash
for FILE in "$@"; do
ww=`convert $FILE -format "%[fx:w]" info:`
hh=`convert $FILE -format "%[fx:h]" info:`
datepath="$(identify -verbose $FILE | grep DateTimeOri | awk '{print $2"_"$3 }' | sed s%:%_%g)"
convert $FILE -auto-orient \( watermark.png -resize $((ww / 4))x$((hh / 4)) \) -gravity SouthWest -composite ${datepath}_overlay.jpg
done

Keybase proof

I hereby claim:

  • I am zacharyliu on github.
  • I am zacharyliu (https://keybase.io/zacharyliu) on keybase.
  • I have a public key ASAOMgHbsvV6vfmuIMnt-AXyOa9S76t0h_jwvsaUVl58sgo

To claim this, I am signing this object: