Skip to content

Instantly share code, notes, and snippets.

timw4mail /
Created Feb 28, 2020
Gentoo Grub2 on OpenFirmware (PowerPC) New Kernel Update Script
set -euo pipefail
# Adapted from:
# Re-generate grub.cfg
grub-mkconfig -o /boot/grub/grub.cfg
# Make new OF grub img
grub-mkimage --prefix=/boot/grub --format=powerpc-ieee1275 --config=/boot/NWBB/grub-initial.cfg --output=/boot/NWBB/grub.img `cat /boot/NWBB/grub_mod-minimal.list`
timw4mail / json-parser.js
Last active Aug 24, 2020
Pure JS JSON Parser
View json-parser.js
* Pure JS JSON Parser
* @see
* @param {string} str
function parseJSON(str) {
let i = 0;
const value = parseValue();
timw4mail /
Last active Jan 24, 2020
Image Optimization script
#!/usr/bin/env bash
set -euo pipefail
declare threads=`getconf _NPROCESSORS_ONLN`
optimise () {
declare -a exts=("${!1}")
declare msg=$2
for ext in ${exts[@]}
View emoji-functions.php
<?php declare(strict_types=1);
function createDataObject (int $min, int $max, array $blacklist = []): array
$output = [];
$index = 0;
for ($i = $min; $i <= $max; $i++)
$n = base_convert((string)$i, 10, 16);
timw4mail /
Created Sep 9, 2019
PHP Extension source build boilerplate
make clean; # For those rebuilds
autoreconf --install --force; # Stupid autotools/libtool version incompatibilities
sudo make install;
View XML.php
<?php declare(strict_types=1);
* XML <=> PHP Array codec
final class XML {
* XML representation of the data

Keybase proof

I hereby claim:

  • I am timw4mail on github.
  • I am timw4mail ( on keybase.
  • I have a public key ASC7SlmqpsRmOuaFxqzF6TVO8jxYqGE-wpkawVHCwgehHgo

To claim this, I am signing this object:

timw4mail /
Last active Aug 23, 2018
Script to update docker mastodon
docker pull tootsuite/mastodon:latest;
docker-compose down;
docker-compose run --rm web bundle exec rake db:migrate;
docker-compose run --rm web bundle exec rake assets:precompile;
docker-compose up -d;
View emoji.php
$animals = [
'dog' => '🐶',
'cat' => '🐱',
'mouse' => '🐭'
let wildAnimals = {
timw4mail / Javascript ES6|
Created Oct 26, 2016
Overview of useful new Javscript features
View Javascript ES6|

JavaScript ES6/ES2015

Block scope

  • let - assigns a new variable that can be overwritten with any type

  • const - assigns a new variable that can not be overwritten; however, non-scalar values can be modified (immutable variables, not really traditional constants)

Functions can also be block-scoped

You can’t perform that action at this time.