Skip to content

Instantly share code, notes, and snippets.

View lincerely's full-sized avatar
🕹️

Lincerely lincerely

🕹️
View GitHub Profile
@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 / 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 / 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

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 / Audio_Unit_not_show_up.md
Created November 19, 2022 12:24
Fix Audio Unit need restart to show up

Issue

Audio Unit plugins (*.component) need restart / re-login to show up

Fix

killall -9 AudioComponentRegistrar

Reference

@lincerely
lincerely / wine_fix_crack_sound.md
Last active November 18, 2022 16:58
Fix crack sound in macos wine

Issue

Audio cracking while playing krkr visual novel through wine. All audio in-game is in ogg format.

Environment

  • macos
  • wine 5.0
@lincerely
lincerely / regex_JP_ZH_character.txt
Created August 12, 2022 23:51
regex to match all Unicode Japanese and Character characters. Reference: http://www.rikai.com/library/kanjitables/kanji_codes.unicode.shtml
[ -〿]|[ -ゟ]|[゠-ヿ]|[ - ]|[一- ]
@lincerely
lincerely / defold-note.md
Last active April 26, 2022 11:38
Defold note

Problem: Firefox mobile out of memory
Solution: lower HTML build heap size to 32 MB

Problem: HTML build sound cracking
Solution: Ask user to enable hardware acceleration

@lincerely
lincerely / clear_color.sh
Last active April 25, 2022 17:19
[imagemagick] get clear color from top left corner and set it to transparent
#!/bin/sh
#
if [ $# -ne 2 ]; then
echo usage: clear_color.sh IN_FILE OUT_FILE
exit 1
fi
convert "$1" -transparent "#"`magick "$1" -format "%[hex:p{0,0}]" info:` "$2"
@lincerely
lincerely / ytReminder.sh
Last active July 2, 2023 12:06
register Youtube scheduled live reminder in macOS calendar (a calendar named "Youtube" need to be created before running this script)
#!/bin/bash
tmp=/tmp/yt.html
url="$1"
if [ -z "$url" ]; then
echo "USAGE: $0 URL"
exit 1
fi