Skip to content

Instantly share code, notes, and snippets.

Turtle hunting

Matijs matijs

Turtle hunting
View GitHub Profile
matijs /
Last active Jul 29, 2020
Solarized Dark profile for macOS

Solarized Dark profile for on macOS High Sierra

Based on the excellent Solarized (Dark) created by Ethan Schoonover. For source code, check the main Solarized repository on GitHub.


Open and save Solarized Dark.terminal.

Import from the “Profiles” tab in the settings of or just double-click the file after downloading.

matijs /
Last active Jun 27, 2020
Resizing a partition and filesystem on a headless Raspberry Pi running Arch Linux using a USB drive

Resizing a partition and filesystem on a headless Raspberry Pi running Arch Linux using a USB drive

disclaimer: this worked for me, your mileage may vary. Your Pi, your responsibility :)

After putting Arch Linux on a 16GB SD card using these instructions, I ended up with about 14GB of free space.

Arch Linux uses one primary partition (/dev/mmcblk0p1) and an extended partition (/dev/mmcblk0p2) containing one logical partition (/dev/mmcblk0p5). The primary partition is the boot partition and the logical partition is the root partition. Rather than adding another primary partition I just wanted to resize the root partition and filesystem.

According to this bugreport parted no longer handles resizing of partitions and gparted needs a graphical environment to run. So I had to come up with something else to resize my partitions.

matijs /
Last active Jun 13, 2019
Instructions and example configuration to install BitTorrent Sync on a Raspberry Pi running Arch Linux.

Installing BitTorrent Sync on a Raspberry Pi running Arch Linux

The commands below assume you're using a user that can use sudo, you're not logged in as root are you!?

First create a btsync user:

sudo useradd -M --shell /bin/false --home /var/lib/btsync
matijs / classList.js
Last active May 14, 2019
Element.prototype.classList polyfill
View classList.js
if ( 'document' in self ) {
// Full polyfill for browsers with no classList support
// Including IE < Edge missing SVGElement.classList
if ( !( 'classList' in document.createElement( '_' ) )
|| document.createElementNS && !( 'classList' in document.createElementNS( '', 'g' ) ) ) {
( function( view ) {
'use strict';
var DOMEx;
matijs / keybindings.json
Created Nov 20, 2017
Visual Studio Code Keybindings
View keybindings.json
// Place your key bindings in this file to overwrite the defaults
"key": "ctrl+shift+k",
"command": "editor.action.deleteLines",
"when": "editorTextFocus && !editorReadonly"
"key": "shift+cmd+k",
"command": "-editor.action.deleteLines",
matijs / settings.json
Created Nov 20, 2017
Visual Studio Code User Settings
View settings.json
// Place your settings in this file to overwrite the default settings
"editor.fontFamily": "Source Code Pro",
"editor.fontSize": 14,
"editor.renderWhitespace": "all",
"editor.renderIndentGuides": false,
"editor.selectionHighlight": false,
"files.insertFinalNewline": true,
"workbench.colorTheme": "Solarized Dark",
"workbench.iconTheme": "vs-minimal",
matijs / makefile
Last active Nov 6, 2017
Minimalist makefile using PostCSS
View makefile
# some variables
POSTCSS = ./node_modules/.bin/postcss
POSTCSS_FLAGS = --use autoprefixer autoprefixer.browsers "> 2%"
# wildcard expansion is performed only in targets and in prerequisites so here we need $(wildcard)
SOURCES = $(wildcard src/css/*.css)
# use $(SOURCES) to determine what we actually need using a bit of pattern substitution
TARGETS = $(patsubst src%, build%, $(SOURCES))
# our default target (see below)
all: $(TARGETS)
View keepmain.js
(function(doc, body) {
const main = doc.querySelector('main').parentNode.removeChild(doc.querySelector('main'));
while (body.firstChild) body.removeChild(body.firstChild);
}(document, document.body));
matijs / sitemap.xml
Created Jul 11, 2014
Jekyll sitemap
View sitemap.xml
layout: none
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="">
{% for post in site.posts %}{% unless post.unpublished == false %}<url>
<loc>{{ site.url }}{{ post.url }}</loc>
<lastmod>{% if post.sitemap.lastmod %}{{ post.sitemap.lastmod | date: "%Y-%m-%d" }}{% else %}{{ | date_to_xmlschema }}{% endif %}</lastmod>{% if post.sitemap.changefreq %}
<changefreq>{{ post.sitemap.changefreq }}</changefreq>{% endif %}{% if post.sitemap.priority %}
<priority>{{ post.sitemap.priority }}</priority>{% endif %}
View vanilla-click-handler.js
;(function(handlers) {
if (!handlers) {
throw new Error('Nothing to handle');
document.documentElement.addEventListener('click', function(event) {
var handler = event.originalTarget.getAttribute('data-handler');
if (!handler) {
// nothing to do
You can’t perform that action at this time.