Skip to content

Linux recipes

Piotr Grabowski edited this page Nov 8, 2022 · 13 revisions

For more, see Mining recipes and OCR recipes.

Cleanly launch/close a VN + Textractor + Kamite in a single terminal window

A template of a bash script to launch multiple programs that does not leave behind background processes when terminated with Ctrl + C.

#!/usr/bin/env bash

trap "kill 0" EXIT

export WINEPREFIX=/path/to/wineprefix
export WINEARCH=win32
export LANG="ja_JP.UTF-8"

TZ="JAPAN" \
  wine start /exec "/path/to/vn/VN.lnk" &
kamite --profile=vn --controlWindow=false &
wine "/path/to/textractor/Textractor.exe" &

wait

Credit: https://spin.atomicobject.com/2017/08/24/start-stop-bash-background-process/.

Watch clipboard, send text to Kamite, automatically look up with DeepL (wlroots)

#!/usr/bin/env bash

CMD_ENDPOINT="localhost:4110/cmd"

wl-paste --watch bash -c \
  "xargs -r -0 -I{} curl -i -X POST -d '{\"chunk\":\"{}\"}' $CMD_ENDPOINT/chunk/show;
   sleep 0.1;
   curl -i -X POST -d '{\"targetSymbol\":\"DEP\"}' $CMD_ENDPOINT/misc/lookup";
Clone this wiki locally