Skip to content

Instantly share code, notes, and snippets.

View runejuhl's full-sized avatar
💻
[runejuhl is typing]

Rune Juhl Jacobsen runejuhl

💻
[runejuhl is typing]
View GitHub Profile
Array.prototype.slice.call(document.querySelectorAll('.game-name')).filter((x) => x.previousElementSibling.querySelector('.hb-steam')).map((x) => x.querySelector('h4').innerText).forEach((x) => console.log(x))
Asdivine Hearts
Broken Age
Bulb Boy
The Bureau: XCOM Declassified
Costume Quest
The Darkness II
Duke Nukem Forever
Expand - Soundtrack Edition
class JSONError extends Exception {}
class JSONErrorDepth extends JSONError {}
class JSONErrorMalformed extends JSONError {}
class JSONErrorSyntax extends JSONError {}
function json_check_if_error() {
$error = json_last_error();
switch ($error) {
case JSON_ERROR_NONE:
@runejuhl
runejuhl / git.sh
Created February 14, 2016 03:24
Git info in $PS1
# Useful for displaying git status whenever you cd to a git dir.
# Example:
# runejuhl@cartagena:~//git/project:master:2A1AM5M3??
# for 2 new staged files, 1 staged file that's been modified since staging, 5 modified files and 3 untracked files.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/:\1/'
}

Keybase proof

I hereby claim:

  • I am runejuhl on github.
  • I am runejuhl (https://keybase.io/runejuhl) on keybase.
  • I have a public key whose fingerprint is F51C 442E CCEA 4280 D1AE 149A 5368 F462 192D 5F54

To claim this, I am signing this object:

@runejuhl
runejuhl / org-latex-per-file-class.el
Created November 22, 2013 17:33
Empty LaTeX class for org-mode export.
(unless (boundp 'org-latex-classes)
(setq org-latex-classes nil))
(add-to-list 'org-latex-classes
'("per-file-class"
"\\documentclass{article}
[NO-DEFAULT-PACKAGES]
[EXTRA]"))
@runejuhl
runejuhl / objdumpmap.py
Created May 16, 2013 17:47
Merges objdump with strings to create a disassembly with added symbols. Will show variables (and size) and some strings. Note that string functionality hinges on the output from strings, e.g. '\nOMG' won't be found by strings.
#!/usr/bin/env python
import sys
import subprocess
import re
import os.path
def main():
if len(sys.argv) < 2:
print('Missing argument')
sys.exit(-1)
@runejuhl
runejuhl / buenos-timetest.sh
Created April 5, 2013 09:22
Timer testing for Buenos
#!/usr/bin/env bash
for i in `seq 1 10`; do make > /dev/null && yams buenos initprog=[disk]sleep | tail -n 3 | grep -v kHz| grep --color=never -oE '[0-9]+.[0-9]+' | python -c "import sys
lines = [x.strip() for x in sys.stdin.readlines()]
print str(float(lines[0])/float(lines[1])) + ' seconds'"; done
@runejuhl
runejuhl / userChrome.css
Created March 19, 2013 17:07
Reduce Firefox interface size, fix minor annoyances. Some tags might not do much, but the latest userChrome specification I found was from circa 2007, and restarting Firefox to check changes becomes a bother from the 5th time onwards...
/*
* Edit this file and copy it as userChrome.css into your
* profile-directory/chrome/
*/
/*
* This file can be used to customize the look of Mozilla's user interface
* You should consider using !important on rules which you want to
* override default settings.
*/
[{boss, [
{path, "/home/runejuhl/projects/dependencies/erlang/ChicagoBoss"},
{vm_cookie, "lollo"},
{applications, [runejerl, cb_admin]},
{db_host, "localhost"},
{db_database, "runejerl"},
{db_port, 5432},
{db_username, "runejerl"},
{db_password, "nah"},
{db_adapter, pgsql},
int i, j;
for (i = 0; i < array.lenght(); i++) {
if ((j = array[i] * 2) > 10)
j = j % 10 + 1;
array[i] = j;
}