Skip to content

Instantly share code, notes, and snippets.

View obfusk's full-sized avatar
🏳️‍🌈
hacking ⇒ ¬sleeping 😸

FC (Fay) Stegerman obfusk

🏳️‍🌈
hacking ⇒ ¬sleeping 😸
View GitHub Profile
@obfusk
obfusk / view-html.sh
Created April 21, 2020 20:50
(pipe to this command to) view html on command line
w3m -T text/html -dump | less
@obfusk
obfusk / nginx.conf
Last active April 21, 2020 20:47
watch a video together with friends using rtmp live streaming w/ nginx, stunnel, ffmpeg & mpv (replace $STREAMNAME, $FQDN, $IP)
rtmp {
server {
listen 1935;
chunk_size 4000;
application $STREAMNAME {
live on;
}
}
}
@obfusk
obfusk / reload.js
Last active February 15, 2025 22:03
reload all broken images
// firefox only
(async () => { for (const x of document.querySelectorAll("img:-moz-broken")) { x.src = x.src; await new Promise(r => setTimeout(r, 100)); console.log(x) }; console.log("done") })()
// generic
(async () => { for (const x of document.querySelectorAll("img")) { if (!x.naturalWidth) { x.src = x.src; await new Promise(r => setTimeout(r, 100)); console.log(x) } }; console.log("done") })()
@obfusk
obfusk / gtree.sh
Created January 20, 2020 22:23
gtree (tree w/ quick-and-dirty .gitignore support)
#!/bin/bash
set -e
args=() gitdir=. excl='.git|*~'
oldpwd="$PWD"
while [ "$PWD" != / -a "$PWD" != // ]; do
if [ -e .git ]; then
gitdir="$PWD"; break
fi
cd ..
@obfusk
obfusk / data-src.js
Last active April 4, 2021 18:21
<img> w/ data-src -> src
[...document.getElementsByTagName("img")].forEach(x => { if (x.dataset.src) x.src = x.dataset.src })
@obfusk
obfusk / scrape.sh
Created January 3, 2020 21:31
gh api + httpie + jq
map $'http https://api.github.com/users/obfusk/repos?page=$it | jq \'.[] | "\(.name) @ \(.homepage)"\'' {1..6} | less
@obfusk
obfusk / hub-issue.sh
Last active January 20, 2021 14:34
hub issue format
unbuffer hub issue -f '%sC%>(4)%i%Creset %t [%L]%n' | sed 's/enhancement/enh/; s/good first issue/1st/; s/help wanted/help/'
@obfusk
obfusk / tools
Created December 14, 2019 22:37
command-line tools you'll miss once you know they exist
ack
grc
htop
jq
tree
xclip
moreutils # vidir, pee, sponge, ...
bat
@obfusk
obfusk / profile
Created November 16, 2019 07:10
ghc profile memory (stack + heap)
compile: -prof -fprof-auto -rtsopts
run: +RTS -hc -L60 -xt
graph: hp2ps -c foo.hp
import System.Environment
import qualified Data.ByteString as BS
import qualified Data.ByteString.UTF8 as UTF8
escapeURL :: String -> String
escapeURL = UTF8.toString . BS.concatMap (BS.pack . f) . UTF8.fromString
where
f c | alnum c || c `elem` [45,95,46,126] {- "-_.~" -} = [c]
| otherwise = h c