Installing print server and drivers.
- Install CUPS:
sudo apt install cups
#!/usr/bin/env bash | |
set -eo pipefail | |
directory="$1" | |
cd "$directory" | |
files=() | |
# Get `wav` files, ignoring `other.wav` | |
for file in *.wav; do | |
if [[ $file != "other.wav" ]]; then |
const crypto = require("crypto"); | |
// HACK: Fix Node.js 17+ "digital envelope routines::initialization error" | |
// https://stackoverflow.com/q/69692842/1130172 | |
const origCreateHash = crypto.createHash; | |
crypto.createHash = (algorithm, options) => { | |
const newAlgorithm = algorithm === "md4" ? "md5" : algorithm; | |
return origCreateHash(newAlgorithm, options); | |
}; |
function fontElementMap(selector = "*", onlyVisible = true) { | |
const allElements = document.querySelectorAll(selector); | |
const fontElements = {}; | |
for (element of allElements) { | |
const style = window.getComputedStyle(element); | |
const fontFamily = style.getPropertyValue("font-family"); | |
if (!fontFamily) { | |
continue; |
#! /usr/bin/env bash | |
# Formatting helpers | |
bold() { | |
printf "\033[1m%s\033[0m\n" "$*" | |
} | |
dim() { | |
printf "\033[2m%s\033[0m\n" "$*" | |
} |
#!/usr/bin/env bash | |
declare -A IMPORTS | |
# Returns the path of the script of the caller | |
function relative_path() { | |
dirname "${BASH_SOURCE[1]}" | |
} | |
# Imports a module |
export enum KnownPaths { | |
GetHelp = "/app/get-help", | |
RunDetail = "/app/history/:runId" | |
} | |
/** Parses a string type into an object of route params */ | |
type ExtractRouteParams<T extends string> = string extends T | |
? Record<string, string> | |
: T extends `${infer _Start}:${infer Param}/${infer Rest}` | |
? { [K in Param | keyof ExtractRouteParams<Rest>]: string } |
async function importURL(url) { | |
const vm = require("vm"); | |
const res = await fetch(url).then((r) => r.text()); | |
return vm.runInThisContext(res, { filename: url }); | |
} | |
// Example usage: | |
// | |
// await importURL( | |
// "https://gist.githubusercontent.com/blakek/660a8881ae56641d8804971b848df17e/raw/0fb0ec0646d5c8dc353dd9dadc9f5d8ccb7821b2/queryStringParse.js" |
#!/usr/bin/env bash | |
set -eo pipefail | |
## | |
# Transpose a song from one key to another. | |
## | |
version='0.0.1' | |
# Formatting functions |
const PI = 3.14; | |
const CircleSize = { | |
Quarter: 0.25, | |
Half: 0.5, | |
Full: 1, | |
}; | |
type WithRadiusOrDiameter = { r?: number; d?: number }; | |
type WithPercent = { percent: typeof CircleSize[keyof typeof CircleSize] }; |