Skip to content

Instantly share code, notes, and snippets.

View lincerely's full-sized avatar
🕹️

Lincerely lincerely

🕹️
View GitHub Profile

Issue

Install Microsoft Visual C++ 2008 Service Pack 1 with winetricks -q vcrun2008.

It exited with error:

/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppleFSCompression/AppleFSCompression-96.200.3/Common/ChunkCompression.cpp:49: Error: unsupported compressor 8
@lincerely
lincerely / img2icns.sh
Created November 20, 2022 22:10
convert any image to .icns with imagemagick on macOS
#!/usr/bin/env bash
# convert any image to .icns with imagemagick
# refs: https://www.imagemagick.org/Usage/resize/#fill
# https://www.imagemagick.org/Usage/thumbnails/#fit_summery
if [ $# -ne 1 ]; then
echo usage: img2icns.sh IMG
exit 1
fi
@lincerely
lincerely / pbwatch.sh
Created December 8, 2022 02:10
run command when mac clipboard change
#!/usr/bin/env bash
# pbwatch - run cmd when clipboard change
tmp=/tmp/clipboard
cmd=${@:1}
if [ -z "$cmd" ]; then
echo "USAGE: $0 CMD [ARGS...]"
exit 1
@lincerely
lincerely / lsURLscheme.sh
Created December 13, 2022 11:35
print all URL schemes in macos
#!/usr/bin/env bash
#lsURLscheme.sh - print all URL schemes in macos
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -dump |\
sed -n -e '/CFBundleName/p' -e '/CFBundleURLSchemes/,/);/p' |\
awk '
/CFBundleName/ {
sub(/;$/,"");
sub(" CFBundleName = ","");
app=$0;
next;
@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
@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 / 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 / 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 / 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 / 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")