Skip to content

Instantly share code, notes, and snippets.

🌈
hacking ⇒ ¬sleeping

Felix C. Stegerman obfusk

🌈
hacking ⇒ ¬sleeping
Block or report user

Report or block obfusk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@obfusk
obfusk / gtree.sh
Created Jan 20, 2020
gtree (tree w/ quick-and-dirty .gitignore support)
View gtree.sh
#!/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
Created Jan 10, 2020
<img> w/ data-src -> src
View data-src.js
Array.from(document.getElementsByTagName("img")).forEach(e => { const s = e.getAttribute("data-src"); if (s) { e.src = s } })
@obfusk
obfusk / scrape.sh
Created Jan 3, 2020
gh api + httpie + jq
View scrape.sh
map $'http https://api.github.com/users/obfusk/repos?page=$it | jq \'.[] | "\(.name) @ \(.homepage)"\'' {1..6} | less
@obfusk
obfusk / hub-issue.sh
Created Dec 16, 2019
hub issue format
View hub-issue.sh
hub issue -f '%sC%>(3)%i%Creset %t [%L]%n'
@obfusk
obfusk / tools
Created Dec 14, 2019
command-line tools you'll miss once you know they exist
View tools
ack
grc
htop
jq
tree
xclip
moreutils # vidir, pee, sponge, ...
bat
@obfusk
obfusk / profile
Created Nov 16, 2019
ghc profile memory (stack + heap)
View profile
compile: -prof -fprof-auto -rtsopts
run: +RTS -hc -L60 -xt
graph: hp2ps -c foo.hp
View encodeurl.hs
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
@obfusk
obfusk / diffdiff.sh
Created Oct 7, 2019
diff the + and - parts of a diff; useful when moving things around
View diffdiff.sh
grc diff -Naur <( git diff | grep ^- | cut -c2- ) <( git diff | grep ^+ | cut -c2- )
View koneko.txt
子猫子猫子猫子猫子猫子猫子猫子猫子猫子猫子猫子猫子猫子猫子猫子猫子猫子猫子猫子猫
猫子猫子猫子猫子猫子
@obfusk
obfusk / allow_warnings.hs
Created Oct 1, 2019
temporarily disable -Werror for a file
View allow_warnings.hs
{-# OPTIONS_GHC -Wwarn #-}
-- ...
You can’t perform that action at this time.