Skip to content

Instantly share code, notes, and snippets.

@dustalov
Last active August 28, 2025 20:35
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 -eu
hash jq
CONFIG='{
"modify": true,
"omit": ["abstract","keywords"],
"curly": true,
"numeric": false,
"months": false,
"space": 2,
"tab": false,
"align": 10,
"blankLines": true,
"sort": ["key"],
"duplicates": ["key"],
"stripEnclosingBraces": false,
"dropAllCaps": false,
"escape": false,
"sortFields": [
"crossref",
"author",
"title",
"subtitle",
"shorttitle",
"year",
"date",
"journal",
"booktitle",
"booksubtitle",
"type",
"location",
"series",
"volume",
"number",
"issuetitle",
"pages",
"numpages",
"venue",
"organization",
"institution",
"address",
"publisher",
"doi",
"isbn",
"issn",
"eprint",
"eprinttype",
"eprintclass",
"url",
"urldate",
"note",
"language"
],
"stripComments": false,
"trailingCommas": true,
"encodeUrls": false,
"tidyComments": true,
"removeEmptyFields": false,
"removeDuplicateFields": true,
"lowercase": true,
"enclosingBraces": ["title"],
"backup": true
}'
URL="https://flamingtempura.github.io/bibtex-tidy/index.html?opt=$(printf '%s' "$CONFIG" | jq -sRr @uri)"
xdg-open "$URL" >/dev/null 2>&1 || open "$URL" >/dev/null 2>&1
#!/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