Skip to content

Instantly share code, notes, and snippets.

View lincerely's full-sized avatar
🕹️

Lincerely lincerely

🕹️
View GitHub Profile
@lincerely
lincerely / sketchbook_unpack.sh
Created February 9, 2023 18:48
unpack Autodesk Sketchbook multi-layered TIFF to PNGs
#!/usr/bin/env bash
# sketchbook_unpack.sh
# unpack Autodesk Sketchbook multi-layered TIFF to PNGs
#
# requires: libtiff, imagemagick
# reference: https://www.awaresystems.be/imaging/tiff/tifftags/docs/alias.html
input="$1"
test -f "$input" || (echo "usage: $0 TIFF_FILE" && exit 1)
@lincerely
lincerely / task_export_tsv.sh
Created February 3, 2023 21:41
task warrior export tsv
task export | jq -r '.[] | [.id, .status, .uuid, .entry, .end, .priority, .project, .description, .urgency] | @tsv '
@lincerely
lincerely / filter.sh
Last active February 3, 2023 04:55
filter file by command output
# example: find free font
find . -print0 | xargs -P`nproc` -0 -I _ sh -c "fontanalz \"_\" 2>/dev/null | grep -q -E 'SIL|free|Free' && echo \"_\""
@lincerely
lincerely / column_break.html
Last active February 3, 2023 02:55
Force column break (tested in Safari and Firefox)
<style>
body {
columns: 2;
}
* {
break-before: avoid;
break-after: avoid;
break-inside: avoid;
}
cbreak {
@lincerely
lincerely / rawtext.jq
Created January 25, 2023 01:59
jq query for extracting raw text saved messages from Telegram desktop's exported JSON
#!/usr/bin/env jq -r -f
.chats.list[]
| select(.type == "saved_messages")
| .messages[]
| select(.type == "message" and .text != "")
| [.text_entities[].text] | join("") #combine text
| gsub("\n"; "\\n")
@lincerely
lincerely / note.md
Created January 22, 2023 23:55
quicklook generator icon preview not show up

problem

icon preview only showing a default blank document icon.

symptoms

  • full preview using hold space methods show preview image successfully
  • qlmanage -t FILE generate thumbnail successfully
  • In Finder, open Views > Show view options, increase Text size, then thumbnails shows up.
@lincerely
lincerely / firefox_horizontal_scroll.md
Created January 22, 2023 11:42
Firefox horizontal scroll

Shift + scroll wheel

Not sure this is a OS-wise behaviour or browser only.

@lincerely
lincerely / svg2icns
Last active January 17, 2023 15:52 — forked from zlbruce/svg2icns
covert svg to icns (with imagemagick)
#!/usr/bin/env bash
# ref: https://gist.github.com/zlbruce/883605a635df8d5964bab11ed75e46ad
if [ $# -ne 1 ]; then
echo "Usage: svg2icns filename.svg"
exit 1
fi
filename="$1"
name=${filename%.*}
dest="$name".iconset
mkdir "$dest"
@lincerely
lincerely / sourceforge_cvs_to_git.md
Last active January 12, 2023 09:10
source forge cvs to git

convert sourceforge cvs root to git repo

This method doesn't require cvs at all. Instead, a python script called cvs2svn is needed.

using project "rltiles" as example:

# download cvs repo
rsync -av rsync://rltiles.cvs.sourceforge.net/cvsroot/rltiles/\* rltiles-cvs
@lincerely
lincerely / setup_vroot.sh
Last active January 11, 2023 23:12
setup a virtual root environment with chroot, unshare and BusyBox
# 1. setup the environment
# apt install busybox-static
mkdir -p test.root/bin
cp /usr/bin/busybox test.root/bin # busybox must be a static binary
# 2. start the virtual env (without root)
unshare --map-root-user chroot test.root /bin/busybox ash
# with root: chroot test.root /bin/busybox ash
# 3. link busybox applets so no need to type busybox everytime