commit ae167efd05653453c25257b6d09f6817b34b28d7 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Mon, 23 Nov 2026 21:35:41 +0300 first commit Diffstat:
| A | Makefile | | | 18 | ++++++++++++++++++ |
| A | contact-qr.sh | | | 53 | +++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 files changed, 71 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile @@ -0,0 +1,18 @@ +.POSIX: + +SH = sh +UPLOAD = ${HOME}/bin/upload +OUTPUT = adc + +all: ${OUTPUT}.vcf + +${OUTPUT}.vcf: contact-qr.sh + ${SH} contact-qr.sh + +upload: all + ${UPLOAD} ${OUTPUT}.vcf ${OUTPUT}.png ${OUTPUT}.svg + +clean: + rm -f ${OUTPUT}.vcf ${OUTPUT}.png ${OUTPUT}.svg + +.PHONY: all clean upload diff --git a/contact-qr.sh b/contact-qr.sh @@ -0,0 +1,53 @@ + +#!/bin/sh +set -eu + +# Contact information +FIRST_NAME="Anders" +LAST_NAME="Damsgaard" +TITLE="Team Lead" +ORG="GEUS: Geological Survey of Denmark and Greenland" + +PHONE="+4591333533" +EMAIL="andam@geus.dk" + +WEBSITE="https://andersdamsgaard.dk" +LINKEDIN="https://www.linkedin.com/in/anders-damsgaard-225075261/" + +OUTPUT="adc" + +# Verify dependency +if ! command -v qrencode >/dev/null 2>&1; then + echo "Error: qrencode is required" >&2 + exit 1 +fi + +# Generate vCard 3.0 +# CRLF line endings are required by the vCard format. +{ + printf 'BEGIN:VCARD\r\n' + printf 'VERSION:3.0\r\n' + printf 'N:%s;%s;;;\r\n' "$LAST_NAME" "$FIRST_NAME" + printf 'FN:%s %s\r\n' "$FIRST_NAME" "$LAST_NAME" + printf 'ORG:%s\r\n' "$ORG" + printf 'TITLE:%s\r\n' "$TITLE" + printf 'TEL;TYPE=WORK,CELL,VOICE:%s\r\n' "$PHONE" + printf 'URL;TYPE=WhatsApp:https://wa.me/%s\r\n' "${PHONE#+}" + printf 'EMAIL;TYPE=WORK:%s\r\n' "$EMAIL" + printf 'URL;TYPE=WORK:%s\r\n' "$WEBSITE" + printf 'URL;TYPE=LinkedIn:%s\r\n' "$LINKEDIN" + printf 'END:VCARD\r\n' +} > "${OUTPUT}.vcf" + +# Generate QR code +qrencode -t PNG -s 10 -m 4 -l M \ + -o "${OUTPUT}.png" < "${OUTPUT}.vcf" + +# Generate SVG for vector graphics +qrencode -t SVG -m 4 -l M \ + -o "${OUTPUT}.svg" < "${OUTPUT}.vcf" + +echo "Generated:" +echo " ${OUTPUT}.vcf" +echo " ${OUTPUT}.png" +echo " ${OUTPUT}.svg"