Skip to content

Instantly share code, notes, and snippets.

View tomnomnom's full-sized avatar
☺️
Taking it easy

Tom Hudson tomnomnom

☺️
Taking it easy
View GitHub Profile
@tomnomnom
tomnomnom / ircuserlist-python3.py
Created January 3, 2017 13:25
IRC User List Script - Updated for Python 3
#!/usr/bin/env python3
# IRC User List
# Written by Tom Hudson for the Raspberry Pi User Guide
# Updated 2017-01-03 for Python 3.*
# http://tomhudson.co.uk/
import sys, socket, time
RPL_NAMREPLY = '353'
RPL_ENDOFNAMES = '366'
@tomnomnom
tomnomnom / node-hello.js
Created March 5, 2014 09:06
Node.js Hello World Server
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '0.0.0.0');
console.log('Server running at http://0.0.0.0:1337/');
https://twitter.com/intigriti/status/1399317852788830211
[][`flat`][`constructor`]`alert(document.domain)```
`${e}` => [object HTMLProgressElement]
`${[]/[]}` => NaN
`${[][[]]}` => undefined
flat
constructor
@tomnomnom
tomnomnom / presentations.sh
Created June 7, 2019 09:01
presentations.sh
#!/bin/bash
dir=$1
if [ ! -d "$dir" ]; then
echo "no dir"
exit
fi
find "$dir" -type f -name "*.pdf" | sort | while read file; do
evince -s "$file"
@tomnomnom
tomnomnom / google-copy.js
Created June 19, 2019 21:27
Bookmarklet to copy URLs from a Google search results page
javascript:d=document;b=d.createElement`textarea`;c=d.getSelection();b.textContent=[...d.querySelectorAll`div.r>a:first-child`].map(n=>n.href).join`\n`;d.body.appendChild(b);c.removeAllRanges();b.select();d.execCommand`copy`;d.body.removeChild(b)
@tomnomnom
tomnomnom / json-parsing.go
Created October 27, 2013 10:49
Parsing arbitrary JSON with go
package main
import (
"log"
"fmt"
"encoding/json"
)
func main() {
b := []byte(`{"name": "tom", "favNum": 6, "interests": ["knives", "computers"], "usernames": {"github": "TomNomNom", "twitter": "@TomNomNom"}}`)
@tomnomnom
tomnomnom / gist:65322076999a30e463f24a502a59541f
Created July 8, 2019 13:45
These chars make gmail do funky stuff
plain
𝅸𝅹𝅺󠀁󠀠󠀡󠀢󠀣󠀤󠀥󠀦󠀧󠀨󠀩󠀪󠀫󠀬󠀭󠀮󠀯󠀰󠀱󠀲󠀳󠀴󠀵󠀶󠀷󠀸󠀹󠀺󠀻󠀼󠀽󠀾󠀿󠁀󠁁󠁂󠁃󠁄󠁅󠁆󠁇󠁈󠁉󠁊󠁋󠁌󠁍󠁎󠁏󠁐󠁑󠁒󠁓󠁔󠁕󠁖󠁗󠁘󠁙󠁚󠁛󠁜󠁝󠁞󠁟󠁠󠁡󠁢󠁣󠁤󠁥󠁦󠁧󠁨󠁩󠁪󠁫󠁬󠁭󠁮󠁯󠁰󠁱󠁲󠁳󠁴󠁵󠁶￾
@tomnomnom
tomnomnom / once-per-jenkins-slave.groovy
Created May 16, 2016 12:47
Run a command once on each Jenkins slave using the CloudBees Workflow / Jenkins Pipeline plugin
// The ArrayList of slaves is not serializable, so fetching them should be marked as @NonCPS so that
// no attempt is made to serialize and save the local state of the function. See here for details:
// https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md#serializing-local-variables
@NonCPS
def getSlaves() {
def slaves = []
hudson.model.Hudson.instance.slaves.each {
slaves << it.name
}
return slaves
@tomnomnom
tomnomnom / h1-barry-ctf-dump.php
Created August 13, 2017 08:36
Dump of the script I wrote solving Jobert's CTF (https://twitter.com/jobertabma/status/894066834927796224)
<?php
// OK, so here's the hex from the instructions...
$lines =<<<LINES
7b 0a 20 a0 22 65 76 e5
6e 74 22 ba 20 22 70 e1
73 73 77 ef 72 64 5f e3
68 61 6e e7 65 22 2c 8a
20 20 22 f5 73 65 72 ee
61 6d 65 a2 3a 20 22 e2
63 6f 6c ec 69 6e 22 ac
@tomnomnom
tomnomnom / simple-vm.go
Created October 29, 2014 11:10
Simple VM in Go
package main
import (
"fmt"
"log"
"strings"
)
// Ops
const (