Skip to content

Instantly share code, notes, and snippets.

@JonLevin25
JonLevin25 / extract_clips_with_fade.ps1
Created September 3, 2023 15:27
Powershell / FFMPEG - multiple clips from multiple input videos. Configurable audio/video fade
####
## Config
# FFMPEG
$ffmpegPath = "ffmpeg.exe"
$ffplayPath = "ffplay.exe"
#$isPreview = $true # Uncomment to preview (ffplay) instead of transcoding.
# OUTPUT
@JonLevin25
JonLevin25 / node-workload-runner-example.js
Last active December 10, 2022 19:23
NodeJS Run multiple processes from simple functions
const cluster = require('cluster');
/**
* @param {Function[]} workloads - simple paramaterless functions
* @param {{ restartOnExit: bool? }} opts
*/
function runWorkloads(workloads, opts) {
const restartOnExit = opts?.restartOnExit ?? false;
const workloadLookup = Object.fromEntries(
@JonLevin25
JonLevin25 / .bashrc
Last active February 26, 2022 13:51
Add all private ssh keys on init
#!/bin/bash
# Find and add _private_ keys
# note- may need adjustments for password-protected keys
eval `ssh-agent -s`
for f in $HOME/.ssh/*; do
fType=`file -b $f`
# echo "$f type: $fType"
if echo $fType | grep -i "private key"; then
ssh-add $f
fi
@JonLevin25
JonLevin25 / espnow_utils.cpp
Last active January 2, 2022 16:53
ESP-NOW Utils (Arduino framework)
#include "espnow_utils.h"
#ifdef ESP32
#include <WiFi.h>
#else
#include <ESP8266WiFi.h>
#endif
String get_mac_as_arduino_str(const uint8_t *address);
@JonLevin25
JonLevin25 / install_cmds_by_date.sh
Last active November 9, 2021 11:00
Debian: Extract packages installed to script
#### Options
#output_file=~/debs_install.log
output_file=~/debs_install.sh
# filter logs for active install commands
# columns: $1=install date, $2=install time, $4=pkg id, $5="<none>" (?), $6=version
awk_cmd='/ install /{print "apt install " $4 " # originally installed " $1}'
#### Make the output a runnable script (in order
gunzip -c /var/log/dpkg.log.2 | awk "$awk_cmd" >1 $output_file
@JonLevin25
JonLevin25 / unity_transcode_wav_mp3.ps1
Created September 17, 2020 22:05
Unity - Transcode .wavs to .mp3s with ffmpeg
while ( $deleteInp -notmatch "[yYnN]" ) {
$deleteInp = Read-Host -Prompt "Delete files when done? [y/n]"
}
$delete = $deleteInp -match "[yY]"
$deleteInp = "" # reset this since its global
echo "------ Transcoding MP3s -------"
$oldFileEnding='.wav'