summaryrefslogtreecommitdiff
path: root/personal/cv/add-personal-info.sh
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2019-12-07 19:58:25 +0100
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2019-12-07 20:29:31 +0100
commitdf679d9a57c218deeaac64e63be658d6b783e1d6 (patch)
treeeb91f0235890e37abc13882f9b7e325570f340d3 /personal/cv/add-personal-info.sh
parente470dab312b37d21dd27755e4bf4b815e6380f02 (diff)
downloadmemory-leaks-df679d9a57c218deeaac64e63be658d6b783e1d6.tar.xz
Add "CV" """infrastructure"""
The phone and e-mail emojis take 2 columns when displayed, but I don't think Pandoc has any way to know that when parsing tables (unless there is some Unicode metadata marking those glyphs as wider than normal).
Diffstat (limited to 'personal/cv/add-personal-info.sh')
-rwxr-xr-xpersonal/cv/add-personal-info.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/personal/cv/add-personal-info.sh b/personal/cv/add-personal-info.sh
new file mode 100755
index 0000000..2e9ea8b
--- /dev/null
+++ b/personal/cv/add-personal-info.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+set -eu
+
+input=$1; output=$2
+cp ${input} ${output}
+
+. personal-info
+
+fullname=$(getent passwd $(whoami) | cut -d: -f5 | cut -d, -f1)
+sed -i s/INSERT-FULLNAME-HERE/"${fullname}"/ ${output}
+
+# On the one hand, anyone can compute my age from my birth date. On
+# the other hand, wasting reader brain cycles on this computation
+# sounds kind of rude. On the gripping hand, having to bump my age
+# manually every year would be silly. Clearly the way forward is to
+# summon the powers of bash, date, bc and sed to save us the trouble.
+
+birthstamp=$(date -d "${birthday}" +%s)
+now=$(date +%s)
+age=$(bc <<< "(${now}-${birthstamp})/(3600*24*365.25)")
+sed -i s/INSERT-BIRTHDATE-HERE/"${birthday} (${age})"/ ${output}
+
+sed -i s/INSERT-LOCATION-HERE/"${location}"/ ${output}
+
+sed -i s/INSERT-PHONE-HERE/"${phone_number}"/ ${output}
+
+# Set by .profile and/or .xsessionrc.
+sed -i s/INSERT-MAIL-HERE/${EMAIL}/ ${output}