Skip to content

Instantly share code, notes, and snippets.

View lincerely's full-sized avatar
🕹️

Lincerely lincerely

🕹️
View GitHub Profile
@lincerely
lincerely / .gitignore
Created March 16, 2024 21:44 — forked from TooTallNate/.gitignore
low-level objc runtime apis
*
!*.m
!Makefile
@lincerely
lincerely / unpack_prefab.c
Created December 9, 2023 05:26
unpack embedded .rmf objects from .ol WorldCraft prefab library to current directory
// unpack embedded .rmf objects from .ol WorldCraft prefab library to current directory.
// list of names and descriptions would be dump into info.txt.
// reference: https://github.com/LogicAndTrick/sledge-formats/blob/master/Sledge.Formats.Map/Formats/WorldcraftPrefabLibrary.cs
#include <stdio.h>
#include <string.h>
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#!/usr/local/bin/bbe -f
# NEC特殊罫線 -> SJIS 変換
# reference: https://hide.maruo.co.jp/lib/hmconv/neckeisen100.html
s/\x86\xA2/\x84\x9F/
s/\x86\xA3/\x84\xAA/
s/\x86\xA4/\x84\xA0/
s/\x86\xA5/\x84\xAB/
s/\x86\xA6/\x84\x9F/
s/\x86\xA7/\x84\xAA/
s/\x86\xA8/\x84\xA0/
@lincerely
lincerely / arm_c.txt
Last active September 13, 2023 01:55
Android compile c executable with NDK
$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi21-clang hello.c
adb push a.out /data/local/tmp/hello
adb shell
chmod 755 /data/local/tmp/hello
/data/local/tmp/hello
@lincerely
lincerely / pdfoutline.sh
Last active September 6, 2023 14:14
add outline to PDF using ghostscript and PDFMark
#!/usr/bin/env bash
# add outline to PDF using ghostscript and PDFMark
# reference: https://www.meadowmead.com/wp-content/uploads/2011/04/PDFMarkRecipes.pdf
if [ $# -lt 2 ]; then
echo "usage: $0 INPDF OUTPDF < OUTLINE"
echo '
Outline example:
1 Title
@lincerely
lincerely / Show in Album.applescript
Created March 17, 2023 19:27
This script opens the album where the selected photo is in.
# Show in Album
#
# This script opens the album where the selected photo is in.
# If the photo is in multiple albums, it displays a list to choose from.
#
# It assumes:
# - no album with duplicate names; and
# - no folder/album with the same name in the same folder; and
# - your UI is in English, if not then you need to change the menu item name in the last part of the script.
#
@lincerely
lincerely / xsshot.sh
Created February 13, 2023 16:41
take X11 screenshot and output PNG to STDOUT
#!/usr/bin/env bash
#xsshot.sh - take X11 screenshot and output PNG to STDOUT
xwd | xwdtopnm | pnmtopng
@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 \"_\""