summaryrefslogtreecommitdiffstats
path: root/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/bukuadd_c29
-rwxr-xr-x.local/bin/mailto_handler24
-rwxr-xr-x.local/bin/nuke501
-rwxr-xr-x.local/bin/power.sh24
-rwxr-xr-x.local/bin/sentences16
-rwxr-xr-x.local/bin/spliff6
-rwxr-xr-x.local/bin/td25
-rwxr-xr-x.local/bin/type.sh15
-rwxr-xr-x.local/bin/watch_incoming.sh16
9 files changed, 656 insertions, 0 deletions
diff --git a/.local/bin/bukuadd_c b/.local/bin/bukuadd_c
new file mode 100755
index 0000000..d4e1a3d
--- /dev/null
+++ b/.local/bin/bukuadd_c
@@ -0,0 +1,29 @@
1#!/bin/bash
2
3#set -e
4url=$(xsel -b)
5tags=$(zenity --entry --text="enter tags for $url")
6
7if [[ $? -ne 0 ]]; then
8 exit 0
9fi
10
11FOO=$(buku --np --nc -p -1)
12OUT="$(buku --np --nc -a "$url" "$tags" 2>&1)"
13#echo "OUT>$OUT"
14if [[ $OUT =~ "ERROR" ]] ; then
15 notify-send "Bookmarking Failed" "$OUT" --app-name="buku" --icon="dialog-error"
16 exit 1
17fi
18
19BAR=$FOO
20
21while [[ $BAR == "$FOO" ]]; do
22 sleep 1
23 BAR=$(buku --np --nc -p -1)
24 #echo "BAR>$BAR"
25done;
26
27notify-send "Success" "$BAR" --app-name="buku" --icon="checkmark"
28
29exit 0
diff --git a/.local/bin/mailto_handler b/.local/bin/mailto_handler
new file mode 100755
index 0000000..b85d0e4
--- /dev/null
+++ b/.local/bin/mailto_handler
@@ -0,0 +1,24 @@
1#!/bin/sh
2
3# rofi available mail accounts
4
5ACCOUNTSDIR=$HOME/.config/mutt/accounts
6
7choices=''
8first='0'
9
10for account in "${ACCOUNTSDIR}"/*.muttrc; do
11 BASENAME=$(basename -- "${account}")
12 pick="${BASENAME%.muttrc}"
13 if [ $first -eq '0' ]; then
14 choices="${pick}"
15 first='1'
16 else
17 choices="${choices}\n${pick}"
18 fi
19
20done
21
22picked=$(printf "${choices}" | rofi -dmenu)
23
24 exec kitty -e neomutt -F "$HOME/.config/mutt/muttrc" -e "source /home/yigit/.config/mutt/accounts/${picked}.muttrc" -- "$@"
diff --git a/.local/bin/nuke b/.local/bin/nuke
new file mode 100755
index 0000000..de4f5c2
--- /dev/null
+++ b/.local/bin/nuke
@@ -0,0 +1,501 @@
1#!/usr/bin/env sh
2
3# #############################################################################
4# Description: Sample script to play files in apps by file type or mime
5#
6# Shell: POSIX compliant
7# Usage: nuke filepath
8#
9# Integration with nnn:
10# 1. Export the required config:
11# export NNN_OPENER=/absolute/path/to/nuke
12# # Otherwise, if nuke is in $PATH
13# # export NNN_OPENER=nuke
14# 2. Run nnn with the program option to indicate a CLI opener
15# nnn -c
16# # The -c program option overrides option -e
17# 3. nuke can use nnn plugins (e.g. mocplay is used for audio), $PATH is updated.
18#
19# Details:
20# Inspired by ranger's scope.sh, modified for usage with nnn.
21#
22# Guards against accidentally opening mime types like executables, shared libs etc.
23#
24# Tries to play 'file' (1st argument) in the following order:
25# i. by extension
26# ii. by mime (image, video, audio, pdf)
27# iii. by mime (other file types)
28#
29# Modification tips:
30# 1. Invokes CLI utilities by default. Set GUI to 1 to enable GUI apps.
31# 2. PAGER is "less -R".
32# 3. Start GUI apps in bg to unblock. Redirect stdout and strerr if required.
33# 4. Some CLI utilities are piped to the $PAGER, to wait and quit uniformly.
34# 5. If the output cannot be paged use "read -r _" to wait for user input.
35# 6. On a DE, try 'xdg-open' in handle_fallback() as last resort.
36#
37# Feel free to change the utilities to your favourites and add more mimes.
38#
39# Defaults:
40# By extension (only the enabled ones):
41# most archives: list with atool, bsdtar
42# rar: list with unrar
43# 7-zip: list with 7z
44# pdf: zathura (GUI), pdftotext, mutool, exiftool
45# audio: mocplay (nnn plugin using MOC), mpv, mediainfo, exiftool
46# avi|mkv|mp4: smplayer, mpv (GUI), ffmpegthumbnailer, mediainfo, exiftool
47# log: vi
48# torrent: rtorrent, transmission-show
49# odt|ods|odp|sxw: odt2txt
50# md: glow (https://github.com/charmbracelet/glow), lowdown (https://kristaps.bsd.lv/lowdown)
51# htm|html|xhtml: w3m, lynx, elinks
52# json: jq, python (json.tool module)
53# Multimedia by mime:
54# image/*: imv/sxiv (GUI), viu (https://github.com/atanunq/viu), img2txt, exiftool
55# video/*: smplayer, mpv (GUI), ffmpegthumbnailer, mediainfo, exiftool
56# audio/*: mocplay (nnn plugin using MOC), mpv, mediainfo, exiftool
57# application/pdf: zathura (GUI), pdftotext, mutool, exiftool
58# Other mimes:
59# text/troff: man -l
60# text/* | */xml: vi
61# image/vnd.djvu): djvutxt, exiftool
62#
63# ToDo:
64# 1. Adapt, test and enable all mimes
65# 2. Clean-up the unnecessary exit codes
66# #############################################################################
67
68# set to 1 to enable GUI apps
69GUI="1"
70
71set -euf -o noclobber -o noglob -o nounset
72IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}" # protect trailing \n
73
74PATH=$PATH:"${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins"
75IMAGE_CACHE_PATH="$(dirname "$1")"/.thumbs
76
77FPATH="$1"
78FNAME=$(basename "$1")
79EDITOR="${EDITOR:-vi}"
80PAGER="${PAGER:-less -R}"
81ext="${FNAME##*.}"
82if ! [ -z "$ext" ]; then
83 ext="$(printf "%s" "${ext}" | tr '[:upper:]' '[:lower:]')"
84fi
85
86handle_pdf() {
87 if [ "$GUI" -ne 0 ] && which zathura >/dev/null 2>&1; then
88 zathura "${FPATH}" >/dev/null 2>&1 &
89 exit 0
90 elif which pdftotext >/dev/null 2>&1; then
91 ## Preview as text conversion
92 pdftotext -l 10 -nopgbrk -q -- "${FPATH}" - | eval "$PAGER"
93 exit 0
94 elif which mutool >/dev/null 2>&1; then
95 mutool draw -F txt -i -- "${FPATH}" 1-10 | eval "$PAGER"
96 exit 0
97 elif which exiftool >/dev/null 2>&1; then
98 exiftool "${FPATH}" | eval "$PAGER"
99 exit 0
100 fi
101}
102
103handle_audio() {
104 if which mocp >/dev/null 2>&1 && which mocplay >/dev/null 2>&1; then
105 mocplay "${FPATH}" "opener" >/dev/null 2>&1
106 exit 0
107 elif which mpv >/dev/null 2>&1; then
108 mpv "${FPATH}" >/dev/null 2>&1 &
109 exit 0
110 elif which mediainfo >/dev/null 2>&1; then
111 mediainfo "${FPATH}" | eval "$PAGER"
112 exit 0
113 elif which exiftool >/dev/null 2>&1; then
114 exiftool "${FPATH}"| eval "$PAGER"
115 exit 0
116 fi
117}
118
119handle_video() {
120 if [ "$GUI" -ne 0 ] && which smplayer >/dev/null 2>&1; then
121 smplayer "${FPATH}" >/dev/null 2>&1 &
122 exit 0
123 elif [ "$GUI" -ne 0 ] && which mpv >/dev/null 2>&1; then
124 mpv "${FPATH}" >/dev/null 2>&1 &
125 exit 0
126 elif which ffmpegthumbnailer >/dev/null 2>&1; then
127 # Thumbnail
128 [ -d "${IMAGE_CACHE_PATH}" ] || mkdir "${IMAGE_CACHE_PATH}"
129 ffmpegthumbnailer -i "${FPATH}" -o "${IMAGE_CACHE_PATH}/${FNAME}.jpg" -s 0
130 viu -n "${IMAGE_CACHE_PATH}/${FNAME}.jpg" | eval "$PAGER"
131 exit 0
132 elif which mediainfo >/dev/null 2>&1; then
133 mediainfo "${FPATH}" | eval "$PAGER"
134 exit 0
135 elif which exiftool >/dev/null 2>&1; then
136 exiftool "${FPATH}"| eval "$PAGER"
137 exit 0
138 fi
139}
140
141# handle this extension and exit
142handle_extension() {
143 case "${ext}" in
144 ## Archive
145 a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\
146 rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)
147 if which atool >/dev/null 2>&1; then
148 atool --list -- "${FPATH}" | eval "$PAGER"
149 exit 0
150 elif which bsdtar >/dev/null 2>&1; then
151 bsdtar --list --file "${FPATH}" | eval "$PAGER"
152 exit 0
153 fi
154 exit 1;;
155 rar)
156 if which unrar >/dev/null 2>&1; then
157 ## Avoid password prompt by providing empty password
158 unrar lt -p- -- "${FPATH}" | eval "$PAGER"
159 fi
160 exit 1;;
161 7z)
162 if which 7z >/dev/null 2>&1; then
163 ## Avoid password prompt by providing empty password
164 7z l -p -- "${FPATH}" | eval "$PAGER"
165 exit 0
166 fi
167 exit 1;;
168
169 ## PDF
170 pdf)
171 handle_pdf
172 exit 1;;
173
174 ## Audio
175 aac|flac|m4a|mid|midi|mpa|mp2|mp3|ogg|wav|wma)
176 handle_audio
177 exit 1;;
178
179 ## Video
180 avi|mkv|mp4)
181 handle_video
182 exit 1;;
183
184 ## Log files
185 log)
186 # "$EDITOR" "${FPATH}"
187 "$PAGER" "${FPATH}"
188 exit 0;;
189
190 ## BitTorrent
191 torrent)
192 if which rtorrent >/dev/null 2>&1; then
193 rtorrent "${FPATH}"
194 exit 0
195 elif which transmission-show >/dev/null 2>&1; then
196 transmission-show -- "${FPATH}"
197 exit 0
198 fi
199 exit 1;;
200
201 ## OpenDocument
202 odt|ods|odp|sxw|pptx)
203 if which odt2txt >/dev/null 2>&1; then
204 ## Preview as text conversion
205 odt2txt "${FPATH}" | eval "$PAGER"
206 exit 0
207 elif [ "$GUI" -ne 0 ] && which libreoffice >/dev/null 2>&1; then
208 libreoffice "${FPATH}" &
209 exit 0
210 fi
211 exit 1;;
212
213 ## Markdown
214 md)
215 if which glow >/dev/null 2>&1; then
216 glow -sdark "${FPATH}" | eval "$PAGER"
217 exit 0
218 elif which lowdown >/dev/null 2>&1; then
219 lowdown -Tterm "${FPATH}" | eval "$PAGER"
220 exit 0
221 fi
222 ;;
223
224 ## HTML
225 htm|html|xhtml)
226 ## Preview as text conversion
227 if which w3m >/dev/null 2>&1; then
228 w3m -dump "${FPATH}" | eval "$PAGER"
229 exit 0
230 elif which lynx >/dev/null 2>&1; then
231 lynx -dump -- "${FPATH}" | eval "$PAGER"
232 exit 0
233 elif which elinks >/dev/null 2>&1; then
234 elinks -dump "${FPATH}" | eval "$PAGER"
235 exit 0
236 fi
237 ;;
238
239 ## JSON
240 json)
241 if which jq >/dev/null 2>&1; then
242 jq --color-output . "${FPATH}" | eval "$PAGER"
243 exit 0
244 elif which python >/dev/null 2>&1; then
245 python -m json.tool -- "${FPATH}" | eval "$PAGER"
246 exit 0
247 fi
248 ;;
249 esac
250}
251
252abspath() {
253 case "$1" in
254 /*) printf "%s\n" "$1";;
255 *) printf "%s\n" "$PWD/$1";;
256 esac
257}
258
259listimages() {
260 find -L "$(dirname "$target")" -maxdepth 1 -type f -iregex \
261 '.*\(jpe?g\|bmp\|png\|gif\)$' -print0 | sort -z
262}
263
264load_dir() {
265 target="$(abspath "$2")"
266 count="$(listimages | grep -a -m 1 -ZznF "$target" | cut -d: -f1)"
267
268 if [ -n "$count" ]; then
269 listimages | xargs -0 "$1" -n "$count" --
270 else
271 shift
272 "$1" -- "$@" # fallback
273 fi
274}
275
276handle_multimedia() {
277 ## Size of the preview if there are multiple options or it has to be
278 ## rendered from vector graphics. If the conversion program allows
279 ## specifying only one dimension while keeping the aspect ratio, the width
280 ## will be used.
281 # local DEFAULT_SIZE="1920x1080"
282
283 mimetype="${1}"
284 case "${mimetype}" in
285 ## SVG
286 # image/svg+xml|image/svg)
287 # convert -- "${FPATH}" "${IMAGE_CACHE_PATH}" && exit 6
288 # exit 1;;
289
290 ## DjVu
291 # image/vnd.djvu)
292 # ddjvu -format=tiff -quality=90 -page=1 -size="${DEFAULT_SIZE}" \
293 # - "${IMAGE_CACHE_PATH}" < "${FPATH}" \
294 # && exit 6 || exit 1;;
295
296 ## Image
297 image/*)
298 if [ "$GUI" -ne 0 ] && which imvr >/dev/null 2>&1; then
299 load_dir imvr "${FPATH}" >/dev/null 2>&1 &
300 exit 0
301 elif [ "$GUI" -ne 0 ] && which sxiv >/dev/null 2>&1; then
302 load_dir sxiv "${FPATH}" >/dev/null 2>&1 &
303 exit 0
304 elif which viu >/dev/null 2>&1; then
305 viu -n "${FPATH}" | eval "$PAGER"
306 exit 0
307 elif which img2txt >/dev/null 2>&1; then
308 img2txt --gamma=0.6 -- "${FPATH}" | eval "$PAGER"
309 exit 0
310 elif which exiftool >/dev/null 2>&1; then
311 exiftool "${FPATH}" | eval "$PAGER"
312 exit 0
313 fi
314 # local orientation
315 # orientation="$( identify -format '%[EXIF:Orientation]\n' -- "${FPATH}" )"
316 ## If orientation data is present and the image actually
317 ## needs rotating ("1" means no rotation)...
318 # if [[ -n "$orientation" && "$orientation" != 1 ]]; then
319 ## ...auto-rotate the image according to the EXIF data.
320 # convert -- "${FPATH}" -auto-orient "${IMAGE_CACHE_PATH}" && exit 6
321 # fi
322
323 ## `w3mimgdisplay` will be called for all images (unless overridden
324 ## as above), but might fail for unsupported types.
325 exit 7;;
326
327 ## PDF
328 application/pdf)
329 handle_pdf
330 exit 1;;
331
332 ## Audio
333 audio/*)
334 handle_audio
335 exit 1;;
336
337 ## Video
338 video/*)
339 handle_video
340 exit 1;;
341
342 # pdftoppm -f 1 -l 1 \
343 # -scale-to-x "${DEFAULT_SIZE%x*}" \
344 # -scale-to-y -1 \
345 # -singlefile \
346 # -jpeg -tiffcompression jpeg \
347 # -- "${FPATH}" "${IMAGE_CACHE_PATH%.*}" \
348 # && exit 6 || exit 1;;
349
350
351 ## ePub, MOBI, FB2 (using Calibre)
352 # application/epub+zip|application/x-mobipocket-ebook|\
353 # application/x-fictionbook+xml)
354 # # ePub (using https://github.com/marianosimone/epub-thumbnailer)
355 # epub-thumbnailer "${FPATH}" "${IMAGE_CACHE_PATH}" \
356 # "${DEFAULT_SIZE%x*}" && exit 6
357 # ebook-meta --get-cover="${IMAGE_CACHE_PATH}" -- "${FPATH}" \
358 # >/dev/null && exit 6
359 # exit 1;;
360
361 ## Font
362 # application/font*|application/*opentype)
363 # preview_png="/tmp/$(basename "${IMAGE_CACHE_PATH%.*}").png"
364 # if fontimage -o "${preview_png}" \
365 # --pixelsize "120" \
366 # --fontname \
367 # --pixelsize "80" \
368 # --text " ABCDEFGHIJKLMNOPQRSTUVWXYZ " \
369 # --text " abcdefghijklmnopqrstuvwxyz " \
370 # --text " 0123456789.:,;(*!?') ff fl fi ffi ffl " \
371 # --text " The quick brown fox jumps over the lazy dog. " \
372 # "${FPATH}";
373 # then
374 # convert -- "${preview_png}" "${IMAGE_CACHE_PATH}" \
375 # && rm "${preview_png}" \
376 # && exit 6
377 # else
378 # exit 1
379 # fi
380 # ;;
381
382 ## Preview archives using the first image inside.
383 ## (Very useful for comic book collections for example.)
384 # application/zip|application/x-rar|application/x-7z-compressed|\
385 # application/x-xz|application/x-bzip2|application/x-gzip|application/x-tar)
386 # local fn=""; local fe=""
387 # local zip=""; local rar=""; local tar=""; local bsd=""
388 # case "${mimetype}" in
389 # application/zip) zip=1 ;;
390 # application/x-rar) rar=1 ;;
391 # application/x-7z-compressed) ;;
392 # *) tar=1 ;;
393 # esac
394 # { [ "$tar" ] && fn=$(tar --list --file "${FPATH}"); } || \
395 # { fn=$(bsdtar --list --file "${FPATH}") && bsd=1 && tar=""; } || \
396 # { [ "$rar" ] && fn=$(unrar lb -p- -- "${FPATH}"); } || \
397 # { [ "$zip" ] && fn=$(zipinfo -1 -- "${FPATH}"); } || return
398 #
399 # fn=$(echo "$fn" | python -c "import sys; import mimetypes as m; \
400 # [ print(l, end='') for l in sys.stdin if \
401 # (m.guess_type(l[:-1])[0] or '').startswith('image/') ]" |\
402 # sort -V | head -n 1)
403 # [ "$fn" = "" ] && return
404 # [ "$bsd" ] && fn=$(printf '%b' "$fn")
405 #
406 # [ "$tar" ] && tar --extract --to-stdout \
407 # --file "${FPATH}" -- "$fn" > "${IMAGE_CACHE_PATH}" && exit 6
408 # fe=$(echo -n "$fn" | sed 's/[][*?\]/\\\0/g')
409 # [ "$bsd" ] && bsdtar --extract --to-stdout \
410 # --file "${FPATH}" -- "$fe" > "${IMAGE_CACHE_PATH}" && exit 6
411 # [ "$bsd" ] || [ "$tar" ] && rm -- "${IMAGE_CACHE_PATH}"
412 # [ "$rar" ] && unrar p -p- -inul -- "${FPATH}" "$fn" > \
413 # "${IMAGE_CACHE_PATH}" && exit 6
414 # [ "$zip" ] && unzip -pP "" -- "${FPATH}" "$fe" > \
415 # "${IMAGE_CACHE_PATH}" && exit 6
416 # [ "$rar" ] || [ "$zip" ] && rm -- "${IMAGE_CACHE_PATH}"
417 # ;;
418 esac
419}
420
421handle_mime() {
422 mimetype="${1}"
423 case "${mimetype}" in
424 ## Manpages
425 text/troff)
426 man -l "${FPATH}"
427 exit 0;;
428
429 ## Text
430 text/* | */xml)
431 "$EDITOR" "${FPATH}"
432 exit 0;;
433 ## Syntax highlight
434 # if [[ "$( stat --printf='%s' -- "${FPATH}" )" -gt "${HIGHLIGHT_SIZE_MAX}" ]]; then
435 # exit 2
436 # fi
437 # if [[ "$( tput colors )" -ge 256 ]]; then
438 # local pygmentize_format='terminal256'
439 # local highlight_format='xterm256'
440 # else
441 # local pygmentize_format='terminal'
442 # local highlight_format='ansi'
443 # fi
444 # env HIGHLIGHT_OPTIONS="${HIGHLIGHT_OPTIONS}" highlight \
445 # --out-format="${highlight_format}" \
446 # --force -- "${FPATH}" && exit 5
447 # pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}"\
448 # -- "${FPATH}" && exit 5
449 # exit 2;;
450
451 ## DjVu
452 image/vnd.djvu)
453 if which djvutxt >/dev/null 2>&1; then
454 ## Preview as text conversion (requires djvulibre)
455 djvutxt "${FPATH}" | eval "$PAGER"
456 exit 0
457 elif which exiftool >/dev/null 2>&1; then
458 exiftool "${FPATH}" | eval "$PAGER"
459 exit 0
460 fi
461 exit 1;;
462 esac
463}
464
465handle_fallback() {
466 if [ "$GUI" -ne 0 ]; then
467 xdg-open "${FPATH}" >/dev/null 2>&1 &
468 exit 0
469 fi
470
471 echo '----- File details -----' && file --dereference --brief -- "${FPATH}"
472 exit 1
473}
474
475handle_blocked() {
476 case "${MIMETYPE}" in
477 application/x-sharedlib)
478 exit 0;;
479
480 application/x-shared-library-la)
481 exit 0;;
482
483 application/x-executable)
484 exit 0;;
485
486 application/x-shellscript)
487 exit 0;;
488
489 application/octet-stream)
490 exit 0;;
491 esac
492}
493
494MIMETYPE="$( file --dereference --brief --mime-type -- "${FPATH}" )"
495handle_extension
496handle_multimedia "${MIMETYPE}"
497handle_mime "${MIMETYPE}"
498handle_blocked "${MIMETYPE}"
499handle_fallback
500
501exit 1
diff --git a/.local/bin/power.sh b/.local/bin/power.sh
new file mode 100755
index 0000000..809e24c
--- /dev/null
+++ b/.local/bin/power.sh
@@ -0,0 +1,24 @@
1#!/bin/bash
2
3# Simple script to handle a DIY shutdown menu. When run you should see a bunch of options (shutdown, reboot etc.)
4#
5# Requirements:
6# - rofi
7# - systemd, but you can replace the commands for OpenRC or anything else
8#
9# Instructions:
10# - Save this file as power.sh or anything
11# - Give it exec priviledge, or chmod +x /path/to/power.sh
12# - Run it
13
14chosen=$(echo -e "lock\nshutdown\nrestart" | rofi -dmenu -i)
15# Info about some states are available here:
16# https://www.freedesktop.org/software/systemd/man/systemd-sleep.conf.html#Description
17
18if [[ $chosen = "lock" ]]; then
19 i3lock -i ~/Dropbox/Wallpapers/current/breakfast.jpg --clock --time-font="FuraCode Nerd Font" --timesize=144 --datestr="" --timecolor=fefefeee --timestr="%H:%M" --radius=45 --timepos="ix:iy-250"
20elif [[ $chosen = "shutdown" ]]; then
21 systemctl poweroff
22elif [[ $chosen = "restart" ]]; then
23 systemctl reboot
24fi
diff --git a/.local/bin/sentences b/.local/bin/sentences
new file mode 100755
index 0000000..a02d061
--- /dev/null
+++ b/.local/bin/sentences
@@ -0,0 +1,16 @@
1#!/usr/bin/perl
2
3use strict;
4my $pont=qr{[.!?]+}; ## pontuation
5my $abrev=qr{\b(?:Pr|Dr|Mr|[A-Z])\.}; ## abreviations
6
7$/="";
8
9while(<>){ chomp; ## for each paragraph,
10
11 s/\h*\n\h*/ /g; ## remove \n
12 s/($pont)\h+(\S)/$1\n$2/g; ## pontuation+space
13 s/($abrev)\n/$1 /g; ## undo \n after abreviations
14
15 print "$_\n\n";
16}
diff --git a/.local/bin/spliff b/.local/bin/spliff
new file mode 100755
index 0000000..3767bac
--- /dev/null
+++ b/.local/bin/spliff
@@ -0,0 +1,6 @@
1#!/usr/bin/env zsh
2
3PDF=$1
4OUTPUT="${PDF:r}_spliff.pdf"
5N=`qpdf --show-npages $1`
6qpdf --collate --empty --pages $1 1-$(((N+1)/2)) $1 $(((N+1)/2 + 1))-$N -- $OUTPUT
diff --git a/.local/bin/td b/.local/bin/td
new file mode 100755
index 0000000..3de0d55
--- /dev/null
+++ b/.local/bin/td
@@ -0,0 +1,25 @@
1#!/bin/bash
2
3task_date=$(zenity --calendar --date-format=%Y-%m-%d)
4
5if [[ $? -ne 0 ]]; then
6 notify-send "Cancelling..." "" --app-name="task todo" --icon="dialog error"
7 exit 0
8fi
9
10task_time=$(zenity --entry --text="enter time in xx:xx format" --entry-text="00:00")
11
12if [[ $? -ne 0 ]]; then
13 notify-send "Cancelling..." "" --app-name="task todo" --icon="dialog error"
14 exit 0
15fi
16
17task_description=$(zenity --entry --text="enter description")
18
19if [[ $? -ne 0 ]]; then
20 notify-send "Cancelling..." "" --app-name="task todo" --icon="dialog error"
21 exit 0
22fi
23
24RESULT=$(task add due:${task_date}T$task_time "$task_description")
25notify-send "Success" "$RESULT" --app-name="taskwarrior" --icon="checkmark"
diff --git a/.local/bin/type.sh b/.local/bin/type.sh
new file mode 100755
index 0000000..b9dbcd7
--- /dev/null
+++ b/.local/bin/type.sh
@@ -0,0 +1,15 @@
1#!/usr/bin/env bash
2sleep 1
3while read line
4do
5 grep -o . <<<$line | while read a
6 do
7 sleep 0.$((RANDOM%3))
8 #2>&1 echo -n "${a:- }" | tee /dev/tty
9 echo -n "${a:- }" | tee /dev/tty
10 done
11 sleep 0.$((RANDOM%7))
12 1>&2 echo -ne $"\n"
13 echo
14 sleep 1.0
15done
diff --git a/.local/bin/watch_incoming.sh b/.local/bin/watch_incoming.sh
new file mode 100755
index 0000000..eed1da0
--- /dev/null
+++ b/.local/bin/watch_incoming.sh
@@ -0,0 +1,16 @@
1#!/usr/bin/env bash
2
3TARGET=$HOME/Downloads/toPrint/toPrint_staging
4PROCESSED=$HOME/Downloads/toPrint/toPrint_ready
5SPLIFF=$HOME/bin/spliff
6
7inotifywait -m -e create -e moved_to --format "%f" "${TARGET}" \
8 | while read -r FILENAME
9do
10 THUMB=$(mktemp /tmp/pdf_thumbnail_XXXXXXXXX.png)
11 evince-thumbnailer -s 1024 -l "${TARGET}/${FILENAME}" "${THUMB}"
12 mv "${TARGET}/${FILENAME}" "${PROCESSED}/${FILENAME}"
13 $SPLIFF "${PROCESSED}/${FILENAME}"
14 rm -f "${PROCESSED}/${FILENAME}"
15 dunstify -a "spliff" -I "${THUMB}" "$FILENAME"
16done