Skip to content

Instantly share code, notes, and snippets.

@muness
muness / authorize egpu
Last active June 15, 2025 21:34
Install glances including GPU and web server plugins
#!/usr/bin/env bash
#
# tb3_auto_auth.sh
# Enumerate all Thunderbolt devices via boltctl, enroll them if needed,
# and authorize any that are currently connected.
set -e
# Make sure boltctl is installed
if ! command -v boltctl &>/dev/null; then
@muness
muness / README.md
Last active February 26, 2025 14:42
Fetch enhanced lyrics for FLAC, M4A and MP3 files

Lyric Fetcher for Music Libraries

This script pulls lyrics for FLAC, MP3, and M4A files in a given music folder. It is not Beets-specific but works well with a Beets-managed library. The script supports incremental processing by marking folders as processed using a .lyrical file.

Installation

  1. You'll need Python 3 and pip installed.
  2. Then install the required dependencies:
pip install tqdm tenacity langdetect mutagen syncedlyrics
@muness
muness / am-obsidian.user.js
Last active October 12, 2022 13:37
Add Obsidian Links next to Amazing Marvin tasks
// ==UserScript==
// @name Add Obsidian Links in Amazing Marvin
// @namespace https:/217castle.com
// @updateURL https://gist.githubusercontent.com/muness/3741bfa2afa5e58d38a420c50cefaa38/raw/am-obsidian.user.js
// @downloadURL https://gist.githubusercontent.com/muness/3741bfa2afa5e58d38a420c50cefaa38/raw/am-obsidian.user.js
// @version 0.1.3
// @author Muness Castle
// @description In Amazing Marvin, this script finds Wiki links and adds links to Obsidian
// @require https://cdn.jsdelivr.net/gh/CoeJoder/[email protected]/waitForKeyElements.js
// @match https://app.amazingmarvin.com/*
@muness
muness / BambooHR.gs
Last active February 17, 2021 16:17
BambooHR API client for Google Sheets
// global vars that are taken from userProperties
var BAMBOOHR_SUBDOMAIN = '<fill this out>';
// add a custom menu to enter API credentials, so they don't need to be saved on the script
function onOpen() {
// Add API credentials menu to sheet
SpreadsheetApp.getUi()
.createMenu("BambooHR API Credentials")
.addItem("Set Credentials", "setCred")
.addItem("Remove Credentials", "deleteCred")
CREATE LIBRARY sqlparse LANGUAGE plpythonu FROM 's3://zapier-data-packages/sqlparse.zip' CREDENTIALS 'aws_access_key_id=AKIA6P3ALSQUD7YBV6UK ;aws_secret_access_key=6FzdA0ldVGRuuBqovXpYPZsBLfZN9QAQ8eQbxaK5';
DROP FUNCTION sqlparse_test(ANYELEMENT);
CREATE OR REPLACE FUNCTION sqlparse_test(sql_string ANYELEMENT) RETURNS varchar
IMMUTABLE
language plpythonu
AS
$$
import sqlparse
return (sqlparse.parse(sql_string)[0]).value
@muness
muness / openaudible_split_for_garmin.sh
Created August 15, 2020 15:33
Splits OpenAudible decrypted mp3 files to a form suitable for Garmin watch audiobook playback
#!/bin/bash
# Based on: http://crunchbang.org/forums/viewtopic.php?id=38748#p414992
# m4bronto
# Metadata looks like this:
# Chapter #0:0: start 0.000000, end 1290.013333
# first _ _ start _ end
while [ $# -gt 0 ]; do
@muness
muness / redshift_date_dim.sql
Last active October 22, 2024 19:37
Redshift Date Dimension
-- Potentially quirky when it comes to week numbers.
BEGIN TRANSACTION;
DROP TABLE IF EXISTS numbers_small;
CREATE TABLE numbers_small (
number SMALLINT NOT NULL
) DISTSTYLE ALL SORTKEY (number
);
INSERT INTO numbers_small VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
@muness
muness / sqlite2pg.sh
Last active April 3, 2017 17:23 — forked from eclubb/sqlite2pg.sh
Script to import SQLite3 database into PostgreSQL
#!/bin/sh -ex
# This script will migrate schema and data from a SQLite3 database to PostgreSQL.
# Schema translation based on http://stackoverflow.com/a/4581921/1303625.
# Some column types are not handled (e.g blobs).
SQLITE_DB_PATH=$1
PG_DB_NAME=$2
PG_USER_NAME=$3
@muness
muness / find_app
Last active April 20, 2016 20:25
tiny script for use with mas (https://github.com/argon/mas) to find app IDs through the cli with more details than mas search
curl --silent https://itunes.apple.com/search?entity=macSoftware\&term=$1\&attribute=allTrackTerm | jq '.results | .[] | {id: .trackId, name: .trackName, description: .description}'
### Keybase proof
I hereby claim:
* I am muness on github.
* I am muness (https://keybase.io/muness) on keybase.
* I have a public key whose fingerprint is F608 BC76 3CA2 D09D 4EAA 938D F04C 61AE 128A AB1D
To claim this, I am signing this object: