Last active
September 12, 2022 20:48
-
-
Save dustalov/13ffd01dab730325b93a632007a77b8e to your computer and use it in GitHub Desktop.
Miscellaneous scripts for nearly everyday use
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -eu | |
CWD=$(basename "$PWD") | |
XZ_OPT="-T 0" exec tar --exclude '*~' -C ../ -cJvf "../$CWD.tar.xz" "$CWD" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -eu | |
CWD=$(basename "$PWD") | |
exec tar --exclude '*~' -C ../ -czvf "../$CWD.tar.gz" "$CWD" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
hash curl jq | |
case $1 in | |
(*[!0-9]*|'') | |
echo "Usage: $(basename "$0") 4291120" >/dev/stderr | |
exit 1 | |
;; | |
*) | |
;; | |
esac | |
set -ux | |
curl -sfL "https://zenodo.org/api/records/$1" | jq 'reduce .files[] as $item ({}; . * {($item.key): $item.links.self})' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -eu | |
CWD=$(basename "$PWD") | |
rm -f "../$CWD.zip" | |
exec zip -X -x '*~' -r "../$CWD.zip" . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment