Skip to content

Instantly share code, notes, and snippets.

View protrolium's full-sized avatar

Ꮹανiη Ꮐaмвoα protrolium

View GitHub Profile
protrolium /
Last active December 24, 2023 18:57
git cheatsheet

git rm --cached [filenames]

Here’s how I removed all the files I wanted to delete from one of my bin subdirectories:

git rm --cached bin/com/devdaily/sarah/\*

I use the unusual * syntax at the end of that command instead of * because you need to escape the * from the git command. In a simpler example, if there was just one file in the bin directory named Foo.class that I wanted to remove from the Git repository, I would use this command:

protrolium /
Created February 1, 2023 16:42 — forked from scottopell/
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?
protrolium /
Created January 14, 2023 00:51
some tasks with videogrep

list video subtitles

yt-dlp --list-subs [video url]

download video subtitles with yt-dlp after downloading video

yt-dlp --skip-download --write-sub --write-auto-sub --sub-lang "en.*" [video url]

rename .vtt or srt to match video name

check video for most frequent words with --ngrams [int]

`videogrep -i path/to/file --ngrams 1

protrolium /
Created August 13, 2022 00:10
jq commands and syntax

Remove sections of a string, filtering out all that contain "RT"

cat tweets.json | jq '.[].text | select(contains("RT") | not)'

protrolium /
Last active December 24, 2023 18:57
using ghostscript to compress PDF filesize

Compress PDF filesize

$ gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook \ -dNOPAUSE -dBATCH -dColorImageResolution=150 \ -sOutputFile=output.pdf someBigFile.pdf

Combine/Merge PDFs

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=merged.pdf source1.pdf source2.pdf source3.pdf

protrolium /
Created May 16, 2022 19:07
working command for turning dir of jpegs into pdf

$ img2pdf --first-frame-only *.jpg -o document.pdf

protrolium /
Last active December 7, 2021 00:54
ways of clearing local hd of unwanted storage build-up

tmutil listlocalsnapshotdates / |grep 20|while read f; do tmutil deletelocalsnapshots $f; done

Wait until it's done deleting the local snapshots. Restart your computer and it will create a new local snapshot.


tmutil listlocalsnapshots /

and with

protrolium /
Last active August 4, 2021 22:02
gcloud shell commands

GCP Cloudshell

$ gcloud projects list

troubleshoot ssh
$ gcloud alpha compute ssh "tikapi" --zone=us-west2-a --troubleshoot

$ gcloud compute config-ssh

initialize configuration

protrolium /
Last active March 11, 2023 18:07
various keyboard shortcuts for controlling Bitwig Studio DAW

Bitwig Studio Keyboard Shortcuts

1-5 - Tools
ctrl + enter - commander
0 - deactivate clip (Toggle Active)
b - insert from library
shift + f - follow playhead
/ - toggle adaptive beat grid


protrolium /
Last active March 9, 2023 23:22
reference sheet for python / virtual environments / jupyter notebooks

find all virtual environments

find ~ -type f -name "activate" -exec egrep -l nondestructive /dev/null {} \; 2>/dev/null

alternative (more broad):
find ~ -d -name "site-packages" 2&gt;/dev/null