feat: initial commit

This commit is contained in:
2023-10-11 21:51:24 +02:00
commit 8709837ef1
128 changed files with 2464 additions and 0 deletions

3
bin/gcc-path Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
echo | gcc -E -Wp,-v -

6
bin/hhkb-i3 Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
set -xe
setxkbmap -layout us,ru -option grp:shifts_toggle,ctrl:nocaps,compose:ralt
xmodmap -e 'keycode 102 = Super_L'

3
bin/map-wacom Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
xsetwacom set "Wacom Intuos S Pen stylus" maptooutput 1920x1080+0+0

31
bin/png_to_ora Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/sh
if [[ $# -ne 1 ]]; then
>&2 echo "Usage ./png_to_ora <png-file>"
exit 1
fi
set -xe
PNG_PATH="$1"
PNG_FILE=$(basename "${PNG_PATH}")
PNG_NAME="${PNG_FILE%.*}"
mkdir -p "${PNG_NAME}/data"
echo "image/openraster" > "${PNG_NAME}/mimetype"
cp "${PNG_FILE}" "${PNG_NAME}/data/layer-00.png"
echo "}" > "${PNG_NAME}/data/layer-00-strokemap.dat"
cat <<EOF > "${PNG_NAME}/stack.xml"
<?xml version='1.0' encoding='UTF-8'?>
<image xmlns:mypaint="http://mypaint.org/ns/openraster" h="3520" version="0.0.5" w="2496" mypaint:frame-active="false">
<stack composite-op="svg:src-over" isolation="isolate" opacity="1.0" visibility="visible">
<layer composite-op="svg:src-over" mypaint_strokemap_v2="data/layer-00-strokemap.dat" name="Layer" opacity="1.0" selected="true" src="data/layer-00.png" visibility="visible" x="0" y="0" mypaint:strokemap="data/layer-00-strokemap.dat" />
</stack>
</image>
EOF
pushd "${PNG_NAME}"
zip -r ../"${PNG_NAME}.ora" *
popd
rm -r "${PNG_NAME}"

40
bin/prepare-pdf-noting Executable file
View File

@@ -0,0 +1,40 @@
#!/bin/sh
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pdf_to_pngs() {
mkdir -p "$2"
pdftoppm -rx 300 -ry 300 -png "$1" "$2/page"
}
invert_pngs() {
pushd "$1"
for page in page-*.png; do
convert -negate "${page}" "neg-${page}"
mv "neg-${page}" "${page}"
done
popd
}
pngs_to_oras() {
pushd "$1"
for page in page-*.png; do
"${SCRIPT_DIR}/png_to_ora" "${page}"
rm "${page}"
done
popd
}
if [[ $# -ne 2 ]]; then
>&2 echo "Usage ./prepare-pdf-noting <pdf-file> <notes-folder>"
exit 1
fi
set -xe
PDF_FILE="$1"
NOTES_FOLDER="$2"
pdf_to_pngs "${PDF_FILE}" "${NOTES_FOLDER}"
invert_pngs "${NOTES_FOLDER}"
pngs_to_oras "${NOTES_FOLDER}"

3
bin/region-to-gif Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
byzanz-record $(xrectsel "--x=%x --y=%y --width=%w --height=%h") out.gif