mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-02-07 12:19:31 +00:00
![Gabriel Arazas](/assets/img/avatar_default.png)
This update is too large, I made too many notes on stuff. Nonetheless, it is very nice to see progress. I've made note revisions on the following topics: - Learning - Writing - Various Linux-related stuff I've yet to start learning illustration but I'll be starting tomorrow for an update how do I keep in mind with those writings. There are still a lot of things to be processed from the backlog with yet more notes on learning but I keep having those perspectives whenever I practice so ehhh... Better have those than nothing? Furthermore, I've also updated the timestamp format. It is pretty simple to update all of the notes with a couple of `sed` calls. Aaaand, I've also changed the way how the assets stored with the folders only leaving it up for the generated files instead of enforcing it on every note. I create more visual aids and managing them is a pain for each note. This restructuring frees me of that burden.
1.5 KiB
1.5 KiB
Reproducible executables with Nix
You can create a reproducible executable that only requires Nix.
Here's a sample script that uses multiple dependencies.
If the script interact with the network (e.g., curl
, wget
) and the environment is completely pure, don't forget to install public Certificate Authorities with cacert
.
#!/usr/bin/env nix-shell
#! nix-shell --pure -i bash -p coreutils curl cacert jq fzf findutils
# A quick command line interface for creating a gitignore with the API from https://gitignore.io.
# This script comes with a simple caching to avoid creating too much requests.
set -eo pipefail
CACHE_FILE="${XDG_CACHE_DIR:-$HOME/.cache}/gitignore-io.langs.json"
# Check if the language list is downloaded for the last hour (3600 seconds).
if [ ! -e $CACHE_FILE ] || test $(expr $(date "+%s") - $(date -r $CACHE_FILE "+%s")) -gt 3600
then
ping "gitignore.io" --count 4 && curl --silent --location --output $CACHE_FILE "https://gitignore.io/api/list?format=json"
fi
KEYS=$(jq 'keys | .[] | @text' --raw-output $CACHE_FILE | fzf --multi | while read lang; do echo " .[\"$lang\"].contents"; done | paste -s -d ',')
jq "$KEYS" --raw-output $CACHE_FILE