Skip to content

Instantly share code, notes, and snippets.

View squio's full-sized avatar

Johannes la Poutre squio

View GitHub Profile
@squio
squio / rem_to_pixels.ts
Created April 19, 2022 07:59
Convert size in rem to pixel size based on computedStyle
export function convertRemToPixels(rem: number) {
if (document?.documentElement) {
return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
} else {
console.warn('No "document" context, unable to calculate effective pixel size');
return rem;
}
}
@squio
squio / tweetdelete.js
Last active May 9, 2023 16:05
Delete all your tweets and retweets from your browser's debug console
// Delete all your tweets and retweets (based on https://stackoverflow.com/a/74878105/885397)
// 1. Open Inspector in your browser
// 2. Switch to the Console tab
// 3. Copy and paste the code below after the >> prompt
// 4. leave your browser tab open, sit back and enjoy seeing all your tweets going one by one ;-)
(async () => {
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
@squio
squio / audio2mp3.sh
Created April 16, 2023 10:15
convert any file containing an audio stream to MP3
#!/bin/sh
# convert any file containing an audio stream to MP3
while [ -s "$1" ]
do
FILE="$1"
BASE=${FILE%.*}
ffmpeg -i "$FILE" -ab 128k -ac 2 -codec:a libmp3lame "${BASE}.mp3"
shift
@squio
squio / watchman-reset.sh
Created March 5, 2024 15:18
Reset watchman
#!/bin/sh
# for issue https://stackoverflow.com/a/71779949/885397
watchman watch-del-all
watchman shutdown-server
@squio
squio / howto-git-cherry-pick-for-release.md
Last active October 23, 2024 07:24
HOWTO git: cherry-pick from merged commits

If you need to cherry pick merge commits

First switch to the branch you merged into (likely develop), then

git log --since=2024-10-01 --reverse --merges \
  --author="$(git config --get user.name)" >merges.txt

Now switch to the target branch you want to merge into (maybe release-20240501 or so)