Skip to content

Instantly share code, notes, and snippets.


Adam Jensen acj

View GitHub Profile
acj /
Last active Jun 2, 2022
Installing microk8s in an LXC container

Installing microk8s in an LXC container

I wanted to run Microk8s on a Proxmox 6 host inside of an LXC container. These are my notes from the journey.

  1. Create a privileged LXC container through the Proxmox web interface
  • Enable nesting and FUSE
    • In Proxmox UI, select container, then Options > Features > Check nesting and FUSE boxes
  1. SSH into the Proxmox host and edit the container's config in /etc/pve/lxc/.conf
    • Add the following lines
  • lxc.apparmor.profile: unconfined
acj /
Last active Apr 6, 2022
Build a movie from jpeg images in Swift using AVFoundation

This code has moved

Please refer to the TimeLapseBuilder-Swift repository on GitHub from now on.

I will leave the original code here as a reference, but new comments may be removed. Please open an issue on GitHub if you have questions or would like to contribute.


acj / TrimVideo.swift
Last active Mar 8, 2022
Trim video using AVFoundation in Swift
View TrimVideo.swift
// TrimVideo.swift
// VideoLab
// Created by Adam Jensen on 3/28/15.
// Updated for Swift 5 (tested with Xcode 10.3) on 7/30/19.
// MIT license
import AVFoundation
acj /
Created Jul 27, 2021
Script that watches for available Global Entry interview slots
# Global Entry appointments can be difficult to schedule at some locations. This script will check
# for available times every few minutes and notify you when one is available.
# -----------------------------------------------------------------------
# This is free and unencumbered software released into the public domain.
# Anyone is free to copy, modify, publish, use, compile, sell, or
View Cargo.toml
name = "ga"
version = "0.1.0"
authors = ["Adam Jensen <>"]
edition = "2020"
rand = "0.7"
acj /
Created Apr 5, 2020
Installing actions-runner-controller on microk8s running in LXC

Installing actions-runner-controller on microk8s running in LXC

This is a niche problem, but these steps worked for me. Proxmox 6.1-5 with microk8s v1.18.0 running in an LXC container. Tested with actions-runner-controller 0.4.1.

  • Need to add --allow-privileged=true to /var/snap/microk8s/current/args/kube-apiserver
    • Then restart the API server: sudo systemctl restart snap.microk8s.daemon-apiserver.service
    • If this is a cluster of nodes, then this change needs to be applied on node hosting the control plane
  • Enable "Create device nodes" feature for the container (Options > Features)
  • Add to LXC container config: lxc.cgroup.devices.allow: a
acj / elixir_md5_chunks.exs
Created Dec 2, 2016
Compute MD5 digest in Elixir using streams and chunks
View elixir_md5_chunks.exs
def md5_digest_for_file_at_path(file_path) do!(file_path, [:read, :binary], 1024 * 1024)
|> Stream.chunk(1)
|> Enum.reduce(
fn(chunk, acc) ->
:crypto.hash_update(acc, hd(chunk))
|> :crypto.hash_final
|> Base.encode16
acj /
Last active Jul 7, 2018
Building a custom ISO to fix the 2011 MacBook Pro Radeongate GPU problem

How to build a bootable Arch-based thumb drive that can temporarily disable the Radeon GPU in a 2011 MacBook Pro.

I recently spent a few hours rescuing a faithful 2011-era MacBook Pro that had begun to suffer from the "Radeongate" graphics distortion problem. While it's possible to disable the Radeon GPU, the steps involve a lot of manual labor. Their automated solution produced an ISO that wouldn't boot for me, so I ended up building a custom ISO that only requires me to run one command after installing each macOS update. A non-technical family member can perform the fix, which is a big plus.

You'll need to buy RealMacMods' automated utility so that you can grab their script that does the heavy lifting. It's $10 at the time of this writing and is a nice way to support the

acj / gist:3843841
Created Oct 6, 2012
Drawing a circumscribed triangle inside a known circle
View gist:3843841
// This implementation assumes that the origin is at the upper-left corner of the
// drawing surface.
// Sample usage:
// Paint paint = new Paint();
// paint.setStyle(Paint.Style.STROKE);
// float centerX = 200;
// float centerY = 200;
// float radius = 100;
acj / mergesort.clj
Created Oct 3, 2011
Merge sort in Clojure
View mergesort.clj
; Example usage: (mergesort [5 1 8 16 25 11 4])
(ns mergesort
(:use clojure.contrib.math))
(defn merge-two
"Merge two (already sorted) vectors"
[vec1 vec2]
(let [v1f (first vec1) v2f (first vec2)]
(empty? vec1) vec2