Moved back to templates for page content to remove JS dependency
This commit is contained in:
parent
796a481ab2
commit
4cfe1ebae1
35 changed files with 524 additions and 287 deletions
|
|
@ -1,8 +1,8 @@
|
|||
id: mfn
|
||||
title: A Mind for Numbers
|
||||
date_created: 2021-02-05
|
||||
date_last_updated: 2021-02-05
|
||||
description: Thoughts on A Mind for Numbers by Barbara Oakley
|
||||
previous: sdl
|
||||
next: afh
|
||||
date: 2021-02-05
|
||||
---
|
||||
<h2>
|
||||
A Mind for Numbers
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
id: deepwork
|
||||
title: Deep Work
|
||||
date_created: 2021-02-27
|
||||
date_last_updated: 2021-02-27
|
||||
description: Thoughts on Deep Work by Cal Newport
|
||||
previous: ewt
|
||||
next: habits
|
||||
date: 2021-02-27
|
||||
---
|
||||
<h2>
|
||||
Deep Work
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
id: mop
|
||||
title: The Myth of Perfection
|
||||
previous: onreading
|
||||
previous: thestart
|
||||
next: foundation
|
||||
date: 2021-01-15
|
||||
---
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
id: thestart
|
||||
title: The Start
|
||||
next: onreading
|
||||
next: mop
|
||||
date: 2021-01-01
|
||||
---
|
||||
<h2>
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
id: blog
|
||||
title: Blog
|
||||
date_created: 2020-01-01
|
||||
date_last_updated: 2021-05-01
|
||||
description: Chronological articles
|
||||
---
|
||||
<ul class="no-bul" hx-trigger="load" hx-get="/api/articles">
|
||||
</ul>
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
id: gifts
|
||||
title: Gifts
|
||||
date_created: 2024-07-01
|
||||
date_last_updated: 2024-07-01
|
||||
description: Getting me gifts
|
||||
---
|
||||
<h2>Gifts</h2>
|
||||
<p>
|
||||
If you are here you are probably thinking of getting me a gift.
|
||||
I do very deeply appreciate it and thank you for the thought.
|
||||
</p>
|
||||
<p>
|
||||
I am not much of a receiving gift person.
|
||||
I don't like having a lot of things and am quite particular about what I do get.
|
||||
I would much rather spend time together.
|
||||
If you can spare the time to sit down and have a nice conversation or do something together that would be wonderful.
|
||||
</p>
|
||||
<p>
|
||||
There are a few people in my life that I think are an exception to this rule.
|
||||
If you are one of these people you know it and I say do whatever you see fit.
|
||||
Otherwise if you feel that you must give me something I would suggest cash.
|
||||
Not sure what I will use it for but there are always various things that I am eyeing, usually larger purchases.
|
||||
I will certainly let you know what use it went to.
|
||||
</p>
|
||||
<p>
|
||||
Regardless, thank you so much, I really appreciate it.
|
||||
</p>
|
||||
<p>
|
||||
Awstin
|
||||
</p>
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
id: links
|
||||
title: Links
|
||||
date_created: 2024-08-13
|
||||
date_last_updated: 2024-08-13
|
||||
description: Interesting links
|
||||
---
|
||||
<h2>Links</h2>
|
||||
<p>
|
||||
A collection of links to interesting posts that I have found.
|
||||
In a random order to shuffle what links are at the top.
|
||||
</p>
|
||||
<ul class="no-bul" hx-trigger="load" hx-get="/api/articlelinks">
|
||||
</ul>
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ pub struct Link {
|
|||
pub id: i32,
|
||||
pub url: String,
|
||||
pub description: Option<String>,
|
||||
pub title: Option<String>,
|
||||
pub title: String,
|
||||
pub author: String,
|
||||
pub link_type: LinkType,
|
||||
pub date_added: Date,
|
||||
|
|
@ -59,7 +59,7 @@ impl Link {
|
|||
Link {
|
||||
id: 0,
|
||||
url: url.unwrap(),
|
||||
title,
|
||||
title: title.unwrap(),
|
||||
author: author.unwrap(),
|
||||
date_added: date_added.unwrap(),
|
||||
link_type: link_type.unwrap(),
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use std::{
|
|||
};
|
||||
|
||||
pub mod article;
|
||||
pub mod page;
|
||||
pub mod link;
|
||||
|
||||
pub async fn establish_connection() -> Result<PgPool, Box<dyn Error>> {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
use crate::database::{article::Article, PsqlData};
|
||||
use askama::Template;
|
||||
use axum::{
|
||||
extract::{Extension, Path},
|
||||
http::StatusCode,
|
||||
|
|
@ -9,7 +8,10 @@ use axum::{
|
|||
use sqlx::PgPool;
|
||||
use std::{collections::HashMap, error::Error};
|
||||
|
||||
use super::{get_page, AppState, ArticleTemplate, HtmlTemplate};
|
||||
use super::{
|
||||
templates::{ArticleTemplate, BlogFooterTemplate, BlogTemplate, HtmlTemplate},
|
||||
AppState,
|
||||
};
|
||||
|
||||
pub fn get_router() -> Router {
|
||||
Router::new()
|
||||
|
|
@ -17,15 +19,14 @@ pub fn get_router() -> Router {
|
|||
.route("/:article", get(article))
|
||||
}
|
||||
|
||||
async fn blog(state: Extension<AppState>) -> Result<impl IntoResponse, StatusCode> {
|
||||
get_page(&state.db, "blog").await
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "blog_footer.html")]
|
||||
struct BlogFooterTemplate {
|
||||
previous: String,
|
||||
next: String,
|
||||
async fn blog(state: Extension<AppState>) -> impl IntoResponse {
|
||||
let blog_page = BlogTemplate {
|
||||
articles: match get_articles_date_sorted(&state.db).await {
|
||||
Ok(list) => list,
|
||||
Err(_) => Vec::new(),
|
||||
}
|
||||
};
|
||||
HtmlTemplate(blog_page)
|
||||
}
|
||||
|
||||
async fn article(
|
||||
|
|
@ -55,22 +56,12 @@ async fn article(
|
|||
Ok(HtmlTemplate(template))
|
||||
}
|
||||
|
||||
pub async fn get_articles_as_links_list(pool: &PgPool) -> Result<Vec<String>, Box<dyn Error>> {
|
||||
pub async fn get_articles_date_sorted(pool: &PgPool) -> Result<Vec<Article>, Box<dyn Error>> {
|
||||
let mut articles: Vec<Article> = match Article::read_all(pool).await {
|
||||
Ok(a) => a.iter().map(|x| *x.clone()).collect(),
|
||||
Err(_) => Vec::new(),
|
||||
};
|
||||
|
||||
articles.sort_by(|a, b| b.date.cmp(&a.date));
|
||||
|
||||
let list: Vec<String> = articles
|
||||
.iter()
|
||||
.map(|article| {
|
||||
format!(
|
||||
"<li><a href=\"/blog/{}\">{}</a></li>",
|
||||
article.reference, article.title
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
Ok(list)
|
||||
Ok(articles)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,27 +1,47 @@
|
|||
use axum::{
|
||||
extract::{Extension, Path},
|
||||
http::StatusCode,
|
||||
response::IntoResponse,
|
||||
routing::{get, Router},
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
|
||||
use super::{get_page, AppState};
|
||||
use super::templates::{
|
||||
ArchServerTemplate,
|
||||
BooksTemplate,
|
||||
EdgeDetectionTemplate,
|
||||
GardenTemplate,
|
||||
HtmlTemplate,
|
||||
TakTemplate,
|
||||
};
|
||||
|
||||
pub fn get_router() -> Router {
|
||||
Router::new()
|
||||
.route("/", get(garden))
|
||||
.route("/:page", get(page))
|
||||
.route("/ed", get(edge_detection))
|
||||
.route("/books", get(books))
|
||||
.route("/tak", get(tak))
|
||||
.route("/archserver", get(arch_server))
|
||||
}
|
||||
|
||||
async fn garden(state: Extension<AppState>) -> Result<impl IntoResponse, StatusCode> {
|
||||
get_page(&state.db, "garden").await
|
||||
async fn garden() -> impl IntoResponse {
|
||||
let garden_page = GardenTemplate {};
|
||||
HtmlTemplate(garden_page)
|
||||
}
|
||||
|
||||
async fn page(
|
||||
state: Extension<AppState>,
|
||||
Path(params): Path<HashMap<String, String>>,
|
||||
) -> Result<impl IntoResponse, StatusCode> {
|
||||
let page_id: &String = params.get("page").unwrap();
|
||||
get_page(&state.db, page_id).await
|
||||
async fn edge_detection() -> impl IntoResponse {
|
||||
let edge_detection_page = EdgeDetectionTemplate {};
|
||||
HtmlTemplate(edge_detection_page)
|
||||
}
|
||||
|
||||
async fn books() -> impl IntoResponse {
|
||||
let books_page = BooksTemplate {};
|
||||
HtmlTemplate(books_page)
|
||||
}
|
||||
|
||||
async fn tak() -> impl IntoResponse {
|
||||
let tak_page = TakTemplate {};
|
||||
HtmlTemplate(tak_page)
|
||||
}
|
||||
|
||||
async fn arch_server() -> impl IntoResponse {
|
||||
let arch_server_page = ArchServerTemplate {};
|
||||
HtmlTemplate(arch_server_page)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,66 +1,11 @@
|
|||
use crate::database::page::Page;
|
||||
use askama::Template;
|
||||
use axum::{
|
||||
http::StatusCode,
|
||||
response::{Html, IntoResponse, Response},
|
||||
};
|
||||
use sqlx::PgPool;
|
||||
|
||||
pub mod api;
|
||||
pub mod blog;
|
||||
pub mod garden;
|
||||
pub mod root;
|
||||
pub mod templates;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct AppState {
|
||||
pub db: PgPool,
|
||||
}
|
||||
|
||||
/// A wrapper type that we'll use to encapsulate HTML parsed by askama into valid HTML for axum to serve.
|
||||
pub struct HtmlTemplate<T>(pub T);
|
||||
|
||||
/// Allows us to convert Askama HTML templates into valid HTML for axum to serve in the response.
|
||||
impl<T> IntoResponse for HtmlTemplate<T>
|
||||
where
|
||||
T: Template,
|
||||
{
|
||||
fn into_response(self) -> Response {
|
||||
// Attempt to render the template with askama
|
||||
match self.0.render() {
|
||||
// If we're able to successfully parse and aggregate the template, serve it
|
||||
Ok(html) => Html(html).into_response(),
|
||||
// If we're not, return an error or some bit of fallback HTML
|
||||
Err(err) => (
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
format!("Failed to render template. Error: {}", err),
|
||||
)
|
||||
.into_response(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "article.html")]
|
||||
pub struct ArticleTemplate {
|
||||
footer: String,
|
||||
content: String,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "page.html")]
|
||||
pub struct PageTemplate {
|
||||
content: String,
|
||||
}
|
||||
|
||||
pub async fn get_page(db: &PgPool, path: &str) -> Result<impl IntoResponse, StatusCode> {
|
||||
let reference: String = path.to_string();
|
||||
let page: Page = match Page::read_by_reference(db, &reference).await {
|
||||
Ok(a) => *a,
|
||||
Err(_) => return Err(StatusCode::NOT_FOUND),
|
||||
};
|
||||
|
||||
let template = PageTemplate {
|
||||
content: page.content,
|
||||
};
|
||||
Ok(HtmlTemplate(template))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,31 @@
|
|||
use crate::html::{api, blog, AppState};
|
||||
use axum::{
|
||||
http::StatusCode,
|
||||
response::{IntoResponse, Redirect},
|
||||
routing::{get, Router},
|
||||
Extension,
|
||||
};
|
||||
use rand::{seq::SliceRandom, thread_rng};
|
||||
use sqlx::PgPool;
|
||||
use std::error::Error;
|
||||
use tower_http::services::ServeDir;
|
||||
|
||||
use super::{garden, get_page};
|
||||
use crate::database::{
|
||||
link::{Link, LinkType},
|
||||
PsqlData,
|
||||
};
|
||||
|
||||
use super::{
|
||||
blog, garden,
|
||||
templates::{
|
||||
AboutTemplate, AiTemplate, BlogrollTemplate, ContactTemplate, HomeTemplate, HtmlTemplate,
|
||||
LinksPageTemplate, NowTemplate, UsesTemplate,
|
||||
},
|
||||
AppState,
|
||||
};
|
||||
|
||||
pub fn get_router(pool: PgPool) -> Router {
|
||||
let assets_path = std::env::current_dir().unwrap();
|
||||
let state = AppState { db: pool };
|
||||
Router::new()
|
||||
.nest("/api", api::get_router())
|
||||
.nest("/blog", blog::get_router())
|
||||
.nest("/garden", garden::get_router())
|
||||
.nest_service(
|
||||
|
|
@ -36,34 +47,65 @@ pub fn get_router(pool: PgPool) -> Router {
|
|||
.layer(Extension(state))
|
||||
}
|
||||
|
||||
async fn home(state: Extension<AppState>) -> Result<impl IntoResponse, StatusCode> {
|
||||
get_page(&state.db, "home").await
|
||||
async fn home() -> impl IntoResponse {
|
||||
HtmlTemplate(HomeTemplate {})
|
||||
}
|
||||
|
||||
async fn now(state: Extension<AppState>) -> Result<impl IntoResponse, StatusCode> {
|
||||
get_page(&state.db, "now").await
|
||||
async fn now() -> impl IntoResponse {
|
||||
HtmlTemplate(NowTemplate {})
|
||||
}
|
||||
|
||||
async fn about(state: Extension<AppState>) -> Result<impl IntoResponse, StatusCode> {
|
||||
get_page(&state.db, "about").await
|
||||
async fn about() -> impl IntoResponse {
|
||||
HtmlTemplate(AboutTemplate {})
|
||||
}
|
||||
|
||||
async fn contact(state: Extension<AppState>) -> Result<impl IntoResponse, StatusCode> {
|
||||
get_page(&state.db, "contact").await
|
||||
async fn contact() -> impl IntoResponse {
|
||||
HtmlTemplate(ContactTemplate {})
|
||||
}
|
||||
|
||||
async fn uses(state: Extension<AppState>) -> Result<impl IntoResponse, StatusCode> {
|
||||
get_page(&state.db, "uses").await
|
||||
async fn uses() -> impl IntoResponse {
|
||||
HtmlTemplate(UsesTemplate {})
|
||||
}
|
||||
|
||||
async fn ai(state: Extension<AppState>) -> Result<impl IntoResponse, StatusCode> {
|
||||
get_page(&state.db, "ai").await
|
||||
async fn ai() -> impl IntoResponse {
|
||||
HtmlTemplate(AiTemplate {})
|
||||
}
|
||||
|
||||
async fn blogroll(state: Extension<AppState>) -> Result<impl IntoResponse, StatusCode> {
|
||||
get_page(&state.db, "blogroll").await
|
||||
async fn blogroll(state: Extension<AppState>) -> impl IntoResponse {
|
||||
let blogroll_page = BlogrollTemplate {
|
||||
blogs: match get_links_as_list(&state.db, LinkType::BLOG).await {
|
||||
Ok(list) => list,
|
||||
Err(_) => Vec::new(),
|
||||
},
|
||||
};
|
||||
HtmlTemplate(blogroll_page)
|
||||
}
|
||||
|
||||
async fn links(state: Extension<AppState>) -> Result<impl IntoResponse, StatusCode> {
|
||||
get_page(&state.db, "links").await
|
||||
async fn links(state: Extension<AppState>) -> impl IntoResponse {
|
||||
let links_page = LinksPageTemplate {
|
||||
articles: match get_links_as_list(&state.db, LinkType::ARTICLE).await {
|
||||
Ok(list) => list,
|
||||
Err(_) => Vec::new(),
|
||||
},
|
||||
};
|
||||
HtmlTemplate(links_page)
|
||||
}
|
||||
|
||||
pub async fn get_links_as_list(
|
||||
pool: &PgPool,
|
||||
link_type: LinkType,
|
||||
) -> Result<Vec<Link>, Box<dyn Error>> {
|
||||
let mut links: Vec<Link> = match Link::read_all(pool).await {
|
||||
Ok(a) => a.iter().map(|x| *x.clone()).collect(),
|
||||
Err(_) => Vec::new(),
|
||||
};
|
||||
|
||||
let mut rng = thread_rng();
|
||||
links.shuffle(&mut rng);
|
||||
|
||||
let list: Vec<Link> = links
|
||||
.into_iter()
|
||||
.filter(|link| link.link_type == link_type)
|
||||
.collect();
|
||||
Ok(list)
|
||||
}
|
||||
|
|
|
|||
124
src/html/templates.rs
Normal file
124
src/html/templates.rs
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
use askama::Template;
|
||||
use axum::{
|
||||
http::StatusCode,
|
||||
response::{Html, IntoResponse, Response},
|
||||
};
|
||||
|
||||
use crate::database::{article::Article, link::Link};
|
||||
|
||||
/// A wrapper type that we'll use to encapsulate HTML parsed by askama into valid HTML for axum to serve.
|
||||
pub struct HtmlTemplate<T>(pub T);
|
||||
|
||||
/// Allows us to convert Askama HTML templates into valid HTML for axum to serve in the response.
|
||||
impl<T> IntoResponse for HtmlTemplate<T>
|
||||
where
|
||||
T: Template,
|
||||
{
|
||||
fn into_response(self) -> Response {
|
||||
// Attempt to render the template with askama
|
||||
match self.0.render() {
|
||||
// If we're able to successfully parse and aggregate the template, serve it
|
||||
Ok(html) => Html(html).into_response(),
|
||||
// If we're not, return an error or some bit of fallback HTML
|
||||
Err(err) => (
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
format!("Failed to render template. Error: {}", err),
|
||||
)
|
||||
.into_response(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "article.html")]
|
||||
pub struct ArticleTemplate {
|
||||
pub footer: String,
|
||||
pub content: String,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "page.html")]
|
||||
pub struct PageTemplate {
|
||||
pub content: String,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "links.html")]
|
||||
pub struct LinksPageTemplate {
|
||||
pub articles: Vec<Link>,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "blog.html")]
|
||||
pub struct BlogTemplate {
|
||||
pub articles: Vec<Article>,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "now.html")]
|
||||
pub struct NowTemplate {}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "garden.html")]
|
||||
pub struct GardenTemplate {}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "books.html")]
|
||||
pub struct BooksTemplate {}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "Tak.html")]
|
||||
pub struct TakTemplate {}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "time.html")]
|
||||
pub struct TimeTemplate {}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "uses.html")]
|
||||
pub struct UsesTemplate {}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "gifts.html")]
|
||||
pub struct GiftsTemplate {}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "contact.html")]
|
||||
pub struct ContactTemplate {}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "ai.html")]
|
||||
pub struct AiTemplate {}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "blogroll.html")]
|
||||
pub struct BlogrollTemplate {
|
||||
pub blogs: Vec<Link>,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "EdgeDetection.html")]
|
||||
pub struct EdgeDetectionTemplate {}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "ArchServer.html")]
|
||||
pub struct ArchServerTemplate {}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "interests.html")]
|
||||
pub struct InterestsTemplate {}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "home.html")]
|
||||
pub struct HomeTemplate {}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "about.html")]
|
||||
pub struct AboutTemplate {}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "blog_footer.html")]
|
||||
pub struct BlogFooterTemplate {
|
||||
pub previous: String,
|
||||
pub next: String,
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#![allow(async_fn_in_trait)]
|
||||
use crate::database::{article::load_articles, page::load_pages};
|
||||
use crate::database::article::load_articles;
|
||||
use database::link::load_links;
|
||||
use sqlx::PgPool;
|
||||
use std::error::Error;
|
||||
|
|
@ -35,7 +35,6 @@ pub async fn run_server(pool: PgPool) -> std::io::Result<()> {
|
|||
|
||||
pub async fn run_load(pool: &PgPool) -> Result<(), Box<dyn Error>> {
|
||||
load_articles(pool).await?;
|
||||
load_pages(pool).await?;
|
||||
load_links(pool).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
id: archserver
|
||||
title: Arch Server
|
||||
date_created: 2023-08-28
|
||||
date_last_updated: 2023-08-28
|
||||
description: The set up for my Arch cloud server that hosts this website and some other stuff.
|
||||
---
|
||||
<!-- prettier-ignore -->
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>
|
||||
Arch Server
|
||||
</h2>
|
||||
|
|
@ -275,3 +273,4 @@ sudo certbot renew
|
|||
I will endeavor to update it when things do.
|
||||
Slowly grow from something mostly taken from Derek's guide (thank you so much for that) to something uniquely my own and serving the my exact needs.
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
id: ed
|
||||
title: Edge Detection
|
||||
date_created: 2021-02-01
|
||||
date_last_updated: 2021-02-01
|
||||
description: Edge detection algorithm project for a ML course I took for my Masters
|
||||
---
|
||||
<!-- prettier-ignore -->
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>
|
||||
Edge Detection
|
||||
</h2>
|
||||
|
|
@ -96,3 +94,4 @@ description: Edge detection algorithm project for a ML course I took for my Mast
|
|||
I have done a little bit of machine learning with convolutional neural networks, but for most libraries this portion is already done for you.
|
||||
Understanding what is going on under the hood was very interesting.
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
id: tak
|
||||
title: Tak
|
||||
date_created: 2021-05-01
|
||||
date_last_updated: 2021-05-01
|
||||
description: My effort at making a functioning python program to play Tak.
|
||||
---
|
||||
<!-- prettier-ignore -->
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>
|
||||
Tak
|
||||
</h2>
|
||||
|
|
@ -115,3 +113,4 @@ description: My effort at making a functioning python program to play Tak.
|
|||
I had this in mind when I was writing it so made sure that the GUI was disconnected from the actual mechanics behind the game.
|
||||
This will hopefully make it easier to connect to an agent for training.
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
|
@ -1,10 +1,8 @@
|
|||
id: about
|
||||
title: About
|
||||
date_created: 2020-01-01
|
||||
date_last_updated: 2023-11-01
|
||||
description: About me
|
||||
---
|
||||
<h2>General</h2>
|
||||
<!-- prettier-ignore -->
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Me</h2>
|
||||
<p>
|
||||
My greatest joy in life is learning new things.
|
||||
Early on I leaned almost exclusively toward the sciences.
|
||||
|
|
@ -59,3 +57,4 @@ description: About me
|
|||
Trying to live more in line with what feels right internally.
|
||||
A wonderful exploration and adventure.
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
id: ai
|
||||
title: AI
|
||||
date_created: 2024-08-08
|
||||
date_last_updated: 2024-08-08
|
||||
description: How I use AI.
|
||||
---
|
||||
<!-- prettier-ignore -->
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>AI</h2>
|
||||
<p>
|
||||
Common page I am seeing start to show up is an AI page explaining how creators use AI in their writing.
|
||||
|
|
@ -23,3 +21,4 @@ description: How I use AI.
|
|||
I may use them for work, but I don't see them ever touching this website or personal projects.
|
||||
I do these things for the joy of doing them, and I don't want to give up any of that process.
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
|
@ -4,7 +4,6 @@
|
|||
<head>
|
||||
<link href="/assets/main.css" rel="stylesheet" />
|
||||
<link rel="shortcut icon" href="/assets/favicon.ico">
|
||||
<script src="/assets/htmx.min.js"></script>
|
||||
<title>Awstin</title>
|
||||
{% block head %}{% endblock %}
|
||||
</head>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<ul class="no-bul">
|
||||
{{article_list|safe}}
|
||||
</ul>
|
||||
<ul class="no-bul">
|
||||
{% for article in articles %}
|
||||
<li><a href="/blog/{{article.reference}}">{{article.title}}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
id: blogroll
|
||||
title: Blogroll
|
||||
date_created: 2024-08-08
|
||||
date_last_updated: 2024-08-13
|
||||
description: A list of blogs that I follow
|
||||
---
|
||||
<!-- prettier-ignore -->
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Blogroll</h2>
|
||||
<p>
|
||||
I follow quite a few blogs.
|
||||
|
|
@ -16,5 +14,16 @@ description: A list of blogs that I follow
|
|||
The list gets randomly shuffled each time to expose new links at the top to visitors.
|
||||
Just an idea that I had, please <a href="/contact">contact me</a> if it causes anyone issues.
|
||||
</p>
|
||||
<ul class="no-bul" hx-trigger="load" hx-get="/api/blogrolllinks">
|
||||
<ul class="no-bul">
|
||||
{% for blog in blogs %}
|
||||
<li><a href={{blog.url}}>{{blog.title}}</a>
|
||||
{% match blog.description %}
|
||||
{% when Some with (description) %}
|
||||
:<br>{{description}}
|
||||
{% when None %}
|
||||
{% endmatch %}
|
||||
</li>
|
||||
<br>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
id: books
|
||||
title: Books
|
||||
date_created: 2021-01-06
|
||||
date_last_updated: 2024-08-13
|
||||
description: Root page for all things in the Awstin/Book vendiagram overlap
|
||||
---
|
||||
<!-- prettier-ignore -->
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Books</h2>
|
||||
<p>
|
||||
I love to read.
|
||||
|
|
@ -16,15 +14,12 @@ description: Root page for all things in the Awstin/Book vendiagram overlap
|
|||
|
||||
<h4>Currently Reading</h4>
|
||||
<p>
|
||||
Just finished Elantris.
|
||||
Just started Wild Problems by Russ Roberts.
|
||||
A book on making the sort of decisions that we can't make my just logically looking at the data.
|
||||
Without a right or wrong answer, the bigger life questions.
|
||||
Have been feeling stuck on one of those lately and as I was scrolling through the books on my e-reader this jumped out at me.
|
||||
Get to pick a new book to start.
|
||||
</p>
|
||||
|
||||
<h4>Read so far in 2024</h4>
|
||||
<ul class="no-bul">
|
||||
<li>Wild Problems - Russ Roberts</li>
|
||||
<li>Elantris - Brandon Sanderson</li>
|
||||
<li>The Burnout Society - Byung-Chul Han</li>
|
||||
<li>Reaper's Gale - Steven Erikson</li>
|
||||
|
|
@ -39,8 +34,8 @@ description: Root page for all things in the Awstin/Book vendiagram overlap
|
|||
|
||||
<h4>Reflections from Books I have read</h4>
|
||||
<ul class="no-bul">
|
||||
<li><a href="/garden/deepwork">Deep Work</a></li>
|
||||
<li><a href="/garden/mfn">A Mind for Numbers</a></li>
|
||||
<li><a href="/blog/deepwork">Deep Work</a></li>
|
||||
<li><a href="/blog/mfn">A Mind for Numbers</a></li>
|
||||
</ul>
|
||||
|
||||
<h3>
|
||||
|
|
@ -103,3 +98,4 @@ description: Root page for all things in the Awstin/Book vendiagram overlap
|
|||
<p>
|
||||
So that is my case for reading.
|
||||
</p>
|
||||
{% endblock %}
|
||||
6
templates/colophon.html
Normal file
6
templates/colophon.html
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<!-- prettier-ignore -->
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
{{content|safe}}
|
||||
{% endblock %}
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
id: contact
|
||||
title: Contact
|
||||
date_created: 2020-01-01
|
||||
date_last_updated: 2023-07-22
|
||||
description: Contact me
|
||||
---
|
||||
<!-- prettier-ignore -->
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<p>
|
||||
I am always happy to meet new people.
|
||||
I can be contacted by email at <a href="mailto:awstin@achubb.com">awstin@achubb.com</a>.
|
||||
</p>
|
||||
{% endblock %}
|
||||
2
templates/content_with_list.html
Normal file
2
templates/content_with_list.html
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
{{content|safe}}
|
||||
{{list|safe}}
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
id: garden
|
||||
title: Garden
|
||||
date_created: 2024-07-31
|
||||
date_last_updated: 2024-08-08
|
||||
description: Home page and starting point for exploring my digital garden
|
||||
---
|
||||
<!-- prettier-ignore -->
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>My Garden</h2>
|
||||
<p>
|
||||
Hi all, welcome to the starting point for exploring my digital garden.
|
||||
|
|
@ -27,7 +25,7 @@ description: Home page and starting point for exploring my digital garden
|
|||
<p>
|
||||
Slash pages that I have implemented so far.
|
||||
Have a few more in mind that will be coming soon.
|
||||
Interests, colophon, and links I think.
|
||||
Interests and colophon I think.
|
||||
</p>
|
||||
<ul>
|
||||
<li><a href="/blogroll">Blogroll</a></li>
|
||||
|
|
@ -39,3 +37,4 @@ description: Home page and starting point for exploring my digital garden
|
|||
<li><a href="/ai">AI</a></li>
|
||||
<li><a href="/contact">Contact</a></li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
|
@ -2,28 +2,28 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Gifts</h2>
|
||||
<p>
|
||||
If you are here you are probably thinking of getting me a gift.
|
||||
I do very deeply appreciate it and thank you for the thought.
|
||||
</p>
|
||||
<p>
|
||||
I am not much of a receiving gift person.
|
||||
I don't like having a lot of things and am quite particular about what I do get.
|
||||
I would much rather spend time together.
|
||||
If you can spare the time to sit down and have a nice conversation or do something together that would be wonderful.
|
||||
</p>
|
||||
<p>
|
||||
There are a few people in my life that I think are an exception to this rule.
|
||||
If you are one of these people you know it and I say do whatever you see fit.
|
||||
Otherwise if you feel that you must give me something I would suggest cash.
|
||||
Not sure what I will use it for but there are always various things that I am eyeing, usually larger purchases.
|
||||
I will certainly let you know what use it went to.
|
||||
</p>
|
||||
<p>
|
||||
Regardless, thank you so much, I really appreciate it.
|
||||
</p>
|
||||
<p>
|
||||
Awstin
|
||||
</p>
|
||||
<h2>Gifts</h2>
|
||||
<p>
|
||||
If you are here you are probably thinking of getting me a gift.
|
||||
I do very deeply appreciate it and thank you for the thought.
|
||||
</p>
|
||||
<p>
|
||||
I am not much of a receiving gift person.
|
||||
I don't like having a lot of things and am quite particular about what I do get.
|
||||
I would much rather spend time together.
|
||||
If you can spare the time to sit down and have a nice conversation or do something together that would be wonderful.
|
||||
</p>
|
||||
<p>
|
||||
There are a few people in my life that I think are an exception to this rule.
|
||||
If you are one of these people you know it and I say do whatever you see fit.
|
||||
Otherwise if you feel that you must give me something I would suggest cash.
|
||||
Not sure what I will use it for but there are always various things that I am eyeing, usually larger purchases.
|
||||
I will certainly let you know what use it went to.
|
||||
</p>
|
||||
<p>
|
||||
Regardless, thank you so much, I really appreciate it.
|
||||
</p>
|
||||
<p>
|
||||
Awstin
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
id: home
|
||||
title: Home
|
||||
date_created: 2020-01-01
|
||||
date_last_updated: 2024-07-30
|
||||
description: Home page
|
||||
---
|
||||
<!-- prettier-ignore -->
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<section id="about">
|
||||
<h1>Awstin Chubb</h1>
|
||||
<h2>About me</h2>
|
||||
|
|
@ -52,3 +50,4 @@ description: Home page
|
|||
Here is my <a href="/contact">contact</a> information.
|
||||
</p>
|
||||
</section><br>
|
||||
{% endblock %}
|
||||
72
templates/interests.html
Normal file
72
templates/interests.html
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<!-- prettier-ignore -->
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Interest</h2>
|
||||
<p>
|
||||
This is a quick stop to see an overview of the various interests that I am currently pursuing.
|
||||
I suspect that most of them will wind up with their own pages.
|
||||
</p>
|
||||
|
||||
<h3>Programming</h3>
|
||||
<p>
|
||||
As well as it now being my day job programming is something that I am fascinated by.
|
||||
Computers in general as the most ubiquitous tool that we use fascinate me.
|
||||
My computer serves as my workshop and computing in general as a subject of study.
|
||||
</p>
|
||||
<p>
|
||||
I do most of my programming in Rust.
|
||||
I like the performance of the language and the strong type system.
|
||||
It feels worth the extra headache sometimes to have code that runs once it compiles.
|
||||
</p>
|
||||
<p>
|
||||
Most of what I do personally and for work would be considered fullstack.
|
||||
Websites/apps and the corresponding backend service.
|
||||
I prefer simpler technology for my own work.
|
||||
Html and CSS over Typescript and React.
|
||||
The sites and the code are simpler and perform better I find.
|
||||
</p>
|
||||
|
||||
<h3>Brazillian Jiu Jitsu</h3>
|
||||
<p>
|
||||
I have spent a lot of time on martial arts in my life.
|
||||
Early on it was striking.
|
||||
Tae kwon do, Muai Thai.
|
||||
It took me all of one class in BJJ to realize that it was the one for me.
|
||||
</p>
|
||||
<p>
|
||||
I love the cerebral nature of it.
|
||||
Endless depth in the game, and also personalized.
|
||||
Everyone fights differently based on their temperment, physique, and skills.
|
||||
</p>
|
||||
<p>
|
||||
In training we can go hard.
|
||||
Harder than in any other martial art I have ever tried.
|
||||
The grappling nature of it and respecting the tap makes it safer to train much more like we would fight in competition.
|
||||
</p>
|
||||
<p>
|
||||
The art also has a lot of tradition and respect involved in it which I have loved ever since I did Tae Kwon Do in a very traditional school when I was younger.
|
||||
It makes it more then just a sport.
|
||||
It has a philosophy, and that structure also engenders much more of a feeling of cameraderie I find.
|
||||
</p>
|
||||
|
||||
<h3>Technological Independence</h3>
|
||||
<p>
|
||||
The last few years I have been slowly working to remove myself from reliance on cloud services that I don't host.
|
||||
I don't trust the large tech companies that run all of these things to have my best interests at heart.
|
||||
</p>
|
||||
<p>
|
||||
The digital world has become a core part of my life, as I think it has for us all.
|
||||
Just as I would be suspicious if I needed someone else's permission to use my computer itself, or any other tool/gadget/anything that I own, I feel that way about applications and data as well.
|
||||
So I am doing my best to host everything myself, use open standards, run my own server.
|
||||
</p>
|
||||
<p>
|
||||
The process of setting this all up and maintaining it is fascinating.
|
||||
So many neat tools, great communities, and infinite ways to personalize my setup.
|
||||
</p>
|
||||
<p>
|
||||
At the moment it requires a certain level of tech savvy that I am grateful to have.
|
||||
I would like to see what I can do to make it acheivable for anyone with a minimum of technical knowledge to have.
|
||||
Everyone deserves to be the final arbiter of their digital lives, private and public.
|
||||
</p>
|
||||
{% endblock %}
|
||||
22
templates/links.html
Normal file
22
templates/links.html
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<!-- prettier-ignore -->
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Links</h2>
|
||||
<p>
|
||||
A collection of links to interesting posts that I have found.
|
||||
In a random order to shuffle what links are at the top.
|
||||
</p>
|
||||
<ul class="no-bul">
|
||||
{% for article in articles %}
|
||||
<li><a href={{article.url}}>{{article.title}}</a>
|
||||
{% match article.description %}
|
||||
{% when Some with (description) %}
|
||||
:<br>{{description}}
|
||||
{% when None %}
|
||||
{% endmatch %}
|
||||
</li>
|
||||
<br>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
id: now
|
||||
title: Now
|
||||
date_created: 2020-01-01
|
||||
date_last_updated: 2024-08-08
|
||||
description: What I am up to now.
|
||||
---
|
||||
<!-- prettier-ignore -->
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<p>
|
||||
Last updated: 2024-08-08
|
||||
</p>
|
||||
|
|
@ -84,3 +82,4 @@ description: What I am up to now.
|
|||
<p>
|
||||
Awstin
|
||||
</p>
|
||||
{% endblock %}
|
||||
71
templates/time.html
Normal file
71
templates/time.html
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<!-- prettier-ignore -->
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Time</h2>
|
||||
<p>
|
||||
I spend a lot of time thinking about... well time.
|
||||
How to use it, what it means.
|
||||
The way that we perceive and value it.
|
||||
</p>
|
||||
<p>
|
||||
My opinion on it has change a lot in the last decade.
|
||||
I have slowed down.
|
||||
No longer trying to maximize every moment spent.
|
||||
Fill my days to the brim with "productive" things.
|
||||
</p>
|
||||
<p>
|
||||
That results in living always being put off until later.
|
||||
And the more I thought about it and explored what others have thought/written on the topic the more that I realized that mindset does not have an end.
|
||||
There will always be more to do and another reason to put it off.
|
||||
</p>
|
||||
<p>
|
||||
So I have worked to change my mindset in recent years.
|
||||
To be more mindful and take joy in how I do things as opposed to only focussing on how efficiently.
|
||||
I have discovered that the scenic route is worth it.
|
||||
Efficiency is for the things that must be done but that I don't enjoy as much in and of themselves.
|
||||
Or if I truly enjoy the more efficient method/enjoy the process of exploring that efficiency itself.
|
||||
</p>
|
||||
|
||||
<h3>Remote work</h3>
|
||||
<p>
|
||||
An interesting aspect to time I have noticed is remote work.
|
||||
It is one of those things that feels like just upside when thinking about it.
|
||||
It then shows a few downsides when put into practice.
|
||||
</p>
|
||||
<p>
|
||||
Upside obviously is that it gives significantly more freedom with my time.
|
||||
Can do stuff around the house during breaks.
|
||||
Saves commuting time, packing lunch.
|
||||
I can use my home desk setup that I have customized just the way that I like it.
|
||||
It gives the freedom to work from elsewhere if I am visiting family or otherwise traveling.
|
||||
</p>
|
||||
<p>
|
||||
The downsides took some more time to become apparent.
|
||||
Which means that I did not prepare for them.
|
||||
I like to tinker and work on my own stuff.
|
||||
This website, my server, etc.
|
||||
The lack of clear division between where I do work for myself and for my employer.
|
||||
When I sat down to work on my own things it was all too easy to log onto my work laptop instead.
|
||||
</p>
|
||||
<p>
|
||||
There is always a deadline coming up, or an issue to fix for our stakeholders.
|
||||
An endless amount of work to be done.
|
||||
So there wound up being some guilt around spending that time working on my own things.
|
||||
</p>
|
||||
<p>
|
||||
I worked remotely, even part of the time for 2 years without being aware of how it was changing how I was relating to my space at home.
|
||||
It took a few months where I switched to working fully at the office.
|
||||
Treating it like the jobs that I have had in the past that required physical presence.
|
||||
Where work was left at work.
|
||||
</p>
|
||||
<p>
|
||||
Now to work comfortably at home again I have some rules that I go by.
|
||||
Hard stop at 17 unless I am oncall.
|
||||
Leave the laptop unplugged from the docking station at my desk.
|
||||
Thre are some situations that have been exceptions, but I am acutely aware of them.
|
||||
</p>
|
||||
<p>
|
||||
Keeping this balance is important and if I notice it start to slip again I will go back to fulltime at the office.
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
id: uses
|
||||
title: Uses
|
||||
date_created: 2024-06-30
|
||||
date_last_updated: 2024-06-30
|
||||
description: Things that I use
|
||||
---
|
||||
<!-- prettier-ignore -->
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Things I use</h2>
|
||||
<h3>Analog stuff</h3>
|
||||
<ul>
|
||||
|
|
@ -163,3 +161,4 @@ description: Things that I use
|
|||
<b>Language Learning:</b> <a href="https://www.duolingo.com/learn">Duolingo</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
Loading…
Reference in a new issue