Skip to content

Instantly share code, notes, and snippets.

View stuartpb's full-sized avatar

Stuart P. Bentley stuartpb

View GitHub Profile
@stuartpb
stuartpb / dump.js
Created April 10, 2014 22:23
Script for dumping / re-constructing multiple domain transfer list on NameSilo
// for https://www.namesilo.com/transfer_results.php
[].slice.call(document.querySelectorAll('input[name$="_transfer_auth_code"]'))
.map(function (el) {
return el.name.slice(0,-"_transfer_auth_code".length).replace(/_/g,'.')
+ ', ' + el.value})
.join('\n');
@stuartpb
stuartpb / maphack.js
Last active August 29, 2015 14:02
Script for ganking TF2 map images from Wikipedia
// phase 0: copy a subsection of the source of http://wiki.teamfortress.com/wiki/Template:List_of_maps, trim whitespace and run:
// s/\|-\n\|\s*\[\[File:([^\|]*)\|[^\n]*\n\|[^\|]*\|([^\]]*)\]\]'*\n[^\n]*\n\| \{\{code\|([^\}]*)\}\}\n[^\n]*\n[^\n]*\n[^\n]*\n/{id: "$3", name: "$2", image: "$1"},\n/g
//phase 1
var maps = [
{id: "ctf_2fort", name: "2Fort", image: "Ctf 2fort bridge ss.png"},
{id: "ctf_doublecross", name: "Double Cross", image: "CTF DoubleCross RedBase.png"},
{id: "ctf_sawmill", name: "Sawmill", image: "CTF Sawmill Center.png"},
@stuartpb
stuartpb / gethome.sh
Created June 18, 2014 23:10
Get the base for home directories used by useradd
unset HOME
[ -e /etc/default/useradd ] && source /etc/default/useradd
${HOME:=/home}

Keybase proof

I hereby claim:

  • I am stuartpb on github.
  • I am stuartpb (https://keybase.io/stuartpb) on keybase.
  • I have a public key whose fingerprint is C8C7 AD2C 91B1 545A 72F0 B3EF D957 B96C EE60 B088

To claim this, I am signing this object:

[root@sandbox ~]# xxd wtf/script.jade
0000000: ed41 0000 0010 0000 79e2 e053 79e2 e053 .A......y..Sy..S
0000010: 0d7e da53 0000 0000 0000 0300 0800 0000 .~.S............
0000020: 0000 0800 0700 0000 0af3 0100 0400 0000 ................
0000030: 0000 0000 0000 0000 0100 0000 bf22 1000 ............."..
0000040: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0000050: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0000060: 0000 0000 f2c0 7735 0000 0000 0000 0000 ......w5........
0000070: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0000080: 1c00 0000 bc90 bd9f 0000 0000 68f5 b3e1 ............h...
#include <stdio.h>
int main(void) {
int i, x, y, e, o;
for (i=0; i < 64; i++){
//d2xy(8,i,&x,&y);
e =((i & 0x20) >> 3)
|((i & 0x08) >> 2)
|((i & 0x02) >> 1);
o =((i & 0x10) >> 2)
@stuartpb
stuartpb / jsperfcase.md
Created September 17, 2014 23:41
Stash until jsperf figures out its spam detection

Preparation HTML

<svg>
<g id="main"></g>
<g id="cache" hidden></g>
</svg>
<script>
var docFragment = document.createDocumentFragment();
var mainElement = document.getElementById('main');
function ucs2Bytes(s) {
var l = s.length;
var a = new Array(l*2);
for (var i = 0; i < l; ++i) {
a[i] = s.charCodeAt(i) && 0xFF;
a[i+1] = s.charCodeAt(i) >> 8;
}
return a;
}
This is a demo text document loaded from a Gist by gistachio. If you can read it, that means it's working.
tttt tttt iiii
ttt:::t ttt:::t i::::i
t:::::t t:::::t iiii
t:::::t t:::::t
ttttttt:::::ttttttt eeeeeeeeeeee ssssssssss ttttttt:::::ttttttt iiiiiiinnnn nnnnnnnn ggggggggg ggggg
t:::::::::::::::::t ee::::::::::::ee ss::::::::::s t:::::::::::::::::t i:::::in:::nn::::::::nn g:::::::::ggg::::g
t:::::::::::::::::t e::::::eeeee:::::eess:::::::::::::s t:::::::::::::::::t i::::in::::::::::::::nn g:::::::::::::::::g
tttttt:::::::tttttt e::::::e e:::::es::::::ssss:::::stttttt:::::::tttttt i::::inn:::::::::::::::ng::::::ggggg::::::gg