Skip to content

Instantly share code, notes, and snippets.

@apeckham
apeckham / gist:037b155c8abea13c7f56f54f5b3e86ea
Last active April 24, 2024 04:16
mount bucket on a remote instance and run filebrowser via port forward
gcloud compute instances stop "instance-xxx" --zone="zzz" --project="project-yyy"
gcloud beta compute instances set-scopes "instance-xxx" --scopes=storage-full --zone="zzz" --project="project-yyy"
gcloud compute instances start "instance-xxx" --zone="zzz" --project="project-yyy"
gcloud compute ssh --zone "zzz" "instance-xxx" --project "project-yyy" -- -L 8080:localhost:8080
# on the remote machine
gcloud init
export GCSFUSE_REPO=gcsfuse-`lsb_release -c -s`
@apeckham
apeckham / aria2.service
Last active April 23, 2024 07:37
aria2c and ariang w/ nginx proxy
#~/.config/systemd/user/aria2c.service
#PORT from "app-ports free"
#SECRET from pwgen
#systemctl --user daemon-reload
#systemctl --user enable --now aria2c
[Unit]
Description=aria2c
After=network-online.target
@apeckham
apeckham / go.sh
Created April 23, 2024 07:10
Merge MKV video files with a random OPUS audio file, creating new video files with varied background audio
#!/bin/bash
set -euo pipefail
# Define directories
video_dir="./video"
audio_dir="./audio"
# Create an array of all opus files
mapfile -t music_files < <(find "$audio_dir" -type f -name '*.opus')
@apeckham
apeckham / install.sh
Last active April 23, 2024 06:01
yt-dlp and yt-dlp-webui
#https://docs.ultra.cc/books/unofficial-language-installers-3AK/page/install-python-using-pyenv
bash <(wget -qO- https://scripts.usbx.me/util/LanguageInstaller/Python-Installer/main.sh)
source ~/.profile
which python
pip3 install yt-dlp
wget -O bin/yt-dlp-webui https://github.com/marcopeocchi/yt-dlp-web-ui/releases/download/v3.0.7/yt-dlp-webui_linux-amd64
chmod +x bin/yt-dlp-webui
bin/yt-dlp-webui --help
@apeckham
apeckham / gist:a97592b0d7a5337a985f512d41885871
Created April 21, 2024 07:33
open filtered mails with mutt
- Download Google Takeout/Gmail
- apt-get install mutt mb2md mboxgrep
- mb2md -s $PWD/all.mbox -d $PWD/maildir
- mboxgrep -m maildir -H -E "From:.+(a|b|c)@" -o out.mbox maildir
- mutt -f out.mbox
@apeckham
apeckham / .html
Last active March 7, 2024 05:03
upload fabric canvas to s3 as png from browser
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>jQuery File Upload Example</title>
</head>
<body>
<canvas id="c" style="border:1px solid black;"></canvas>
<div id="status"></div>
<script src="//cdnjs.cloudflare.com/ajax/libs/fabric.js/1.1.0/fabric.all.min.js"></script>
@apeckham
apeckham / gist:e98a303a9de73b4cf037
Created June 11, 2015 17:44
find broken symlinks on mac os x
#http://unix.stackexchange.com/questions/34248/how-can-i-find-broken-symlinks
find . -type l ! -exec test -e {} \; -print
alias runlike="docker run --rm -v /var/run/docker.sock:/var/run/docker.sock assaflavie/runlike"
for i in $(sudo docker ps | awk '{print $1}' | tail -n +2); do runlike $i; done
@apeckham
apeckham / gist:8293865
Created January 7, 2014 02:40
ruby 1.9 hash syntax in rubymine
http://robots.thoughtbot.com/convert-ruby-1-8-to-1-9-hash-syntax
search = :([^ ]*)(\s*)=>
replace = $1:
@apeckham
apeckham / htmlcs_runner2.js
Created January 7, 2024 22:24
pa11y htmlcs runner that ignores certain rules for certain elements, using `data-htmlcs-ignore` attribute
"use strict";
const runner = (module.exports = {});
/**
* The Pa11y versions supported by this runner.
* @public
* @type {Array}
*/
runner.supports = "^6.0.0 || ^6.0.0-alpha || ^6.0.0-beta";