Skip to content

Instantly share code, notes, and snippets.

@lubert
lubert / newyorker.js
Last active August 7, 2019 01:35
New Yorker voting script
window.found = false
for (let i =0; i < 500; i++) {
setTimeout(function() {
if (window.found) return;
if ($('#the_caption').text().includes('<MATCH>')) {
console.log("rank:", i)
$('.latest-button-wrapper span')[2].click()
window.found = true
} else {
$('.latest-button-wrapper span')[0].click()
@lubert
lubert / capsctrl.json
Created December 16, 2017 01:06
Karabiner Elements - Map Caps Lock to Left Control
{
"title": "Map Caps Lock to Left Control",
"rules": [
{
"description": "Change caps_lock to left_control",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "caps_lock"
@lubert
lubert / ctrloptionterm.json
Last active September 19, 2022 19:13
Karabiner Elements - Swap left command and option keys only in terminal
{
"title": "Swap left command and option keys only in Terminal",
"rules": [
{
"description": "Change left_command to left_option",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "left_command"
@lubert
lubert / execPromise.js
Created May 27, 2016 02:55
execPromise for casperjs
var require = patchRequire(require);
var cp = require('child_process');
var Q = require('q');
module.exports = function(cmd, args) {
var q = Q.defer();
cp.execFile(cmd, args, null, function(err, stdout, stderr) {
if (err) return q.reject(err);
return q.resolve(stdout, stderr);
});