External Utilties
These are utilities that often don’t come included in various Linux distributions. Arch Linux tends to put them in the extra
folder
jq
https://www.linode.com/docs/guides/using-jq-to-process-json-on-the-command-line/
https://www.latlong.net/place/berlin-germany-9966.html
Average latitude
Berlin 52.51304156261525
jq --slurp 'map(select(.)) | map(tonumber) | add/length' <<< $(jq '.location.geo.latitude' ../sowhereto/content/berlin/*/schema.json)
Min latitude
Berlin 52.27625
jq --slurp 'map(select(.)) | map(tonumber) | min' <<< $(jq '.location.geo.latitude' ../sowhereto/content/berlin/*/schema.json)
Max latitude
Berlin 53.1776905
jq --slurp 'map(select(.)) | map(tonumber) | max' <<< $(jq '.location.geo.latitude' ../sowhereto/content/berlin/*/schema.json)
Average longitude
Berlin 13.419586924014967
jq --slurp 'map(select(.)) | map(tonumber) | add/length' <<< $(jq '.location.geo.longitude' ../sowhereto/content/berlin/*/schema.json)
Min longitude
Berlin 13.2126437
jq --slurp 'map(select(.)) | map(tonumber) | min' <<< $(jq '.location.geo.longitude' ../sowhereto/content/berlin/*/schema.json)
Max longitude
Berlin 14.5011999
jq --slurp 'map(select(.)) | map(tonumber) | max' <<< $(jq '.location.geo.longitude' ../sowhereto/content/berlin/*/schema.json)
type
$(jq '.performer | type' <<<"$schema")
type can be null, boolean, number, string, array or object.
curl
curl https://sowhereto.today
curl: (60) SSL: no alternative certificate subject name matches target hostname 'sowhereto.today'
More details here: https://curl.se/docs/sslcerts.html
curl -k https://sowhereto.today
nc
Netcat (nc) allows us to write a simple http server in Bash.
Though nc was a traditional part of Unix, Linux distributions don’t tend to include it. I installed openbsd-netcat rather than gnu-netcat since it seems to be more actively maintained.
A nice tutorial which got me started is Building a Web server in Bash. Besides nc, this introduced me to named pipes created with mkfifo.
A simple manpage webapp written in Bash
For my first webapp, I want to create a manpage reader.
hq
git
Setting up a repository on the server
# mkdir /srv/git/projectname.git
# git --bare init /srv/git/projectname.git
# chown -R git:git /srv/git/projectname.git
$ git config --global --add safe.directory /srv/git/poopsheet.git
git pull --rebase
git rebase --abort
Learning git
git help
git help tutorial
git help everyday
git help revisions
git help workflows
configuration
Default .git/conf
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = /srv/git/myprojectname.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
Assume the following history exists and the current branch is master:
tree
Before I discovered the tree command, I wasted huge amounts of time manually making grapic directory listings.
$ tree ~/webapps/frontiersoftware
/home/roblaing/webapps/frontiersoftware
├── archetypes
│ └── default.md
├── assets
├── config
│ └── _default
│ └── hugo.json
├── content
│ ├── bash
│ │ ├── coreutils
│ │ │ ├── _index.md
│ │ │ └── sed
│ │ │ ├── index.md
│ │ │ └── spec
│ │ │ ├── basics_spec.sh
│ │ │ ├── deleting_lines_spec.sh
│ │ │ ├── inserting_lines_spec.sh
│ │ │ ├── printing_spec.sh
│ │ │ ├── spec_helper.sh
│ │ │ └── substitution_spec.sh
│ │ ├── extra
│ │ │ ├── _index.md
│ │ │ └── tree
│ │ │ └── index.md
│ │ ├── _index.md
│ │ └── util-linux
│ │ └── _index.md
│ ├── hugo
│ └── _index.md
├── data
├── i18n
├── layouts
│ ├── _default
│ │ ├── baseof.html
│ │ ├── list.html
│ │ └── single.html
│ └── shortcodes
│ └── insert-code.html
├── static
└── themes
21 directories, 19 files