Skip to content

Instantly share code, notes, and snippets.


Sean Harvey halkyon

  • Wellington, New Zealand
View GitHub Profile
halkyon /
Last active Jun 3, 2021
BeDrive docker installation
  1. Unzip the file provided by BeDrive somewhere
  2. Replace docker-compose.yml with the following:
version: "3"
    build: . 
      - mariadb
halkyon / digitalocean_saltcloud_vpc.patch
Last active Sep 7, 2020
Patch for salt-cloud digitalocean integration to support setting VPC for private networking
View digitalocean_saltcloud_vpc.patch
--- /usr/lib/python3/dist-packages/salt/cloud/clouds/ 2020-09-07 11:02:31.000000000 +1200
+++ /usr/lib/python3/dist-packages/salt/cloud/clouds/ 2020-09-07 11:04:47.000000000 +1200
@@ -357,6 +357,11 @@
if not isinstance(private_networking, bool):
raise SaltCloudConfigError("'private_networking' should be a boolean value.")
kwargs['private_networking'] = private_networking
+ vpc_uuid = config.get_cloud_config_value(
+ "vpc_uuid", vm_, __opts__, search_global=False, default=None,
+ )
+ if vpc_uuid is not None:
halkyon / flac-to-mp3.php
Created Aug 27, 2020
FLAC to MP3 converter command line tool in PHP
View flac-to-mp3.php
## Extract a zip containing FLAC files, or a directory of FLAC files,
## and encode them into MP3 using LAME.
## Requirements (make sure these are in your path):
## - php (5.3+, required to run this script)
## - flac (for decoding FLAC to WAV)
halkyon / ghost-blog-kubernetes.yaml
Last active Jul 15, 2020
Kubernetes YAML (namespace, service, ingress, deployment) for running a very simple setup of Ghost (
View ghost-blog-kubernetes.yaml
# Simple setup of Ghost in Kubernetes.
# Some points to consider:
# - Content is stored in a single persistent disk, and database is SQLite. Using a dedicated database would be ideal
# for bigger deployments, and using distributed storage would allow pods to horizontally scale, e.g. GlusterFS, EFS.
# - A load balancer is provisioned for external traffic to access the blog service. For a multi-tenanted approach,
# nginx ingress controller ( could be used.
# - No TLS for the service. This could be accomplished using GCP, or AWS managed certs on the load balancer.
halkyon / interface.go
Last active Mar 15, 2020
Simple example of an interface in Go using a "loader" interface with memory and disk as implementations
View interface.go
package main
import (
type loader interface {
Read() ([]byte, error)
halkyon / linked-list.go
Last active Mar 15, 2020
Simple example of a circular doubly linked list in Go
View linked-list.go
package main
import (
type list struct {
head *item
tail *item
halkyon /
Last active Mar 2, 2020
Create a simple container from scratch using cgroups and namespaces
set -eu
if [ $EUID -ne 0 ]; then
echo "This script must be run as root"
exit 1
ID="cgroup_$((100 + RANDOM % 1000))"
echo "Generated cgroup name: $ID"
halkyon /
Last active Mar 25, 2021
Build an OpenWRT target with some extra packages, either using the OpenWRT image builder, or compile from git
#!/usr/bin/env bash
set -euo pipefail
target_path=$(readlink -f "${5:-$(pwd)}")
packages="luci luci-base luci-mod-admin-full luci-proto-relay luci-app-statistics"
halkyon / pre-commit
Last active Jul 11, 2017
pre-commit script to run php-cs-fixer against changed PHP scripts
View pre-commit
if [ ! -f .php_cs ]; then
if [ ! -f .php_cs.dist ]; then
halkyon / cleanup-win10.ps1
Last active Sep 17, 2021
Cleanup Windows 10 Powershell script
View cleanup-win10.ps1
## Windows 10 cleanup script.
## Remove dodgy tracking settings, unneeded services, all apps, and optional features that come with Windows 10. Make it more like Windows 7.
## NOTE: this was tested on Creators Update (1703) and Fall Creators Update (1709). Some of this may not work as expected on newer versions.
## Instructions
## 1. Run this script (under Powershell as Administrator):
## powershell -ExectionPolicy Bypass .\cleanup-win10.ps1
## 2. Let it run through, you may see a few errors, this is normal
## 3. Reboot