diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/bukuadd_c | 29 | ||||
-rwxr-xr-x | bin/mailto_handler | 24 | ||||
-rwxr-xr-x | bin/nuke | 501 | ||||
-rwxr-xr-x | bin/power.sh | 24 | ||||
-rwxr-xr-x | bin/sentences | 16 | ||||
-rwxr-xr-x | bin/spliff | 6 | ||||
-rwxr-xr-x | bin/td | 25 | ||||
-rwxr-xr-x | bin/type.sh | 15 | ||||
-rwxr-xr-x | bin/watch_incoming.sh | 16 |
9 files changed, 0 insertions, 656 deletions
diff --git a/bin/bukuadd_c b/bin/bukuadd_c deleted file mode 100755 index d4e1a3d..0000000 --- a/bin/bukuadd_c +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | #set -e | ||
4 | url=$(xsel -b) | ||
5 | tags=$(zenity --entry --text="enter tags for $url") | ||
6 | |||
7 | if [[ $? -ne 0 ]]; then | ||
8 | exit 0 | ||
9 | fi | ||
10 | |||
11 | FOO=$(buku --np --nc -p -1) | ||
12 | OUT="$(buku --np --nc -a "$url" "$tags" 2>&1)" | ||
13 | #echo "OUT>$OUT" | ||
14 | if [[ $OUT =~ "ERROR" ]] ; then | ||
15 | notify-send "Bookmarking Failed" "$OUT" --app-name="buku" --icon="dialog-error" | ||
16 | exit 1 | ||
17 | fi | ||
18 | |||
19 | BAR=$FOO | ||
20 | |||
21 | while [[ $BAR == "$FOO" ]]; do | ||
22 | sleep 1 | ||
23 | BAR=$(buku --np --nc -p -1) | ||
24 | #echo "BAR>$BAR" | ||
25 | done; | ||
26 | |||
27 | notify-send "Success" "$BAR" --app-name="buku" --icon="checkmark" | ||
28 | |||
29 | exit 0 | ||
diff --git a/bin/mailto_handler b/bin/mailto_handler deleted file mode 100755 index b85d0e4..0000000 --- a/bin/mailto_handler +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # rofi available mail accounts | ||
4 | |||
5 | ACCOUNTSDIR=$HOME/.config/mutt/accounts | ||
6 | |||
7 | choices='' | ||
8 | first='0' | ||
9 | |||
10 | for 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 | |||
20 | done | ||
21 | |||
22 | picked=$(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/bin/nuke b/bin/nuke deleted file mode 100755 index de4f5c2..0000000 --- a/bin/nuke +++ /dev/null | |||
@@ -1,501 +0,0 @@ | |||
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 | ||
69 | GUI="1" | ||
70 | |||
71 | set -euf -o noclobber -o noglob -o nounset | ||
72 | IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}" # protect trailing \n | ||
73 | |||
74 | PATH=$PATH:"${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins" | ||
75 | IMAGE_CACHE_PATH="$(dirname "$1")"/.thumbs | ||
76 | |||
77 | FPATH="$1" | ||
78 | FNAME=$(basename "$1") | ||
79 | EDITOR="${EDITOR:-vi}" | ||
80 | PAGER="${PAGER:-less -R}" | ||
81 | ext="${FNAME##*.}" | ||
82 | if ! [ -z "$ext" ]; then | ||
83 | ext="$(printf "%s" "${ext}" | tr '[:upper:]' '[:lower:]')" | ||
84 | fi | ||
85 | |||
86 | handle_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 | |||
103 | handle_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 | |||
119 | handle_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 | ||
142 | handle_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 | |||
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 | |||
252 | abspath() { | ||
253 | case "$1" in | ||
254 | /*) printf "%s\n" "$1";; | ||
255 | *) printf "%s\n" "$PWD/$1";; | ||
256 | esac | ||
257 | } | ||
258 | |||
259 | listimages() { | ||
260 | find -L "$(dirname "$target")" -maxdepth 1 -type f -iregex \ | ||
261 | '.*\(jpe?g\|bmp\|png\|gif\)$' -print0 | sort -z | ||
262 | } | ||
263 | |||
264 | load_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 | |||
276 | handle_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 | |||
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 | |||
421 | handle_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 | |||
465 | handle_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 | |||
475 | handle_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 | |||
494 | MIMETYPE="$( file --dereference --brief --mime-type -- "${FPATH}" )" | ||
495 | handle_extension | ||
496 | handle_multimedia "${MIMETYPE}" | ||
497 | handle_mime "${MIMETYPE}" | ||
498 | handle_blocked "${MIMETYPE}" | ||
499 | handle_fallback | ||
500 | |||
501 | exit 1 | ||
diff --git a/bin/power.sh b/bin/power.sh deleted file mode 100755 index 809e24c..0000000 --- a/bin/power.sh +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
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 | |||
14 | chosen=$(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 | |||
18 | if [[ $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" | ||
20 | elif [[ $chosen = "shutdown" ]]; then | ||
21 | systemctl poweroff | ||
22 | elif [[ $chosen = "restart" ]]; then | ||
23 | systemctl reboot | ||
24 | fi | ||
diff --git a/bin/sentences b/bin/sentences deleted file mode 100755 index a02d061..0000000 --- a/bin/sentences +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | use strict; | ||
4 | my $pont=qr{[.!?]+}; ## pontuation | ||
5 | my $abrev=qr{\b(?:Pr|Dr|Mr|[A-Z])\.}; ## abreviations | ||
6 | |||
7 | $/=""; | ||
8 | |||
9 | while(<>){ 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/bin/spliff b/bin/spliff deleted file mode 100755 index 3767bac..0000000 --- a/bin/spliff +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #!/usr/bin/env zsh | ||
2 | |||
3 | PDF=$1 | ||
4 | OUTPUT="${PDF:r}_spliff.pdf" | ||
5 | N=`qpdf --show-npages $1` | ||
6 | qpdf --collate --empty --pages $1 1-$(((N+1)/2)) $1 $(((N+1)/2 + 1))-$N -- $OUTPUT | ||
@@ -1,25 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | task_date=$(zenity --calendar --date-format=%Y-%m-%d) | ||
4 | |||
5 | if [[ $? -ne 0 ]]; then | ||
6 | notify-send "Cancelling..." "" --app-name="task todo" --icon="dialog error" | ||
7 | exit 0 | ||
8 | fi | ||
9 | |||
10 | task_time=$(zenity --entry --text="enter time in xx:xx format" --entry-text="00:00") | ||
11 | |||
12 | if [[ $? -ne 0 ]]; then | ||
13 | notify-send "Cancelling..." "" --app-name="task todo" --icon="dialog error" | ||
14 | exit 0 | ||
15 | fi | ||
16 | |||
17 | task_description=$(zenity --entry --text="enter description") | ||
18 | |||
19 | if [[ $? -ne 0 ]]; then | ||
20 | notify-send "Cancelling..." "" --app-name="task todo" --icon="dialog error" | ||
21 | exit 0 | ||
22 | fi | ||
23 | |||
24 | RESULT=$(task add due:${task_date}T$task_time "$task_description") | ||
25 | notify-send "Success" "$RESULT" --app-name="taskwarrior" --icon="checkmark" | ||
diff --git a/bin/type.sh b/bin/type.sh deleted file mode 100755 index b9dbcd7..0000000 --- a/bin/type.sh +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | sleep 1 | ||
3 | while read line | ||
4 | do | ||
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 | ||
15 | done | ||
diff --git a/bin/watch_incoming.sh b/bin/watch_incoming.sh deleted file mode 100755 index eed1da0..0000000 --- a/bin/watch_incoming.sh +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | TARGET=$HOME/Downloads/toPrint/toPrint_staging | ||
4 | PROCESSED=$HOME/Downloads/toPrint/toPrint_ready | ||
5 | SPLIFF=$HOME/bin/spliff | ||
6 | |||
7 | inotifywait -m -e create -e moved_to --format "%f" "${TARGET}" \ | ||
8 | | while read -r FILENAME | ||
9 | do | ||
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" | ||
16 | done | ||