This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env nix-shell | |
#! nix-shell -i bash -p ffmpeg_5 | |
trap 'echo "Aborting..."; exit 1' SIGINT | |
find . -type f -name "*.flac" -print0 | while read -d $'\0' flac_file; do | |
echo "Input file: $flac_file" | |
mp3_file="${flac_file%.flac}.mp3" | |
ffmpeg -nostats -loglevel 0 -nostdin -i "$flac_file" -vn -b:a 320k -acodec libmp3lame "$mp3_file" || { rm "$mp3_file"; exit; }; | |
rm "$flac_file" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const fs = require('fs'); | |
function getInput() { | |
if (process.stdin.isTTY) { | |
const inputFileName = process.argv[2]; | |
return fs.readFileSync(inputFileName, {encoding: 'utf8'}); | |
} else { | |
return fs.readFileSync(0, {encoding: 'utf8'}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @param obj Target object | |
* @param pathToFunc path string e.g. "foo.bar.baz" | |
* @param value value to place at this path | |
*/ | |
function addFunction(obj, pathToFunc, value) { | |
const properties = pathToFunc.split('.'); | |
function addProperty(obj, i=0) { |