Skip to content

Instantly share code, notes, and snippets.

@nohajc
nohajc / build-bluez-sony-hogp-deb.sh
Created June 16, 2026 07:37
Build BlueZ deb package for Raspberry Pi, patched to handle a Sony TV remote clone that has botched GATT descriptors
#!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<'EOF'
Usage: build-bluez-sony-hogp-deb.sh [options]
Build a Debian/Raspberry Pi OS BlueZ package with a local HOGP/GATT
interoperability patch for devices that return malformed characteristic
discovery data, such as SONY TV VRC 001.
@nohajc
nohajc / ntfs-mac-utils-download.sh
Created July 20, 2025 11:56
Download chkntfs and other NTFS utils for macOS (by Paragon)
#!/bin/sh
set -e
DMG_NAME=ntfsmac17_trial.dmg
curl -LO "https://dl.paragon-software.com/demo/$DMG_NAME"
DMG_PATH=$(hdiutil attach -nobrowse -readonly "$DMG_NAME" | grep /Volumes | awk '{print $3}')
TMP_PATH=/tmp/paragon-ntfs-pkg
@nohajc
nohajc / .asoundrc
Created August 27, 2022 13:11
Enable alsamixer volume control in WSL2. Should work on Windows 11 with the latest WSLg (which includes Linux GUI + sound support)
ctl.!default {
type pulse
device "RDPSink"
}
package main
import (
"fmt"
"runtime"
"sync"
)
// Job represents the work unit
type Job struct {
@nohajc
nohajc / ce_map.cpp
Last active February 8, 2019 11:16
C++17 constexpr map backed by array of pairs sorted at compilation time
#include <array>
#include <cstdio>
#include <map>
#include <type_traits>
namespace ce {
template<class InputIt, class UnaryPredicate>
constexpr InputIt find_if_not(InputIt first, InputIt last, UnaryPredicate q)
{
for (; first != last; ++first) {
address <- function(x) .Internal(inspect(x))
qq <- function() {
q(save = "no")
}
test <- list()
test[[1]] <- function() {
a = 1