Skip to content

Instantly share code, notes, and snippets.

View benkant's full-sized avatar

Ben Giles benkant

View GitHub Profile
@benkant
benkant / audio-processor.js
Created April 16, 2025 16:22
AudioWorklet processor
// audio-processor.js
// This AudioWorkletProcessor receives audio input and sends the raw Float32 data to the main thread.
class AudioProcessor extends AudioWorkletProcessor {
process(inputs, outputs, parameters) {
// 'inputs' is an array of arrays; assume the first input and first channel (mono input).
if (inputs.length > 0 && inputs[0].length > 0) {
const channelData = inputs[0][0]; // This is a Float32Array of audio samples.
// Create a copy of the data.
const audioChunk = new Float32Array(channelData);
// Post the audio chunk to the main thread.
@benkant
benkant / insights_and_wisdom.md
Created February 13, 2025 06:08
Mike Lolan's Lost Weekend

Mike Nolan's Long Weekend

IDEAS

  • A good mate, Les, who once took part in wild “skits missions,” is remembered for passing away while doing what he loved, setting a bittersweet tone throughout the series.
  • The group’s street footy game is run by fluid, on-the-spot rules—whether it’s debating if a kicked ball must be returned regardless of the distance or arguing over the possibility of a re-kick when something gets in the way.
  • There's a constant interplay between gravity and levity: heavy themes like loss and past adventures mix with the triviality of waiting for online deliveries or a casual kickabout.
  • Nolan’s anticipation for the “coolest drill” he ordered online (with delivery expected in two to three business days) is a recurring, mundane yet meaningful subplot.
  • The characters play a game while self-documenting their escapades, with Nolan filming their interactions in a tongue-in-cheek, documentary style.
  • The dialogue—laced with casual, explicit Aussie slang—reinforces a uniquely local and
@benkant
benkant / browser.md
Last active March 19, 2024 02:31
Debugging Chromium on Linux

Use the following to get runtime logs:

browser() {
    chromium-browser --ozone-platform=wayland --enable-features=UseOzonePlatform,VaapiVideoDecoder --allow-sandbox-debugging --enable-logging=stderr --v=1 "$@"
}

After enabling coredumps (see instructions here), test chromium dumps cores to /var/coredumps:

@benkant
benkant / download_mp4s.sh
Created January 31, 2024 05:42
Download MP4s follow redirects
#!/bin/bash
#
# Downloads MP4 files from a specified webpage URL provided as a command-line argument,
# following redirects. It requires 'curl' for operation. If 'curl' is not found, it
# advises the user to install it.
#
# Usage:
# ./download_mp4s.sh <URL>
check_for_curl() {
@benkant
benkant / ChromeOS_third_party_support.md
Created January 20, 2024 04:11
ChromeOS business software support

Supported:

  • Google Meet
  • Zoom (Basic features via ChromeOS app)
  • Microsoft Teams (Web-based version)
  • Microsoft Office (Office Online)
  • Adobe Creative Cloud (Web-based versions)
  • Tableau (Web access to Tableau Server/Online)

Limited Support:

  • Zoom (Full desktop client not available)
@benkant
benkant / nvim_cef.sh
Created January 18, 2024 02:49
Basic nvim config for CEF/Chromium work
#!/bin/bash
# WARNING: installs nvim and ALE
# Install nvim plugins suitable for working with Chromium/CEF codebase:
# - shfmt
# - clang-format
# - eslint
# - yapf (PEP 8)
set -euo pipefail
@benkant
benkant / setup_vm_mnt.sh
Created January 18, 2024 02:06
Setup VMWare shared folders in guest
#!/bin/bash
# After sharing /tmp on the host to the guest in VMWare Fusion
# - add a mount point
# - allow my user acess
# - add it to /etc/fstab for persistence
set -euo pipefail
readonly MOUNT_POINT="/mnt/tmp"
readonly SHARED_FOLDER=".host:/tmp"
@benkant
benkant / detective_conan.py
Created June 28, 2023 12:18
Example conanfile.py with CMake, Google Sandbox API, Luau, raylib.
from conans import ConanFile, CMake
class MyProject(ConanFile):
name = "my_project"
version = "0.1"
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
requires = [
"sandboxed-api/1.0.0",
@benkant
benkant / simplevm.c
Created June 19, 2023 08:45 — forked from imbushuo/simplevm.c
Demonstrates Hypervisor.Framework usage in Apple Silicon
// simplevm.c: demonstrates Hypervisor.Framework usage in Apple Silicon
// Based on the work by @zhuowei
// @imbushuo - Nov 2020
// To build:
// Prepare the entitlement with BOTH com.apple.security.hypervisor and com.apple.vm.networking WHEN SIP IS OFF
// Prepare the entitlement com.apple.security.hypervisor and NO com.apple.vm.networking WHEN SIP IS ON
// ^ Per @never_released, tested on 11.0.1, idk why
// clang -o simplevm -O2 -framework Hypervisor -mmacosx-version-min=11.0 simplevm.c
// codesign --entitlements simplevm.entitlements --force -s - simplevm
@benkant
benkant / rndmac.sh
Created July 12, 2022 01:57
Set en0 to a random MAC address on macOS
#!/usr/bin/env bash
# Set en0 to a random MAC address on macOS
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z
openssl rand -hex 6 | sed 's!\.!!g;s!\(..\)!\1:!g;s!:$!!' | xargs -t -0 sudo ifconfig en0 lladdr
sudo ifconfig en0 up