mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-15 02:53:34 +00:00
scripts: formatting, x-thumbgen, imagick installer
This commit is contained in:
@@ -39,7 +39,7 @@ if hash ffmpeg 2> /dev/null; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# gcloud
|
# gcloud
|
||||||
if hash gcloud 2>/dev/null; then
|
if hash gcloud 2> /dev/null; then
|
||||||
GCLOUD_LOC=$(gcloud info --format="value(installation.sdk_root)" --quiet)
|
GCLOUD_LOC=$(gcloud info --format="value(installation.sdk_root)" --quiet)
|
||||||
[[ -f "$GCLOUD_LOC/path.zsh.inc" ]] && builtin source "$GCLOUD_LOC/path.zsh.inc"
|
[[ -f "$GCLOUD_LOC/path.zsh.inc" ]] && builtin source "$GCLOUD_LOC/path.zsh.inc"
|
||||||
[[ -f "$GCLOUD_LOC/completion.zsh.inc" ]] && builtin source "$GCLOUD_LOC/completion.zsh.inc"
|
[[ -f "$GCLOUD_LOC/completion.zsh.inc" ]] && builtin source "$GCLOUD_LOC/completion.zsh.inc"
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ function section_install
|
|||||||
$0 brew install
|
$0 brew install
|
||||||
$0 install composer
|
$0 install composer
|
||||||
$0 install dotenv-linter
|
$0 install dotenv-linter
|
||||||
|
$0 install imagick
|
||||||
$0 install nvm
|
$0 install nvm
|
||||||
$0 install npm
|
$0 install npm
|
||||||
$0 install ntfy
|
$0 install ntfy
|
||||||
@@ -49,6 +50,10 @@ function section_install
|
|||||||
| sh -s -- -b "$XDG_BIN_HOME" \
|
| sh -s -- -b "$XDG_BIN_HOME" \
|
||||||
&& msg_done "🎉 dotenv-linter installed!"
|
&& msg_done "🎉 dotenv-linter installed!"
|
||||||
;;
|
;;
|
||||||
|
imagick)
|
||||||
|
wget https://imagemagick.org/archive/binaries/magick > "$XDG_BIN_HOME/magick" \
|
||||||
|
&& msg_done "🎉 imagick installed!"
|
||||||
|
;;
|
||||||
starship)
|
starship)
|
||||||
curl -sS https://starship.rs/install.sh | sh -s -- --bin-dir ~/.local/bin \
|
curl -sS https://starship.rs/install.sh | sh -s -- --bin-dir ~/.local/bin \
|
||||||
&& msg_done "🎉 starship installed!"
|
&& msg_done "🎉 starship installed!"
|
||||||
@@ -76,11 +81,12 @@ function section_install
|
|||||||
&& msg_done "🎉 Z has been installed!"
|
&& msg_done "🎉 Z has been installed!"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
menu_section "$USAGE_PREFIX" "all | antigen | composer | dotenv-linter | starship | macos | nvm | npm"
|
menu_section "$USAGE_PREFIX" "all | antigen | composer | dotenv-linter | imagick | starship | macos | nvm | npm"
|
||||||
menu_item "all" "Installs macos defaults, antigen, starship, brew, nvm, npm packages and others"
|
menu_item "all" "Installs macos defaults, antigen, starship, brew, nvm, npm packages and others"
|
||||||
menu_item "antigen" "Updates the antigen.zsh file"
|
menu_item "antigen" "Updates the antigen.zsh file"
|
||||||
menu_item "composer" "Install composer"
|
menu_item "composer" "Install composer"
|
||||||
menu_item "dotenv-linter" "Install dotenv-linter"
|
menu_item "dotenv-linter" "Install dotenv-linter"
|
||||||
|
menu_item "imagick" "Install ImageMagick CLI"
|
||||||
menu_item "starship" "Install starship.rs"
|
menu_item "starship" "Install starship.rs"
|
||||||
menu_item "macos" "Setup nice macOS defaults"
|
menu_item "macos" "Setup nice macOS defaults"
|
||||||
menu_item "nvm" "Install Node Version Manager (nvm)"
|
menu_item "nvm" "Install Node Version Manager (nvm)"
|
||||||
|
|||||||
@@ -2,10 +2,13 @@
|
|||||||
# Verify folder exists, and if it does not, create it.
|
# Verify folder exists, and if it does not, create it.
|
||||||
|
|
||||||
dir="$1"
|
dir="$1"
|
||||||
|
|
||||||
[ $# -eq 0 ] && { echo "Usage: $0 full/path/to/dir/to/create"; exit 1; }
|
[ $# -eq 0 ] && {
|
||||||
|
echo "Usage: $0 full/path/to/dir/to/create"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
if [ ! -d "$dir" ]; then
|
if [ ! -d "$dir" ]; then
|
||||||
mkdir -p "$dir" && exit 0;
|
mkdir -p "$dir" && exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
39
local/bin/x-thumbgen
Executable file
39
local/bin/x-thumbgen
Executable file
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Generate thumbnails using magick
|
||||||
|
# https://imagemagick.org/script/download.php
|
||||||
|
#
|
||||||
|
# Defaults to current directory creating thumbs with 1000x1000
|
||||||
|
# images with 200px white borders around the original image.
|
||||||
|
#
|
||||||
|
# Defaults can be overridden with ENV variables like this:
|
||||||
|
# $ THMB_BACKGROUND=black x-thumbgen ~/images/
|
||||||
|
#
|
||||||
|
# Created by: Ismo Vuorinen <https://github.com/ivuorinen> 2015
|
||||||
|
|
||||||
|
: "${THMB_SOURCE:=$1}"
|
||||||
|
: "${THMB_BACKGROUND:=white}"
|
||||||
|
: "${THMB_RESIZE:=800x800}"
|
||||||
|
: "${THMB_EXTENT:=1000x1000}"
|
||||||
|
|
||||||
|
[ $# -eq 0 ] && {
|
||||||
|
echo "Usage: $0 /full/path/to/image/folder"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$THMB_SOURCE" == "" ] || [ ! -d "$THMB_SOURCE" ]; then
|
||||||
|
THMB_SOURCE=$(pwd)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v magick &> /dev/null; then
|
||||||
|
|
||||||
|
magick \
|
||||||
|
"$THMB_SOURCE/*" \
|
||||||
|
-resize "$THMB_RESIZE" \
|
||||||
|
-background "$THMB_BACKGROUND" \
|
||||||
|
-gravity center \
|
||||||
|
-extent "$THMB_EXTENT" \
|
||||||
|
-set filename:fname '%t_thumb.%e' +adjoin '%[filename:fname]'
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "magick not found in PATH, https://imagemagick.org/script/download.php"
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user