Skip to content

Instantly share code, notes, and snippets.

View ctrl-freak's full-sized avatar

Bryce Sheehan ctrl-freak

View GitHub Profile
@ctrl-freak
ctrl-freak / wearmedia_sdk25.md
Last active September 14, 2026 05:11
Local Media/Music on old Android Wear Smart Watch LG G Watch R LG-W110 SDK Level 25

For some reason on my LG G Watch R the Google Play Services is so far out of date it can't update itself. Therefore I can't install apps aside from sideloading. I'm also restricted to Android SDK 25 and below, due to the age of the OS.

All I want from the smart watch is local music played to my bluetooth earphones for running. Once AsteroidOS has a local music player, that may be an alternative.

This should work on other older Wear devices too.

Requirements:

  1. Old smart watch
  2. Modern Android device to extract and push the old WearMedia Wear APK
  3. Some other PC to push music files via adb
@ctrl-freak
ctrl-freak / parse-airihs.groovy
Created May 19, 2026 02:47
Parse Australian Immunisation Register Immunisation History Statement from PDF to CSV
/*
"C:\Program Files\gs\gs10.03.1\bin\gswin64c.exe" -dBATCH -dNOPAUSE -sDEVICE=txtwrite -r300 -dUseCropBox -sOutputFile="{3}\{2}.txt" "{1}\{2}"
{1} Process Property 'PDFs Location' from 'Vaccinations'
{2} Document Property - Disk - File Name
{3} Process Property 'Text Location' from 'Vaccinations'
*/
@ctrl-freak
ctrl-freak / mirror-logins.sql
Created April 8, 2024 07:40
Generate SQL to create MSSQL logins with same SID and password
-- SQL Server Logins
select
'create login [' + sp.[name] + '] with password=0x' + CONVERT(nvarchar(max), l.password_hash, 2) + ' hashed, sid=0x' + convert(nvarchar(2000), sp.[sid], 2) + ', default_language = [us_english];'
from
master.sys.server_principals sp
inner join master.sys.sql_logins l on sp.[sid] = l.[sid]
where
sp.type_desc = 'SQL_LOGIN'
and sp.is_disabled = 0
and sp.default_language_name = 'us_english' -- helps target the specifically created logins
@ctrl-freak
ctrl-freak / gatekeeper-webhook-nodejs.js
Last active April 8, 2024 07:41
Gatekeeper Webhook Challenge Response in NodeJS (on PipeDream)
// https://www.gatekeeperhq.com/
// The Vendor & Contract Lifecycle Management (VCLM) Platform
// Webhook 'documentation' on Settings page is for Ruby, incomplete and does not include that the crc_response is to be base64 encoded.
// Video on Knowledgebase contains Python script which shows this is the case:
// https://knowledge.gatekeeperhq.com/en/docs/webhooks
import * as crypto from "crypto";
export default defineComponent({
async run({ steps, $ }) {
@ctrl-freak
ctrl-freak / purestorage-hdparm-secure-erase.sh
Created October 1, 2023 11:55
Clear ATA Security Lock (Encryption) on ex-Pure Storage array drives
# Done successfully on a Toshiba THNSNJ512GCSY
# WARNING: ALL DATA ON THE DRIVE WILL BE LOST; DON'T DO THIS UNLESS YOU KNOW ITS WHAT YOU NEED
# This is a series of shell commands, not a functional script
# Once unlocked, the drive should be able to be initialized/MBR written and partitions created.
sudo -s
# Identify drives
lsblk
@ctrl-freak
ctrl-freak / Kill-HungGS.ps1
Created May 18, 2023 03:35
Check whether process hung and kill or return non-zero
param (
[String] $Process = 'gswin64c',
[Int] $MaxRunTime = -5
)
try{
Get-Process $Process -ErrorAction Stop | Where StartTime -lt (Get-Date).AddSeconds($MaxRunTime) | Stop-Process -Force
} catch {
# No process to kill, good to go
# Exit as non-zero so Boomi takes Try-Catch route and continues processing
@ctrl-freak
ctrl-freak / terraform_cloud_0.13upgrade.md
Created May 11, 2022 05:10
Terraform Cloud Replace Provider in Remote State for 0.13 Upgrade

Background

When upgrading to Terraform 0.13 where runs driven by VCS and state is stored remotely (in this case Terraform Cloud)

I had an issue where a public Github module I was using included versions.tf which fails on older terraform versions.

I'd never used terraform locally, only connected the repository to Terraform Cloud.

The terraform 0.13upgrade is only in the 0.13 binaries, I had to download the old binary for my OS and run that specifically.

@ctrl-freak
ctrl-freak / marleyspoon_mealie.workflow.js
Created April 25, 2022 12:44
Reformat Marley Spoon API Recipe for insert to Mealie via n8n
var recipe = {};
recipe.name = item.name_with_subtitle;
recipe.recipe_yield = '4 Servings';
var ingredients = [];
item.ingredients.forEach((ingredient) => {
ingredients.push(ingredient.name_with_quantity);
});
item.assumed_ingredients.forEach((ingredient) => {
ingredients.push(ingredient.name);
@ctrl-freak
ctrl-freak / raspbian_openalpr.sh
Last active January 6, 2022 04:04
OpenALPR on Raspbian buster
## Prep SD card
# wpa_supplicant.conf
touch /boot/ssh
echo "enable_uart=1" >> /boot/config.txt
## Boot, ssh
uname -a
# Linux gatelpr 5.10.63+ #1496 Wed Dec 1 15:57:05 GMT 2021 armv6l GNU/Linux
@ctrl-freak
ctrl-freak / apk_zipalign_resign.md
Created July 24, 2020 02:01
Modifying Android APK and Resign on Windows