From 6f63ce00ecf066b4185c5b4057cd5c213933a850 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Mon, 11 Oct 2021 14:09:20 +0200 Subject: [PATCH 1/2] Adds command to compress pdf files --- bin/compress-pdf | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 bin/compress-pdf diff --git a/bin/compress-pdf b/bin/compress-pdf new file mode 100644 index 0000000..bd194b4 --- /dev/null +++ b/bin/compress-pdf @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +if [ $# -ne 2 ]; then + echo >&2 "errror: wrong number of arguments" + echo >&2 "usage: compress-pdf " + exit 1 +fi + +gs -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=$2 $1 From 76f6f09a676d34f0f806e4a9319de906834e953a Mon Sep 17 00:00:00 2001 From: Thibault Blanc-Beyne Date: Sun, 8 May 2022 18:32:36 +0200 Subject: [PATCH 2/2] Adds a loop in weather script to get weather for several cities a once --- bin/weather | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/bin/weather b/bin/weather index 21c1962..606cefe 100755 --- a/bin/weather +++ b/bin/weather @@ -14,23 +14,34 @@ _check_date() { fi } -main() { - if [ "$1" == "startup" ]; then - _check_date - if [ $? -ne 0 ]; then - curl --retry 10 --connect-timeout 20 wttr.in 2>/dev/null +weather_loop() { + if [ $# -gt 0 ] + then + for ((i=1; i<=$#; i++)); do + curl --retry 10 --connect-timeout 20 wttr.in/${!i} 2>/dev/null + done if [ $? -eq 0 ]; then date +%d/%m/%Y > ~/.config/dotfiles/.data/weather_date else echo -e "\033[31;1mNetwork unavailable, please check your connexion or try again later.\033[0m" fi - fi else curl --retry 10 --connect-timeout 20 wttr.in 2>/dev/null - if [ $? -ne 0 ]; then + if [ $? -eq 0 ]; then echo -e "\033[31;1mNetwork unavailable, please check your connexion or try again later.\033[0m" fi fi } +main() { + if [ "$1" == "startup" ]; then + _check_date + if [ $? -ne 0 ]; then + weather_loop ${@:2} + fi + else + weather_loop $@ + fi +} + main $@