Skip to content

Instantly share code, notes, and snippets.

View prendradjaja's full-sized avatar

Pandu Rendradjaja prendradjaja

View GitHub Profile
@prendradjaja
prendradjaja / quickopen.vim
Last active August 4, 2017 23:58
Open a file from your IDE in a terminal really quickly
" This is really a mangled fork of Vertigo. TODO merge the two MAYBE?
" https://github.com/prendradjaja/vim-vertigo
" Branched at: 01595aef31100716e7a2c046fe201808036189a4
" Load user settings
if !exists('g:QuickOpen_homerow')
let s:homerow = 'asdfghjkl;'
else
let s:homerow = g:QuickOpen_homerow
endif
@prendradjaja
prendradjaja / style.css
Created April 17, 2018 18:43
Userstyle for hiding everything on Facebook except chat
body {
background-image: url(https://lh3.googleusercontent.com/vNRD8biNwF9fJN7VZBxi97h47noTxeE3jpKA308NrudcTtlHakyBDyLpA1EQJit9tX0JDEogxCRUMfg=w2048-h1536-rw-no);
background-size: cover;
overflow: hidden;
}
/* Things I want hidden */
#pagelet_bluebar {
visibility: hidden;
}
@prendradjaja
prendradjaja / bookmarklet.js
Created April 24, 2018 01:16
Go to a GitHub PR's branch
javascript: var repo_url = window.location.href.split('/').slice(0,5).join('/'); var branch_name = document.querySelectorAll('#partial-discussion-header .commit-ref')[1].innerText; window.location.href = repo_url + '/tree/' + branch_name;
@prendradjaja
prendradjaja / userscript.js
Created April 24, 2020 04:03
Strava cumulative time calculator userscript
// ==UserScript==
// @name Strava cumulative time calculator
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.strava.com/activities/*
// @grant none
// ==/UserScript==
@prendradjaja
prendradjaja / demo.html
Created April 27, 2020 05:53
grid interactive demo for nat
<style>
td {
border: 1px solid black;
height: 50px;
width: 50px;
}
td.highlighted {
background: #ffcccc;
}
// For use with https://flockingjs.org/demos/playground/
//
// You can use this to
// - Hear what just intonation sounds like vs equal temperament
// const notes = notesET;
// - Hear what different keys sound like in just intonation
// const chord = [notes[E], notes[Gs], notes[B]];
// - Hear what different keys sound like but pitch-shift them back to C for an
// apples-to-apples comparison
// const rotationDistance = 4; // 4 half steps
@prendradjaja
prendradjaja / grid.py
Created December 11, 2020 15:51
AoC 2017.11a
""" Many of these methods work for n dimensions """
def _make_grid_library(names, rotdir):
"""
names: e.g. RDLU corresponding to `dirs` below
rotdir: Going forward in `names` (e.g. RDLU -- R to D) is a...
- right turn: 1
- left turn: -1
"""
class clazz: # Not really a class -- can I use a module instead?
@prendradjaja
prendradjaja / assembler.py
Created June 21, 2021 22:16
Intcode pseudo-assembler and example program (nth triangle number)
from intcode import IntcodeComputer, Param, POSITION_MODE, IMMEDIATE_MODE, RELATIVE_MODE
class VariableAllocator:
def __init__(self, code_segment_length, data_segment_length, program):
self.code_segment_length = code_segment_length
self.data_segment_length = data_segment_length
self.program = program # This will be mutated
self.nvars = 0
var byte1 = message.data[0] === 144 || message.data[0] === 128 ? -message.data[1] + 124 : message.data[1];
// byte1 = message.data[1];
@prendradjaja
prendradjaja / main.js
Created October 28, 2021 04:41
setwithfriends wait for game
setInterval(() => {
const game = document
.querySelector('tr svg[title="Accepting players"]')
?.parentElement;
if (game) {
console.log('Game found! Clicking...');
game.click();
}
}, 50);