Convert small projects to being loaded from YAML
This commit is contained in:
parent
39dc99cf00
commit
8e442f1007
5 changed files with 158 additions and 86 deletions
|
@ -8,6 +8,7 @@ import pygments
|
|||
import pygments.lexers
|
||||
import pygments.formatters
|
||||
import html
|
||||
import markupsafe
|
||||
|
||||
|
||||
class LevelAdjustingHTMLRenderer(mistune.HTMLRenderer):
|
||||
|
@ -95,6 +96,14 @@ def create(
|
|||
return r
|
||||
|
||||
|
||||
def new_simple_renderer():
|
||||
m = mistune.create_markdown(
|
||||
plugins=["strikethrough", "table", "url"],
|
||||
renderer=CustomHTMLRenderer(),
|
||||
)
|
||||
return lambda x: markupsafe.Markup(m(x)) # wrapping this way makes jinja2 treat it as safe content by default
|
||||
|
||||
|
||||
def render_toc_from_state(render_state: dict[str, Any], min_level: int = 1) -> str:
|
||||
# hilarious note: if you supply a raw filter object, this dies. hence the cast to list. see https://github.com/lepture/mistune/pull/407
|
||||
return mistune.toc.render_toc_ul(
|
||||
|
|
|
@ -5,6 +5,8 @@ import threading
|
|||
import yaml
|
||||
import jinja2
|
||||
import functools
|
||||
import markdown
|
||||
|
||||
|
||||
ERROR_LEADER = "[[red bold]FAIL[/bold red]] "
|
||||
WARN_LEADER = "[[yellow bold]WARN[/bold yellow]] "
|
||||
|
@ -54,6 +56,7 @@ def build_jinja_env(site_config: any) -> jinja2.Environment:
|
|||
|
||||
jinja_env.filters["absurl"] = functools.partial(get_absolute_url, site_config)
|
||||
jinja_env.filters["fmtdate"] = lambda x: x.strftime("%Y-%m-%d")
|
||||
jinja_env.filters["render_md"] = markdown.new_simple_renderer()
|
||||
|
||||
return jinja_env
|
||||
|
||||
|
@ -95,8 +98,6 @@ class DataLoader:
|
|||
self._base_path = Path(base_path)
|
||||
|
||||
def __getitem__(self, key):
|
||||
print(f"DataLoader.__getitem__(self, {key=})")
|
||||
|
||||
if key in self._store:
|
||||
return self._store[key]
|
||||
|
||||
|
|
70
site/content/projects/index.html
Normal file
70
site/content/projects/index.html
Normal file
|
@ -0,0 +1,70 @@
|
|||
---
|
||||
title: "Projects"
|
||||
description: "Some of the things I've been working on"
|
||||
---
|
||||
{% extends "_layouts/base.html" %}
|
||||
|
||||
{% block head %}
|
||||
<style>
|
||||
div.projects img {
|
||||
display: block;
|
||||
max-width: 70%;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% macro small_project_items(items) -%}
|
||||
{% for item in items %}
|
||||
<li>
|
||||
<strong>{{ item.title | safe }}</strong> ({{ item.date }})
|
||||
{% if item.text %}{{ item.text | render_md }}{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
{%- endmacro %}
|
||||
|
||||
{% block main %}
|
||||
<h1>Projects</h1>
|
||||
|
||||
<p>Here are some of the things I've been working on! You can see some bigger, long-standing projects I've got at the bottom or a running log of the smaller things I've been doing laterly.</p>
|
||||
|
||||
<h2>Smaller Things</h2>
|
||||
|
||||
<ul>
|
||||
{{ small_project_items(data.small_projects[:5]) }}
|
||||
</ul>
|
||||
|
||||
<details><summary>Click to see the rest of the log...</summary><ul>
|
||||
{{ small_project_items(data.small_projects[5:]) }}
|
||||
<li class="text--secondary">The log ends here!</li>
|
||||
</ul></details>
|
||||
|
||||
|
||||
<h2>Bigger Things</h2>
|
||||
|
||||
<div class="projects">
|
||||
|
||||
<ul>
|
||||
<li><a href="https://github.com/codemicro/adventOfCode">Advent of Code solutions</a><ul>
|
||||
<li>For years 2020 to 2023 inclusive</li>
|
||||
<li>Completed an average of 45 stars per year</li>
|
||||
</ul></li>
|
||||
<li><a href="https://github.com/CSSUoB/society-voting">society-voting</a><ul>
|
||||
<li>Project for my uni's computer science society to streamline committee elections</li>
|
||||
</ul></li>
|
||||
<li><a href="https://github.com/codemicro/walrss">Walrss</a><ul>
|
||||
<li>A RSS/Atom/JSONFeed email digest generator</li>
|
||||
<li><img src="walrss.png" alt="A screenshot of the Walrss web UI and an email digest that Walrss generates"></li>
|
||||
</ul></li>
|
||||
<li><a href="https://github.com/codemicro/railmiles">RailMiles</a><ul>
|
||||
<li>A DIY train journey tracker</li>
|
||||
<li>See also <a href="/blog/railmiles/">this blog post</a> (though the app has been substantially updated since writing)</li>
|
||||
<li><img src="railmiles.png" alt="A screenshot of RailMiles"></li>
|
||||
</ul></li>
|
||||
<li><a href="https://github.com/codemicro/cdmbar">cdmbar</a><ul>
|
||||
<li>A status bar for the i3 window manager</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,84 +0,0 @@
|
|||
---
|
||||
title: "Projects"
|
||||
description: "Some of the things I've been working on"
|
||||
---
|
||||
# Projects
|
||||
|
||||
Here are some of the things I've been working on! You can see some bigger, long-standing projects I've got at the bottom or a running log of the smaller things I've been doing laterly.
|
||||
|
||||
## Smaller Things
|
||||
|
||||
* **A couple small tweaks to society-voting** (2025-04-07)
|
||||
* Rewrote some of the layout for presenter mode and fixed a bug ([pr 1](https://github.com/CSSUoB/society-voting/pull/55), [pr 2](https://github.com/CSSUoB/society-voting/pull/56))
|
||||
* **Wrote some VBA in Excel** (2025-04-04)
|
||||
* Hacked an Excel spreadsheet around to make a quick little tool to use at work
|
||||
* Part of my job involves copying some data out of a Sharepoint database, formatting it and sending it on, which up until now was done manually.
|
||||
* This is trivial to automate with a Python script, but then there was interest from the rest of the team in using it - none of whom are particularly technically inclined (plus getting them to download and run a "random executable", ie. a Python interpreter, seems like a bit sketch)
|
||||
* So I rewrote it all in VBA and threw it in an Excel macro-enabled spreadsheet alongside a quick UI using some text boxes and buttons.
|
||||
* This was the best option considering the existing constraints around (not) sharing personal data and running random executables and also because it fitted fairly well in with out existing workflows.
|
||||
* Overall, not a horrendous experience. Fun to do something a bit different for a change.
|
||||
* **Hackathon Game** (2025-03-23)
|
||||
* Made a little game using PyGame at a hackathon - it's kinda like a cross between Papa's Pizzeria and Papers Please
|
||||
* Everything was built from scratch in 24 hours, including all the pixel art (thanks Nathan!!)
|
||||
* [Repo](https://git.tdpain.net/codemicro/birminghack-2025) 
|
||||
* **Small website tweaks** (2025-03-19)
|
||||
* Moved dependency management to `uv` and updated the Dockerfile to use that accordingly
|
||||
* Replaced a very outdated dependency on `pyinotify` in favour of `inotify` (this stopped me upgrading past Python 3.11 because they removed an API `pynotify` needed in 3.12)
|
||||
* Upgraded the generator's Python version to 3.14 (from 3.10 lol)
|
||||
* **Added a backlight block to [`cdmbar`](https://git.tdpain.net/codemicro/bar)** (2025-03-05)
|
||||
* **Small contributions to [MusicBrainz](https://musicbrainz.org)** (2025-02-26)
|
||||
* As well as correcting some data for other albums, I created [a record for a new release I purchased](https://musicbrainz.org/release-group/b17a7b47-189d-4598-8c55-24ecd6f261a9)
|
||||
* **Setting up [Navidrome](https://navidrome.org) and beginning to build out my music collection** (2025-02-21)
|
||||
* Lately I've been wanting to start building up my own library of music that I own and control and is of better quality than what you'd find on streaming services
|
||||
* I picked Navidrome to manage that collection, and provide a nice API to use it on clients across my devices
|
||||
* So far, so good! It's running on the newly-upgraded `wall-e` and I'm using [Copyparty](https://github.com/9001/copyparty) to upload files to be ingested into it along with [Feishin](https://github.com/jeffvli/feishin) and [Symfonium](https://www.symfonium.app/) as clients.
|
||||
* Listening to lossless FLACs compared to mashed streaming audio is like being enveloped in a warm embrace of rich sound that you never realised you were missing
|
||||
* **Moving `wall-e` to new hardware** (2025-02-15)
|
||||
* `wall-e` is my home server that I use to run Gitlab and some other file storage services. Historically, this has been run on a [ThinkCentre M73 Tiny](https://duckduckgo.com/?q=thinkcentre+m73+tiny&iax=images&ia=images) and that's been all well and good, but I was starting to need an upgrade on the 8GB of RAM and 256GB of storage.
|
||||
* I decided to upgrade to [a ThinkCentre M710s](./thinkcentre.jpg) and toss a terabyte of spinning rust in it - plus I now have actual DIMM slots to add more RAM and I get a slightly newer and faster CPU (we're now rocking a Intel i5-7400 @ 3.5GHz!) so big wins all round.
|
||||
* The only hitches I had were:
|
||||
* Taking about an hour to work out that I needed to switch the BIOS to use legacy boot because that's how the boot SSD that I was physically moving over was partitioned
|
||||
* Needing to edit `/etc/network/interfaces` to adjust for the new ethernet adapter name before I could connect to the internet
|
||||
* **[NowPlaying](https://git.tdpain.net/codemicro/now-playing)** (2025-02-14)
|
||||
* A teeny tiny web service to fetch your latest Spotify song and expose it as a basic API endpoint
|
||||
* This is used to power the "the last song I listened to on Spotify" thing on my homepage
|
||||
* **Switching [Walrss](https://github.com/codemicro/walrss) to use index-based feed filtering (and other improvements)** (2025-02-11)
|
||||
* Historically, Walrss has filtered feed items in the digests it generates using the time of each item, selecting only items that have been published since the last run.
|
||||
* This is unreliable since feed items do not always have an accurate date or any date at all - instead, it's best to use the feed item ID to remember what has been seen before and only send the new stuff down the wire, which is what Walrss now does.
|
||||
* **Moving all my services to use Postfix as an MTA** (2025-02-09)
|
||||
* I run quite a few services that send email, each of which has historically been set up to reach out to SMTP services like Fastmail and Sendgrid to send their mail.
|
||||
* This meant each service had its own API key and required a slightly annoying configuration process each time
|
||||
* Each of my servers now runs an instance of [Postfix in a Docker](https://git.tdpain.net/pkg/docker-postfix) container that accepts incoming mail from other containers and forwards it on to Fastmail.
|
||||
* Now, as opposed to having 8 different SMTP configurations littered about across multiple servers and email providers, I have 2 configurations, one per server, both pointing at Fastmail. Easy!
|
||||
* `The log begins here!`
|
||||
|
||||
## Bigger Things
|
||||
|
||||
<div class="projects">
|
||||
|
||||
* [Advent of Code solutions](https://github.com/codemicro/adventOfCode)
|
||||
* For years from 2020 to 2023 inclusive
|
||||
* Completed an average of 45 stars per year
|
||||
* [society-voting](https://github.com/CSSUoB/society-voting)
|
||||
* Project for my uni's computer science society to streamline committee elections
|
||||
* [Walrss](https://github.com/codemicro/walrss)
|
||||
* A RSS/Atom/JSONFeed email digest generator
|
||||

|
||||
* [RailMiles](https://github.com/codemicro/railmiles)
|
||||
* A DIY train journey tracker
|
||||
* See also [this blog post](/blog/railmiles/) (though the app has been substantially updated since writing)
|
||||

|
||||
* [cdmbar](https://github.com/codemicro/bar)
|
||||
* A status bar for the i3 window manager
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<style>
|
||||
/* forgive me for i have sinned by inserting styles in markdown files */
|
||||
div.projects img {
|
||||
display: block;
|
||||
max-width: 70%;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
</style>
|
76
site/data/small_projects.yml
Normal file
76
site/data/small_projects.yml
Normal file
|
@ -0,0 +1,76 @@
|
|||
- title: A couple small tweaks to society-voting
|
||||
date: 2025-04-07
|
||||
text: |
|
||||
* Rewrote some of the layout for presenter mode and fixed a bug ([pr 1](https://github.com/CSSUoB/society-voting/pull/55), [pr 2](https://github.com/CSSUoB/society-voting/pull/56))
|
||||
|
||||
- title: Wrote some VBA in Excel
|
||||
date: 2025-04-04
|
||||
text: |
|
||||
* Hacked an Excel spreadsheet around to make a quick little tool to use at work
|
||||
* Part of my job involves copying some data out of a Sharepoint database, formatting it and sending it on, which up until now was done manually.
|
||||
* This is trivial to automate with a Python script, but then there was interest from the rest of the team in using it - none of whom are particularly technically inclined (plus getting them to download and run a "random executable", ie. a Python interpreter, seems like a bit sketch)
|
||||
* So I rewrote it all in VBA and threw it in an Excel macro-enabled spreadsheet alongside a quick UI using some text boxes and buttons.
|
||||
* This was the best option considering the existing constraints around (not) sharing personal data and running random executables and also because it fitted fairly well in with out existing workflows.
|
||||
* Overall, not a horrendous experience. Fun to do something a bit different for a change.
|
||||
|
||||
- title: Hackathon Game
|
||||
date: 2025-03-23
|
||||
text: |
|
||||
* Made a little game using PyGame at a hackathon - it's kinda like a cross between Papa's Pizzeria and Papers Please
|
||||
* Everything was built from scratch in 24 hours, including all the pixel art (thanks Nathan!!)
|
||||
* [Repo](https://git.tdpain.net/codemicro/birminghack-2025) 
|
||||
|
||||
- title: Small website tweaks
|
||||
date: 2025-03-19
|
||||
text: |
|
||||
* Moved dependency management to `uv` and updated the Dockerfile to use that accordingly
|
||||
* Replaced a very outdated dependency on `pyinotify` in favour of `inotify` (this stopped me upgrading past Python 3.11 because they removed an API `pynotify` needed in 3.12)
|
||||
* Upgraded the generator's Python version to 3.14 (from 3.10 lol)
|
||||
|
||||
- title: Added a backlight block to cdmbar
|
||||
date: 2025-03-05
|
||||
text: |
|
||||
* [`cdmbar`](https://git.tdpain.net/codemicro/bar) is my DIY i3wm status bar.
|
||||
|
||||
- title: Small contributions to MusicBrainz
|
||||
date: 2025-02-26
|
||||
text: |
|
||||
* [MusicBrainz](https://musicbrainz.org) is basically Wikipedia for music.
|
||||
* As well as correcting some data for other albums, I created [a record for a new release I purchased](https://musicbrainz.org/release-group/b17a7b47-189d-4598-8c55-24ecd6f261a9)
|
||||
|
||||
- title: Setting up Navidrome and beginning to build out my music collection
|
||||
date: 2025-02-21
|
||||
text: |
|
||||
* Lately I've been wanting to start building up my own library of music that I own and control and is of better quality than what you'd find on streaming services
|
||||
* I picked [Navidrome](https://navidrome.org) to manage that collection, and provide a nice API to use it on clients across my devices
|
||||
* So far, so good! It's running on the newly-upgraded `wall-e` and I'm using [Copyparty](https://github.com/9001/copyparty) to upload files to be ingested into it along with [Feishin](https://github.com/jeffvli/feishin) and [Symfonium](https://www.symfonium.app/) as clients.
|
||||
* Listening to lossless FLACs compared to mashed streaming audio is like being enveloped in a warm embrace of rich sound that you never realised you were missing
|
||||
|
||||
- title: Moving <code>wall-e</code> to new hardware
|
||||
date: 2025-02-15
|
||||
text: |
|
||||
* `wall-e` is my home server that I use to run Gitlab and some other file storage services. Historically, this has been run on a [ThinkCentre M73 Tiny](https://duckduckgo.com/?q=thinkcentre+m73+tiny&iax=images&ia=images) and that's been all well and good, but I was starting to need an upgrade on the 8GB of RAM and 256GB of storage.
|
||||
* I decided to upgrade to [a ThinkCentre M710s](./thinkcentre.jpg) and toss a terabyte of spinning rust in it - plus I now have actual DIMM slots to add more RAM and I get a slightly newer and faster CPU (we're now rocking a Intel i5-7400 @ 3.5GHz!) so big wins all round.
|
||||
* The only hitches I had were:
|
||||
* Taking about an hour to work out that I needed to switch the BIOS to use legacy boot because that's how the boot SSD that I was physically moving over was partitioned
|
||||
* Needing to edit `/etc/network/interfaces` to adjust for the new ethernet adapter name before I could connect to the internet
|
||||
|
||||
- title: NowPlaying
|
||||
date: 2025-02-14
|
||||
text: |
|
||||
* [NowPlaying](https://git.tdpain.net/codemicro/now-playing) is a teeny tiny web service to fetch your latest Spotify song and expose it as a basic API endpoint
|
||||
* This is used to power the "the last song I listened to on Spotify" thing on my homepage
|
||||
|
||||
- title: Switching Walrss to use index-based feed filtering (and other improvements)
|
||||
date: 2025-02-11
|
||||
text: |
|
||||
* Historically, [Walrss](https://github.com/codemicro/walrss) has filtered feed items in the digests it generates using the time of each item, selecting only items that have been published since the last run.
|
||||
* This is unreliable since feed items do not always have an accurate date or any date at all - instead, it's best to use the feed item ID to remember what has been seen before and only send the new stuff down the wire, which is what Walrss now does.
|
||||
|
||||
- title: Moving all my services to use Postfix as an MTA
|
||||
date: 2025-02-09
|
||||
text: |
|
||||
* I run quite a few services that send email, each of which has historically been set up to reach out to SMTP services like Fastmail and Sendgrid to send their mail.
|
||||
* This meant each service had its own API key and required a slightly annoying configuration process each time
|
||||
* Each of my servers now runs an instance of [Postfix in a Docker](https://git.tdpain.net/pkg/docker-postfix) container that accepts incoming mail from other containers and forwards it on to Fastmail.
|
||||
* Now, as opposed to having 8 different SMTP configurations littered about across multiple servers and email providers, I have 2 configurations, one per server, both pointing at Fastmail. Easy!
|
Loading…
Add table
Add a link
Reference in a new issue