Skip to content

Instantly share code, notes, and snippets.

@dustalov
Last active September 12, 2022 20:48
Show Gist options
  • Save dustalov/13ffd01dab730325b93a632007a77b8e to your computer and use it in GitHub Desktop.
Save dustalov/13ffd01dab730325b93a632007a77b8e to your computer and use it in GitHub Desktop.
Miscellaneous scripts for nearly everyday use
#!/bin/sh -eu
CWD=$(basename "$PWD")
XZ_OPT="-T 0" exec tar --exclude '*~' -C ../ -cJvf "../$CWD.tar.xz" "$CWD"
#!/bin/sh -eu
CWD=$(basename "$PWD")
exec tar --exclude '*~' -C ../ -czvf "../$CWD.tar.gz" "$CWD"
#!/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})'
#!/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