all repos — site @ 163f579a37089a9c320a7f7256da317bcc825b6c

source for my site, found at icyphox.sh

Create bin/commit.py

Adds the latest commit link to the sidebar. How useful is this? I dunno,
but it's cool.

Signed-off-by: Anirudh Oppiliappan <x@icyphox.sh>
Anirudh Oppiliappan x@icyphox.sh
Sat, 13 Jun 2020 17:51:03 +0530
commit

163f579a37089a9c320a7f7256da317bcc825b6c

parent

94925c0d31f56b0bd4ff9b566107ae6085d4d597

4 files changed, 77 insertions(+), 25 deletions(-)

jump to
A bin/commit.py

@@ -0,0 +1,52 @@

+#!/usr/bin/env python3 + +import jinja2 +import subprocess +from jinja2 import DebugUndefined +import sys + + +def jinja_render(commit, date, big_commit, tmpl): + template_loader = jinja2.FileSystemLoader("./") + env = jinja2.Environment(loader=template_loader, undefined=DebugUndefined) + try: + template = env.get_template(tmpl) + except jinja2.exceptions.TemplateNotFound: + print("error: template not found") + sys.exit(1) + + out = template.render(commit=commit, commit_date=date, big_commit=big_commit) + return out + + +def get_commit(): + out = subprocess.run( + ["git", "rev-parse", "--short", "HEAD"], + stdout=subprocess.PIPE) + commit = out.stdout.decode("utf-8").strip() + return commit + +def get_big_commit(): + out = subprocess.run( + ["git", "rev-parse", "HEAD"], + stdout=subprocess.PIPE + ) + big_commit = out.stdout.decode("utf-8").strip() + return big_commit + + +def get_commit_date(commit): + out = subprocess.run( + ["git", "show", "-s", "--format=%cd", "--date=short", commit], + stdout=subprocess.PIPE) + date = out.stdout.decode("utf-8").strip() + return date + + +if __name__ == "__main__": + commit = get_commit() + big_commit = get_big_commit() + date = get_commit_date(commit) + rendered = jinja_render(commit, date, big_commit, "build/index.html") + with open("build/index.html", "w") as f: + f.write(rendered)
M config.pyconfig.py

@@ -31,6 +31,12 @@ <br>

<a href="/static/gpg.txt">0x8A93F96F78C5D4C4</a> </p> + <p> + <span class="sidebar-link">last updated</span> + <br> + <a href="https://github.com/icyphox/site/commit/{{ big_commit }}">{{ commit }}</a> on {{ commit_date }} + </p> + <h3>friends</h3> <p> Some of <a href="/friends">my friends</a> and internet bros.

@@ -41,18 +47,16 @@ <p>

More <a href="/about">about me</a> and my work. </p> - <div class="license"> - <a href="https://liberapay.com/icyphox/donate"> - <img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"> - </a> - <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/"> + <div class="icons"> + <a href="https://creativecommons.org/licensjes/by-nc-sa/4.0/"> <img class="footimgs" src="/static/cc.svg"> </a> <a href="https://webring.xxiivv.com/#random" target="_blank"> <img class="footimgs" alt="xxiivv webring" src="/static/webring.svg"> </a> </div> + """ template = 'text.html' # default is index.html -pre_build = [['./bin/openring.py', '-j'], './bin/update_index.py'] -post_build = ['./bin/rss.py', './bin/plaintext.sh'] +pre_build = [['bin/openring.py', '-j'], 'bin/update_index.py'] +post_build = ['bin/rss.py', 'bin/plaintext.sh', 'bin/commit.py']
M static/style.cssstatic/style.css

@@ -39,8 +39,6 @@ background: var(--light-gray);

border-bottom: 1px solid var(--cyan); } - - .navbar { margin: 2px 0; }

@@ -259,13 +257,13 @@ border-radius: 5px;

} -.license a { +.icons a { color: unset; background: unset; border-bottom: unset; } -.license a:hover { +.icons a:hover { color: unset; background: unset; border-bottom: unset;

@@ -309,11 +307,11 @@ background-color: var(--sel);

color: white; } -.license img { +.icons img { all: initial; } -.license img { +.icons img { padding-left: 3%; padding-top: 10px; max-height: 2rem;
M templates/text.htmltemplates/text.html

@@ -48,15 +48,11 @@ <hr>

<div class="openring"> <div class="openring-feed"> - <h4><a href="https://jcs.org/2020/05/15/surface_go2">OpenBSD on the Microsoft Surface Go 2 (notaweblog)</a></h4> - <p>I used OpenBSD on the -original Surface Go -back in 2018 and many things worked with the big exception of the internal -Atheros WiFi. -This meant I had to keep it tethered to a USB-C dock for Ethernet or use -a small USB-A WiFi dongle plugged into a less-than-…</p> + <h4><a href="https://peppe.rs/posts/auto-currying_rust_functions/">Auto-currying Rust Functions</a></h4> + <p>This post contains a gentle introduction to procedural macros in Rust and a guide to writing a procedural macro to curry Rust functions. The source code for the entire library can be found here. It is also available on crates.io. +The following links might …</p> - <p>via <a href="https://jcs.org/">joshua stein</a> on May 15, 2020</p> + <p>via <a href="https://peppe.rs">nerdypepper's μblog</a> on May 09, 2020</p> </div>

@@ -71,11 +67,13 @@ </div>

<div class="openring-feed"> - <h4><a href="https://peppe.rs/posts/auto-currying_rust_functions/">Auto-currying Rust Functions</a></h4> - <p>This post contains a gentle introduction to procedural macros in Rust and a guide to writing a procedural macro to curry Rust functions. The source code for the entire library can be found here. It is also available on crates.io. -The following links might …</p> + <h4><a href="https://drewdevault.com/tls/security/oauth/2020/06/12/Can-we-talk-about-client-side-certs.html">Can we talk about client-side certificates?</a></h4> + <p>I’m working on improving the means by which API users authenticate with the +SourceHut API. Today, I was reading RFC 6749 (OAuth2) for this purpose, +and it got me thinking about the original OAuth spec. I recalled vaguely that it +had the API clients actuall…</p> - <p>via <a href="https://peppe.rs">nerdypepper's μblog</a> on May 09, 2020</p> + <p>via <a href="https://drewdevault.com">Drew DeVault's Blog</a> on Jun 12, 2020</p> </div>