Skip to content

Instantly share code, notes, and snippets.

View shabbyrobe's full-sized avatar
🐦
Movin' to sourcehut

Blake Williams shabbyrobe

🐦
Movin' to sourcehut
View GitHub Profile
@shabbyrobe
shabbyrobe / zone.go
Last active March 15, 2019 01:44
Quickie junk code used to get around golang issue #21881
package zonetools
import (
"archive/zip"
"bytes"
"encoding/base64"
"fmt"
"io/ioutil"
"regexp"
"strings"
@shabbyrobe
shabbyrobe / errcollector.go
Created April 11, 2017 08:57
errcollector.go
/*
ErrCollector allows you to defer raising or accumulating an error
until after a series of procedural calls.
ErrCollector it is intended to help cut down on boilerplate like this:
if err := w.Start(xmlwriter.Doc{}); err != nil {
return err
}
if err := w.Start(xmlwriter.Elem{Name: "elem"}); err != nil {
@shabbyrobe
shabbyrobe / mithril-docset.sh
Last active August 10, 2022 08:46
Disgusting docset builder for mithril.js
#!/bin/bash
# As soon as I don't have to spend two hours debugging dependency failures from the
# master checkout of mithril.js, I will work this into their build process and submit
# a PR.
set -o errexit -o nounset -o pipefail
if [[ ! -d "build" ]]; then
mkdir build
@shabbyrobe
shabbyrobe / Enum.php
Last active March 2, 2017 13:15
Freenum - PHP Enum class
<?php
/**
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
@shabbyrobe
shabbyrobe / _saner-i3-config.md
Last active July 15, 2016 00:32
Saner default i3.config

Saner Default i3.config

i3wm is the best thing since sliced windows, but the default config file contains some poor defaults.

This isn't my i3.config, but it contains all of the critical "must-have" alterations that I am always recommending to people who see my i3 setup and go "wow, I have tried tiling window managers before but I never realised they could actually be great!".

All modifications are annotated with #/

This version is based on the default config emitted by Ubuntu 15.04.

@shabbyrobe
shabbyrobe / decode.py
Created October 6, 2014 23:31
Hacky Ansible decode module for binary encoded vault data
#!/usr/bin/python
import os
import time
import tempfile
import hashlib
import base64
filters = {
'base64': base64.b64decode,
@shabbyrobe
shabbyrobe / docopt_test_convert.py
Last active December 15, 2015 23:49
Mostly converts the existing testcases.docopt file into format proposed by RFC.
import re
import json
import sys
def read_doc(h, line):
doc = line
if re.search(r"\"\"\"\s*$", doc):
return doc
for line in h: