mirror of
https://github.com/foo-dogsquared/dotfiles.git
synced 2025-01-31 04:57:57 +00:00
Improve my custom scripts
This commit is contained in:
parent
24f2211e49
commit
d6dbc20746
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Simply create a universal emoji selection list.
|
# Simply create a universal emoji selection list.
|
||||||
# The emoji list should be the following file:
|
# The emoji list should be the following file:
|
||||||
@ -12,7 +12,7 @@
|
|||||||
# * rofi - Version: 1.5.4
|
# * rofi - Version: 1.5.4
|
||||||
# * xclip - version 0.13
|
# * xclip - version 0.13
|
||||||
|
|
||||||
emoji_file="${XDG_DATA_HOME:-HOME/.local/share}/emoji-list.txt"
|
emoji_file="${XDG_DATA_HOME:-$HOME/.local/share}/emoji-list.txt"
|
||||||
if [[ ! -f $emoji_file ]]; then
|
if [[ ! -f $emoji_file ]]; then
|
||||||
notify-send "Downloading the emoji data file."
|
notify-send "Downloading the emoji data file."
|
||||||
wget --output-document "$emoji_file" https://unicode.org/Public/emoji/13.0/emoji-test.txt
|
wget --output-document "$emoji_file" https://unicode.org/Public/emoji/13.0/emoji-test.txt
|
||||||
|
25
bin/generate-gitignore
Executable file
25
bin/generate-gitignore
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# A quick command line interface for creating a gitignore with the API from https://gitignore.io.
|
||||||
|
# This script comes with a simple caching to avoid creating too much requests.
|
||||||
|
|
||||||
|
# Dependencies:
|
||||||
|
# * bash
|
||||||
|
# * curl
|
||||||
|
# * fzf
|
||||||
|
# * paste
|
||||||
|
# * xargs
|
||||||
|
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
CACHE_FILE="${XDG_CACHE_DIR:-$HOME/.cache}/gitignore-io.langs.json"
|
||||||
|
|
||||||
|
# Check if the language list is downloaded for the last hour (3600 seconds).
|
||||||
|
if [ ! -e $CACHE_FILE ] || test $(expr $(date "+%s") - $(date -r $CACHE_FILE "+%s")) -gt 3600
|
||||||
|
then
|
||||||
|
curl --silent --location --output $CACHE_FILE "https://gitignore.io/api/list?format=json"
|
||||||
|
fi
|
||||||
|
|
||||||
|
KEYS=$(jq 'keys | .[] | @text' --raw-output $CACHE_FILE | fzf --multi | while read lang; do echo " .[\"$lang\"].contents"; done | paste -s -d ',')
|
||||||
|
|
||||||
|
jq "$KEYS" --raw-output $CACHE_FILE
|
12
bin/init-template
Executable file
12
bin/init-template
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
TEMPLATES_DIR="$HOME/templates"
|
||||||
|
|
||||||
|
while [[ ! -a "$TEMPLATES_DIR/$TEMPLATE/cookiecutter.json" ]]
|
||||||
|
do
|
||||||
|
TEMPLATE="$TEMPLATE/$(ls "$TEMPLATES_DIR/$TEMPLATE" | fzf)"
|
||||||
|
done
|
||||||
|
|
||||||
|
cookiecutter "$TEMPLATES_DIR/$TEMPLATE"
|
3
bin/ocr
3
bin/ocr
@ -7,7 +7,6 @@
|
|||||||
# * leptonica-1.79.0
|
# * leptonica-1.79.0
|
||||||
# * The Tesseract English data
|
# * The Tesseract English data
|
||||||
# * Image libraries (e.g., `libgif`, `libwebp`)
|
# * Image libraries (e.g., `libgif`, `libwebp`)
|
||||||
# * ImageWorsener 1.3.3
|
|
||||||
# * xclip - version 0.13
|
# * xclip - version 0.13
|
||||||
# * maim - version 5.6.3
|
# * maim - version 5.6.3
|
||||||
|
|
||||||
@ -16,5 +15,5 @@
|
|||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
notify-send "Select a region for the OCR"
|
notify-send "Select a region for the OCR"
|
||||||
maim --select --hidecursor | imagew - -outfmt png -w x5 - | tesseract - stdout
|
maim --select --hidecursor | magick mogrify -modulate 100,0 -resize 400% png:- | tesseract - stdout
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user