~mrp/markpenner.space

ed0d33fdf8a5e2277bb3dfa6c18fca7ba6e67ec1 — Mark Penner 10 months ago d3fd8be
initial commit
A .gitignore => .gitignore +2 -0
@@ 0,0 1,2 @@
.hugo_build.lock
public/*

A archetypes/default.org => archetypes/default.org +4 -0
@@ 0,0 1,4 @@
#+title: {{ replace .Name "-" " " | title }}
#+date: {{ .Date }}
#+draft: true
#+tags[]:

A config.toml => config.toml +8 -0
@@ 0,0 1,8 @@
baseURL = 'https://markpenner.space/'
cleanDestinationDir = true
languageCode = 'en-us'
title = 'markpenner.space'
[params]
  author = 'Mark Penner'
[taxonomies]
    tag = 'tags'

A content/_index.org => content/_index.org +18 -0
@@ 0,0 1,18 @@
#+title: Homepage
#+date: 2023-07-26T19:26:28-05:00
#+draft: false
#+tags[]:

* Projects
Mostly mirrored across:
- [[/gitweb][Self-hosted gitweb]]
- [[https://codeberg.org/mrp][Codeberg]]
- [[https://git.sr.ht/~mrp/][sourcehut]]
- [[https://gitlab.com/mrpenner][GitLab]]
GitHub I only use for forking projects already there.
- [[https://github.com/mrpenner][GitHub]]

** Other interests:

- [[https://www.openstreetmap.org/user/mrpenner][OpenStreetMap]]


A content/blog/_index.org => content/blog/_index.org +6 -0
@@ 0,0 1,6 @@
#+title: Blog
#+date: 2023-07-26T19:26:28-05:00
#+draft: false
#+tags[]:

* Mark Penner's Blog

A content/blog/btrfs-backups.org => content/blog/btrfs-backups.org +39 -0
@@ 0,0 1,39 @@
#+title: btrfs backup scripts
#+date: 2023-07-26T19:26:28-05:00
#+draft: true
#+tags[]: btrfs backups

* btrfs backup scripts using send/receive

#+begin_quote
  "BTRFS is a modern copy on write (COW) filesystem for Linux aimed at
  implementing advanced features while also focusing on fault tolerance,
  repair and easy
  administration."[[https://btrfs.readthedocs.io/en/latest/Introduction.html][ref]]
#+end_quote

If you're not familiar with btrfs, you can read about it
[[https://btrfs.readthedocs.io/en/latest/Introduction.html][here]]. I'll
document here how I have been using btrfs send/receive as a backup
system. You could of course type the commands out each time, but it's
easier and less error-prone to write a script.

We'll start with backing up a subvolume on a local drive to another
local drive. First we need to transfer a full snapshot like so:

#+begin_src sh
#!/usr/bin/bash -e

last_snapshot_name=/.snapshots/home-last
snapshot_name=/.snapshots/home_$(date +%Y-%m-%dT%H%M)

sudo btrfs subvolume snapshot -r /home "$snapshot_name"

echo "sending..."
sudo btrfs send "$snapshot_name" | sudo btrfs receive /media/mark/fbcba1d8-6799-40a1-a703-34f2a375e157/snapshots/

echo "renaming this snapshot"
sudo mv "$snapshot_name" "$last_snapshot_name"

echo "done."
#+end_src

A content/blog/first-post.org => content/blog/first-post.org +40 -0
@@ 0,0 1,40 @@
#+title: First Post
#+date: 2023-07-25T21:50:01-05:00
#+draft: true
#+tags[]: blog website

* First Post

2022-07-02

I often find myself reading other people's blogs to find out how they
accomplished something technical. Sometimes, I find things have changed
since that post was written, or what I want to accomplish is slightly
different from what they did, so I thought in those cases maybe I should
write down what worked for me. I would like something that I could look
back at to remind myself what I did, and it's possible someone else
might find it useful also.

The obvious thing to do then, would be to pick a static site generator
(SSG) from the [[https://jamstack.org/generators/][many options]]. As I
looked at the different SSGs and their approaches, I had the sensation
of following a path many others had travelled before me. I couldn't find
an SSG that I really liked, and I thought "how hard could it be to write
my own?", which I suspect is how many of the options were started. The
basic idea is quite simple, write your content in Markdown or whatever
you prefer and use a parser and templating system to generate HTML for
you. Of course many SSGs can do much more than that, which is part of
what I didn't like about them. I thought if I needed to learn a magic
abstraction layer anyway, I might as well write my own that didn't have
all the extra magic that I didn't need.

Since there were many general purpose options already, and I only wanted
to generate my own website and blog, I decided to start with a simple
Python script that I would keep alongside the website source files.
Markdown parsing is provided by
[[https://github.com/miyuchina/mistletoe][mistletoe]]. I chose
[[https://mustache.github.io/][Mustache]] for the templates, using the
library [[https://github.com/PennyDreadfulMTG/pystache][pystache]]. I'll
see how it goes, maybe I'll decide at some point to just use a
mainstream SSG, but so far this is fun! Website source can be found
[[https://markpenner.space/gitweb/markpenner.space.git][here]].

A layouts/_default/baseof.html => layouts/_default/baseof.html +15 -0
@@ 0,0 1,15 @@
<!doctype html>
<html lang="en-us">
<head>
{{ partial "meta.html" . }}
</head>

<body>
{{ partial "header.html" }}

{{ block "main" . }}
{{ end }}

{{ partial "footer.html" }}
</body>
</html>

A layouts/_default/index.html => layouts/_default/index.html +5 -0
@@ 0,0 1,5 @@
{{ define "main" }}
<main>
  {{ .Content }}
</main>
{{ end }}

A layouts/_default/list.html => layouts/_default/list.html +14 -0
@@ 0,0 1,14 @@
{{ define "main" }}
<main>
  <article>
    {{ .Content }}
  </article>
  <ul>
    {{ range .Pages }}
      <li>
        <a href="{{ .Permalink }}">{{ .Date.Format "2006-01-02" }} - {{ .Title }}</a>
      </li>
    {{ end }}
  </ul>
</main>
{{ end }}

A layouts/_default/single.html => layouts/_default/single.html +5 -0
@@ 0,0 1,5 @@
{{ define "main" }}
<main>
  {{ .Content }}
</main>
{{ end }}

A layouts/partials/footer.html => layouts/partials/footer.html +5 -0
@@ 0,0 1,5 @@
<footer>
  <hr>
  <p>&copy; {{ now.Year }} {{ site.Params.Author }}<br />
  This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.</p>
</footer>

A layouts/partials/header.html => layouts/partials/header.html +6 -0
@@ 0,0 1,6 @@
<header>
    <nav>
    <a href="/">{{ site.Title }}</a> | <a href="/blog">blog</a>
    </nav>
    <hr>
</header>

A layouts/partials/meta.html => layouts/partials/meta.html +4 -0
@@ 0,0 1,4 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" href="/styles.css" />
<title>{{ .Page.Title }}</title>

A static/styles.css => static/styles.css +43 -0
@@ 0,0 1,43 @@
:root {
  background-color: gainsboro;
  color: black;
}

a {
  outline: none;
}
a:link {
  color: darkgreen;
}
a:visited {
  color: darkslateblue;
}
a:focus,
a:hover {
  text-decoration: none;
  background: lightgray;
}
a:active {
  color: red;
}

header {
  text-align: left;
}
body {
  width: device-width;
  max-width: 50em;
  margin: 0 auto;
  font-family: sans-serif;
}
table {
  margin-left: auto;
  margin-right:auto;
  border-collapse: collapse;
}
tr {
  border-bottom: 1px dotted;
}
footer {
  text-align: center;
}