Skip to content

Instantly share code, notes, and snippets.

View ObjectBoxPC's full-sized avatar

Philip Chung ObjectBoxPC

View GitHub Profile
@ObjectBoxPC
ObjectBoxPC / captdriver-crossbuild.Dockerfile
Last active August 6, 2026 20:17
Dockerfile for cross-building captdriver for AArch64 (for Raspberry Pi)
FROM debian:trixie-slim AS build
WORKDIR /src
RUN ["dpkg", "--add-architecture", "arm64"]
RUN apt-get update && apt-get install -y gcc-aarch64-linux-gnu make automake libcups2-dev:arm64 cups-ppdc
COPY . .
RUN ["aclocal"]
RUN ["autoconf"]
RUN ["automake", "--add-missing"]
RUN ["./configure", "--host=aarch64-linux-gnu"]
@ObjectBoxPC
ObjectBoxPC / veracrypt-update.py
Last active June 15, 2026 01:30
Automatically update VeraCrypt (for Debian) from Launchpad
#!/usr/bin/env python3
import json
import datetime
import re
import shutil
import subprocess
import tempfile
import urllib.request
@ObjectBoxPC
ObjectBoxPC / chase-investment-rebalance.py
Last active January 5, 2026 17:20
Rebalance a J.P. Morgan (Chase) investment portfolio from a CSV export of positions
#!/usr/bin/env python3
import csv
import decimal
import itertools
import sys
def parse_desired_weights(weights_file):
weights = { e["Category"]: decimal.Decimal(e["Desired Weight"]) for e in csv.DictReader(weights_file) }
if sum(weights.values()) != 1:
@ObjectBoxPC
ObjectBoxPC / makehybridpass.py
Created July 29, 2025 05:28
Create "hybrid" passwords with a combination of Diceware words and random symbols
#!/usr/bin/env python3
import secrets
import string
WORD_LIST = "/usr/share/keepassxc/wordlists/eff_large.wordlist"
words = [w.strip() for w in open(WORD_LIST)]
symbols = string.ascii_letters + string.digits + string.punctuation
@ObjectBoxPC
ObjectBoxPC / play-rockbox.sh
Created June 5, 2025 09:25
Convert and play a playlist originally created for Rockbox
#!/bin/sh
if [ $# -lt 1 ]; then
echo "Usage: $0 [playlist]" >&2
exit 1
fi
PLAYLIST_FILE=$1
if ! [ -f "$PLAYLIST_FILE" ]; then
@ObjectBoxPC
ObjectBoxPC / dvdbackup.Dockerfile
Created March 26, 2025 07:56
Rip DVDs from a Docker container
FROM debian:12-slim
RUN ["sed", "-i", "s/^Components: .*/Components: main contrib/", "/etc/apt/sources.list.d/debian.sources"]
RUN apt-get update && apt-get install -y libdvd-pkg dvdbackup
RUN ["dpkg-reconfigure", "libdvd-pkg"]
@ObjectBoxPC
ObjectBoxPC / joplin-update.py
Last active June 17, 2026 03:26
Automatically update Joplin from GitHub
#!/usr/bin/env python3
import hashlib
import json
import re
import shutil
import subprocess
import tempfile
import urllib.request
@ObjectBoxPC
ObjectBoxPC / ezdiscid.c
Last active February 18, 2025 23:52
Simple program to extract MusicBrainz disc IDs from CDs
#include <stdio.h>
#include <string.h>
#include <discid/discid.h>
static const char* get_device(int argc, char** argv);
int main(int argc, char** argv) {
DiscId* discid;
const char* device;
int read_successful;
@ObjectBoxPC
ObjectBoxPC / ungoogled-chromium-debian-update.py
Last active January 27, 2026 01:44
Automatically update ungoogled-chromium on Debian
#!/usr/bin/env python3
import json
import re
import shutil
import subprocess
import tempfile
import urllib.request
USER_AGENT = "Ungoogled-Chromium-Debian-Update/1.0"
@ObjectBoxPC
ObjectBoxPC / pwdshort.sh
Last active June 4, 2025 06:00
Print the working directory in a compact form (originally created for tmux status bar customization)
#!/bin/sh
# Print a compact version of the current working directory.
# The home directory is replaced with ~, and long paths are truncated to the final part with < as a marker.
# Examples:
# /home/example/Documents becomes ~/Documents
# /example/of/a/really/really/long/path becomes <ly/really/long/path
# The maximum length can be set using the LIMIT variable.
LIMIT=20