Skip to content

Instantly share code, notes, and snippets.

@observer
Created March 29, 2021 00:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save observer/b9fe7de1bd4de2392c4f62ad368fe38e to your computer and use it in GitHub Desktop.
Save observer/b9fe7de1bd4de2392c4f62ad368fe38e to your computer and use it in GitHub Desktop.
shell.nix and config.yml of https://oblivious.observer
baseURL: "https://oblivious.observer"
title: oblivious observer
paginate: 10
theme: hugo-theme-papermod
enableRobotsTXT: true
buildDrafts: false
buildFuture: false
buildExpired: false
minify:
disableXML: true
minifyOutput: true
params:
env: production # to enable google analytics, opengraph, twitter-cards and schema.
title: oblivious.observer
description: "a blog"
author: Me
# author: ["Me", "You"] # multiple authors
images: ["<link or path of image for opengraph, twitter-cards>"]
defaultTheme: auto # dark, light
disableThemeToggle: false
ShowReadingTime: true
ShowShareButtons: false
disableSpecial1stPost: false
comments: true
hidemeta: false
showtoc: true
tocopen: false
assets:
# disableHLJS: true # to disable highlight.js
# disableFingerprinting: true
favicon: "/observer-16x16.png"
favicon16x16: "/observer-16x16.png"
favicon32x32: "/observer-32x32.png"
apple_touch_icon: "/observer-512x512.png"
safari_pinned_tab: "/observer-512x512.png"
label:
text: " "
icon: /observer-64x64.png
iconHeight: 35
# profile-mode
profileMode:
enabled: true # needs to be explicitly set
title: Oblivious Observer
subtitle: "simply a tech block.."
imageUrl: "/observer-256x256.png"
imageWidth: 120
imageHeight: 120
imageTitle:
buttons:
- name: Posts
url: posts
- name: Tags
url: tags
- name: Archive
url: archives
- name: Search
url: search
# home-info mode
homeInfoParams:
Title: "Hi there"
Content: just a tech block..
socialIcons:
- name: github
url: "https://github.com/observer"
- name: rss
url: "/index.xml"
- name: email
url: "https://gist.githubusercontent.com/observer/3dd19a1d00fa068959aab8b3e8892da6/raw/6b88ca111e3463d97487b1cb5c98823f8b7c2b7c/email"
- name: gpg
url: "https://gist.githubusercontent.com/observer/cf56d8fdfa7a86558bbfdf822859984f/raw/0c602c8c210b6791a6f56f73e0761bb336c9e83a/pubkey"
- name: about
url: "https://gist.githubusercontent.com/observer/a3e52d3c547eeccda5ac4d56a7b96a1b/raw/dc840202b756cb78d12fa6808744ef739e3ab67c/about"
cover:
hidden: true # hide everywhere but not in structured data
hiddenInList: true # hide on list pages and home
hiddenInSingle: true # hide on single page
# for search
# https://fusejs.io/api/options.html
fuseOpts:
isCaseSensitive: false
shouldSort: true
location: 0
distance: 1000
threshold: 0.4
minMatchCharLength: 0
keys: ["title", "permalink", "summary", "content"]
outputs:
home:
- HTML
- RSS
- JSON # is necessary
menu:
main:
# - identifier: categories
# name: categories
# url: /categories/
# weight: 10
- identifier: search
name: search
url: /search/
weight: 17
- identifier: posts
name: posts
url: /posts/
weight: 18
- identifier: archive
name: archive
url: /archives/
weight: 19
- identifier: tags
name: tags
url: /tags/
weight: 20
- identifier: about
name: about
url: /index.html
weight: 21
- identifier: rss
name: rss
url: /index.xml
weight: 22
# - identifier: example
# name: example.org
# url: https://example.org
# weight: 30
# Read: https://github.com/adityatelange/hugo-PaperMod/wiki/FAQs#using-hugos-syntax-highlighter-chroma
# pygmentsUseClasses: true
# markup:
# highlight:
# # anchorLineNos: true
# codeFences: true
# guessSyntax: true
# lineNos: true
# style: monokai
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
observer-16x16 = ''
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9
kT1Iw0AYht+mikUqCnYQcchQXbQgKuKoVShChVArtOpgcukfNGlIUlwcBdeCgz+LVQcXZ10dXAVB
8AfEydFJ0UVK/C4ptIjxjuMe3vvel7vvAKFeZprVMQ5oum2mEnExk10Vu14RQh/NUYgys4w5SUrC
d3zdI8D3uxjP8q/7c/SoOYsBAZF4lhmmTbxBPL1pG5z3iSOsKKvE58RjJl2Q+JHrisdvnAsuCzwz
YqZT88QRYrHQxkobs6KpEU8RR1VNp3wh47HKeYuzVq6y5j35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Wq0WAA8PD1VuLftGo4Hv+1j/+51/Agiw
QFrcT1GrAAAAAElFTkSuQmCC
'';
hugo-theme-papermod = runCommand "hugo-theme-papermod" {
pinned = builtins.fetchTarball {
name = "hugo-theme-papermod"; # Store path name
url = https://github.com/adityatelange/hugo-PaperMod/archive/master.tar.gz;
sha256 = "0b8m1n2vn29mmgc9l2jpw9aiqbixh4nihsw0h43b04qwzh22ngaj"; # Hash obtained using `nix-prefetch-url --unpack <url>`
};
patches = [];
preferLocalBuild = true;
}
''
cp -r $pinned $out
chmod -R u+w $out
for p in $patches; do
echo "Applying patch $p"
patch -d $out -p1 < "$p"
done
'';
in
mkShell {
buildInputs = [
hugo imagemagick
];
shellHook = ''
# let's define an alias to release the blog content. However since
# bash aliases do not support parameters, lets use a function instead
release() {
if [ "$1" == "the" ] && [ "$2" == "kraken" ]; then
cd ~/blog
for f in $(find -L public/ | grep '.sig$'); do
rm $f
done
hugo
for f in $(find -L public/ | grep -v ".git"); do
if ! [ -d "$f" ]; then
gpg -u 48A1CC122B2B6E37FDA4B7B474344F2BCE39AA5D --output $f.sig --detach-sig $f
fi
done
cd -
else
echo '
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▄▄███░░░░░
░░▄▄░░░░░░░░░░░░░░░░░░░░░░░░░███████░░░░
░░███▄░░░░░░░░░░░░░░░░░░░░░▄█████▀░█░░░░
░░▀█████▄▄▄▄▀▀▀▀▀▀▀▀░▄▄▄▄▄███▀▀░▀███░░░░
░░░░███▀▀░░░░░░░░░░░░░░▀▀▀███░░░░██▀░░░░
░░░░██░░░░░░▄░░░░░░░░░░░░░░░▀▀▄▄███░░░░░
░░░░▄█▄▄████▀█░█▄██▄▄░░░░░░░░░████▀░░░░░
░░░▄████████░░░██████▄▄▄▄░░░░░████░░░░░░
░░░███░█░▀██░░░▀███░█░░███▄▄░░░░▀█░░░░░░
░░░████▄███▄▄░░░███▄▄▄█████▀░░░░░██░░░░░
░░▄████▀▀░▀██▀░░░▀█████████░░░░░░██░░░░░
░░▀███░░░▄▄▀▀▀▄▄░░░░▀██████░░░░░░░█░░░░░
░░░███░░█░░░░░░░▀░░░░▀███▀░░░░░░░░█░░░░░
░░░████▄▀░░░░░░░░▀░░░████▄░░░░░░░░░█░░░░
░░░██████▄░░░░░░░░░▀▀████▀░░░░░░░░░█░░░░
░░▄█████████▀▀▀▀░░░░░░░░░░░░░░░░░░░▀█░░░
░░███████████▄▄▄▄░░░░░░░░░░░░░░░░░░░█▄░░
░░████████▀▀▀▀▀▀░░░░░░░░░░░░░░░░░░░░░█▄░
░░████████▄▄░░░░░░░░░░░░░░░░░░░░░░░░░░█░
░▄███████▄▄░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
░▀▀▀▀▀▀▀▀▀█▀▀▀░░░░░░░░░░░░░░░░░░░░░░░░░█
NOPE.. use them correct words human..
'
fi
}
publish() {
if [ "$1" == "all" ] && [ "$2" == "the" ] && [ "$2" == "things" ]; then
cd ~/blog/public
git add .
git commit -m "$(date '+%s' | perl -lpe '$_=join " ", unpack"(B8)*"')"
ssh-agent bash -c 'ssh-add - <<< $(pass oblivious.observer/github/ssh-key-pair | grep -v "ssh-ed25519"); git push'
cd -
else
echo '
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▄▄███░░░░░
░░▄▄░░░░░░░░░░░░░░░░░░░░░░░░░███████░░░░
░░███▄░░░░░░░░░░░░░░░░░░░░░▄█████▀░█░░░░
░░▀█████▄▄▄▄▀▀▀▀▀▀▀▀░▄▄▄▄▄███▀▀░▀███░░░░
░░░░███▀▀░░░░░░░░░░░░░░▀▀▀███░░░░██▀░░░░
░░░░██░░░░░░▄░░░░░░░░░░░░░░░▀▀▄▄███░░░░░
░░░░▄█▄▄████▀█░█▄██▄▄░░░░░░░░░████▀░░░░░
░░░▄████████░░░██████▄▄▄▄░░░░░████░░░░░░
░░░███░█░▀██░░░▀███░█░░███▄▄░░░░▀█░░░░░░
░░░████▄███▄▄░░░███▄▄▄█████▀░░░░░██░░░░░
░░▄████▀▀░▀██▀░░░▀█████████░░░░░░██░░░░░
░░▀███░░░▄▄▀▀▀▄▄░░░░▀██████░░░░░░░█░░░░░
░░░███░░█░░░░░░░▀░░░░▀███▀░░░░░░░░█░░░░░
░░░████▄▀░░░░░░░░▀░░░████▄░░░░░░░░░█░░░░
░░░██████▄░░░░░░░░░▀▀████▀░░░░░░░░░█░░░░
░░▄█████████▀▀▀▀░░░░░░░░░░░░░░░░░░░▀█░░░
░░███████████▄▄▄▄░░░░░░░░░░░░░░░░░░░█▄░░
░░████████▀▀▀▀▀▀░░░░░░░░░░░░░░░░░░░░░█▄░
░░████████▄▄░░░░░░░░░░░░░░░░░░░░░░░░░░█░
░▄███████▄▄░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
░▀▀▀▀▀▀▀▀▀█▀▀▀░░░░░░░░░░░░░░░░░░░░░░░░░█
NOPE.. use them correct words human..
'
fi
}
mkdir -p themes
ln -snf "${hugo-theme-papermod}" themes/hugo-theme-papermod
mkdir -p static
for size in 16x16 32x32 64x64 128x128 256x256 512x512; do
echo '${observer-16x16}' | base64 -d | convert - -filter point -resize $size static/observer-$size.png
done
# add the font awesome fingerprint icon as gpg icon (source: https://fontawesome.com/icons/fingerprint)
# also add the address card icon as about icon (source: https://fontawesome.com/icons/address-card)
mkdir -p layouts/partials
sed '/^{{- else if $icon_name -}}.*/i{{- else if (eq $icon_name "gpg") -}}\n\<svg aria-hidden\=\"true\" focusable\=\"false\" data-prefix\=\"fas\" data-icon\=\"fingerprint\" class\=\"svg-inline--fa fa-fingerprint fa-w-16\" role\=\"img\" xmlns\=\"http:\/\/www.w3.org\/2000\/svg\" viewBox\=\"0 0 512 512\"\>\<path fill\=\"currentColor\" d\=\"M256.12 245.96c-13.25 0-24 10.74-24 24 1.14 72.25-8.14 141.9-27.7 211.55-2.73 9.72 2.15 30.49 23.12 30.49 10.48 0 20.11-6.92 23.09-17.52 13.53-47.91 31.04-125.41 29.48-224.52.01-13.25-10.73-24-23.99-24zm-.86-81.73C194 164.16 151.25 211.3 152.1 265.32c.75 47.94-3.75 95.91-13.37 142.55-2.69 12.98 5.67 25.69 18.64 28.36 13.05 2.67 25.67-5.66 28.36-18.64 10.34-50.09 15.17-101.58 14.37-153.02-.41-25.95 19.92-52.49 54.45-52.34 31.31.47 57.15 25.34 57.62 55.47.77 48.05-2.81 96.33-10.61 143.55-2.17 13.06 6.69 25.42 19.76 27.58 19.97 3.33 26.81-15.1 27.58-19.77 8.28-50.03 12.06-101.21 11.27-152.11-.88-55.8-47.94-101.88-104.91-102.72zm-110.69-19.78c-10.3-8.34-25.37-6.8-33.76 3.48-25.62 31.5-39.39 71.28-38.75 112 .59 37.58-2.47 75.27-9.11 112.05-2.34 13.05 6.31 25.53 19.36 27.89 20.11 3.5 27.07-14.81 27.89-19.36 7.19-39.84 10.5-80.66 9.86-121.33-.47-29.88 9.2-57.88 28-80.97 8.35-10.28 6.79-25.39-3.49-33.76zm109.47-62.33c-15.41-.41-30.87 1.44-45.78 4.97-12.89 3.06-20.87 15.98-17.83 28.89 3.06 12.89 16 20.83 28.89 17.83 11.05-2.61 22.47-3.77 34-3.69 75.43 1.13 137.73 61.5 138.88 134.58.59 37.88-1.28 76.11-5.58 113.63-1.5 13.17 7.95 25.08 21.11 26.58 16.72 1.95 25.51-11.88 26.58-21.11a929.06 929.06 0 0 0 5.89-119.85c-1.56-98.75-85.07-180.33-186.16-181.83zm252.07 121.45c-2.86-12.92-15.51-21.2-28.61-18.27-12.94 2.86-21.12 15.66-18.26 28.61 4.71 21.41 4.91 37.41 4.7 61.6-.11 13.27 10.55 24.09 23.8 24.2h.2c13.17 0 23.89-10.61 24-23.8.18-22.18.4-44.11-5.83-72.34zm-40.12-90.72C417.29 43.46 337.6 1.29 252.81.02 183.02-.82 118.47 24.91 70.46 72.94 24.09 119.37-.9 181.04.14 246.65l-.12 21.47c-.39 13.25 10.03 24.31 23.28 24.69.23.02.48.02.72.02 12.92 0 23.59-10.3 23.97-23.3l.16-23.64c-.83-52.5 19.16-101.86 56.28-139 38.76-38.8 91.34-59.67 147.68-58.86 69.45 1.03 134.73 35.56 174.62 92.39 7.61 10.86 22.56 13.45 33.42 5.86 10.84-7.62 13.46-22.59 5.84-33.43z\"\>\<\/path\>\<\/svg\>\n{{- else if (eq $icon_name "about") -}}\n\<svg aria-hidden\=\"true\" focusable\=\"false\" data-prefix\=\"far\" data-icon\=\"address-card\" class\=\"svg-inline--fa fa-address-card fa-w-18\" role\=\"img\" xmlns\=\"http:\/\/www.w3.org\/2000\/svg\" viewBox\=\"0 0 576 512\"\>\<path fill\=\"currentColor\" d\=\"M528 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h480c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm0 400H48V80h480v352zM208 256c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm-89.6 128h179.2c12.4 0 22.4-8.6 22.4-19.2v-19.2c0-31.8-30.1-57.6-67.2-57.6-10.8 0-18.7 8-44.8 8-26.9 0-33.4-8-44.8-8-37.1 0-67.2 25.8-67.2 57.6v19.2c0 10.6 10 19.2 22.4 19.2zM360 320h112c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8H360c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8zm0-64h112c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8H360c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8zm0-64h112c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8H360c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8z\"\>\<\/path\>\<\/svg\>' themes/hugo-theme-papermod/layouts/partials/svg.html > layouts/partials/svg.html
sed '/<footer/,/<\/footer/d' themes/hugo-theme-papermod/layouts/partials/footer.html > layouts/partials/footer.html
# create the utterances.json file:
cat << EOF > ~/blog/public/utterances.json
{
"origins": [
"https://oblivious.observer",
"https://observer.github.io"
]
}
EOF
cat << EOF > ~/blog/layouts/partials/comments.html
<!-- Comments area start -->
<script src=https://utteranc.es/client.js
repo=observer/observer.github.io
issue-term=url
label=💬
theme=photon-dark
crossorigin=anonymous
async>
</script>
<!-- Comments area end -->
EOF
mkdir -p ~/blog/public
cat << EOF > ~/blog/public/CNAME
oblivious.observer
EOF
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment