Randomizing the order of blogs shown on the blogroll page

This commit is contained in:
awstin 2024-08-10 08:40:08 -04:00
parent 603845fc40
commit b4fa449e09
7 changed files with 58 additions and 110 deletions

1
Cargo.lock generated
View file

@ -11,6 +11,7 @@ dependencies = [
"bb8",
"clap",
"futures-util",
"rand",
"serde",
"sqlx",
"time",

View file

@ -11,6 +11,7 @@ axum = "0.6"
bb8 = "0.8.3"
clap = { version = "4.5.13", features = ["derive"] }
futures-util = "0.3.30"
rand = "0.8.5"
serde = { version = "1.0.197", features = ["derive"] }
sqlx = {version = "0.7.4", features = ["runtime-tokio-rustls", "postgres", "time", "macros"]}
time = {version = "0.3.36", features = ["macros", "serde"]}

View file

@ -1,102 +0,0 @@
id: 2021-03
title: Personal Update March 2021
date: 2021-03-27
---
<h2>
Personal Update March 2021
</h2>
<p>
So in the spirit of honestly chronicling my journey, I have to say that this past week has been fairly unsuccessful.
Due to significant stresses in my life a lot of my routines have fallen apart.
This week I am going to do an analysis of what I have been able to keep up with and what has dropped off.
It outlines what activities I am still using discipline and willpower to do (which are more susceptible to breakdowns when stressed) and what seems to have held together (habit).
</p>
<p>
Starting with the things that have held together.
I am still exercising regularly.
It feels odd not to go to the gym.
Even though some days I have cut down on the intensity and amount of the exercise it is still there.
On certain days I cut back on the weight I was lifting and on others I did fewer and/or less effective exercises.
Swapping out an exercise for a slightly less effective one may seem completely counter productive, but I have found that when I am not feeling it, the novelty of something different helps raise my interest.
It is better to do something sub optimal then nothing at all.
</p>
<p>
I have still been reading a fair bit.
I was reading The Gulag Archipelago which is a book about life in Stalinist Russia.
Needless to say it is dark, so for this week I put it down in favor of easier reading.
I continue to read one of Senecas letters each day and am in the process of reading Malcolm Gladwells The Tipping Point.
It is about what causes sudden drastic changes in systems when one would expect more gradual ones.
It touches on epidemics of various sorts, fashion, crime, adoption of technology etc.
I am also reading more fiction for pure enjoyment.
A short story collection by my favourite author Greg Egan is also for fun.
It is called Artifacts and I strongly suggest his work if you like very hard science fiction.
</p>
<p>
School is the area where I have just kept up.
Normally I try to work ahead and try to do two weeks of reading for each week that passes.
That way when it is time to work on a project or study for a test I have the time to focus solely on that without falling behind.
This week was just a weeks worth of reading and I called it at that.
Some of the time I would normally spend working on school I spent listening to podcasts on whatever topic I was interested in that day.
The learning this week may have been less focussed than usual, and for less total time but it was still there.
</p>
<p>
So learning, and exercise seem to have held together alright.
This makes sense, I have had these practices for a long time.
While they have all been ratcheted down in intensity they have continued.
This is the advantage of habits, it truly feels odd when I dont do them for a day.
</p>
<p>
Now for the areas that have not held up so well under stress.
I have not been consistent with my sleep schedule.
I have been staying up later and sleeping in more in the morning.
Not by a small amount either.
2-4 hours later both in bed and waking time is significant.
I have been loath to cut my sleep short, I know how important having enough sleep is especially when your body is under stress.
I am not sleeping much more, just not at the times that I prefer.
</p>
<p>
I have been spending more time on my phone, watching youtube videos mostly.
I think the common trend with my behavioural changes this week is that I am leaning towards immediate enjoyment and a little bit of escapism as opposed to longer term thinking.
It also makes sense, my brain is trying to make me feel better using the things that reward me quickly.
My phone use is not as high as it was the first week.
I tracked it and it has been going up since last week.
I am also spending more time playing video games.
Normally I try to keep them within my off time at the end of the day, but it has creeped out into the rest of my day.
</p>
<p>
Writing my 10 ideas for the day has been problematic.
I normally do it later in my routine so I can use whatever problems I have encountered throughout the day to generate ideas.
While under stress I am very mentally drained at the end of the day and it feels insurmountably difficult to come up with ideas when my mind is so occupied.
I could try and do it earlier in the day when I am feeling fresher.
Something to look into for the next week.
</p>
<p>
I am doing my best to keep meditating.
This is the exact time that it is most needed, but clearly it has not been instilled as a habit yet.
Iit has been a lot of work to get myself to sit so this practice has been spotty.
</p>
<p>
Obviously as this is getting posted a day late this blog falls into that category.
I had it written by the end of the day on friday but did not have it edited and posted until saturday.
</p>
<p>
It is only when under pressure that I can really see how well my routine holds up.
A lot of my habits around getting things done have held up reasonably, while self care has fallen apart.
That makes sense to me.
I have only implemented a lot of the self care and quality of life actions in the last 6-months to a year while the learning and exercising has been an integral part of my life for over a decade.
</p>
<p>
I still have plenty of time, even though it often does not feel that way, and these things can be fixed.
I do tend to focus on giving myself a hard time when I dont perform up to my standards but I am trying to extract some good from it in the form of a lesson instead.
We often learn some of our most valuable lessons from difficult times if we remember to look.
The current goal for me is to keep doing whatever I can while I take care of myself.
That way I can get through this particular rough patch in life without trying to go so hard that I make it worse and it becomes more than I can handle.
</p>
<p>
Thanks for reading.
</p>
<p>
Phone time: 16h 9m
</p>

View file

@ -2,26 +2,68 @@ url: https://www.henrikkarlsson.xyz
title: Escaping Flatland
author: Henrik Karlsson
type: blog
date_added: 2024-08-08
date_added: 2024-08-09
description: Extremely deep and thought provoking writing. On thinking, life, learning and many things.
---
url: https://ploum.net
title: Ploum
author: Lionel Dricot
type: blog
date_added: 2024-08-08
date_added: 2024-08-09
description: Mostly French, originally found through his article on the forever computer. Computing, culture, and writing.
---
url: https://sive.rs
title: Derek Sivers
author: Derek Sivers
type: blog
date_added: 2024-08-08
date_added: 2024-08-09
description: One of my favourite authors, thinkers, and one of the original inspirations for my self hosted journey.
---
url: https://herman.bearblog.dev
title: Herman
author: Herman Martinus
type: blog
date_added: 2024-08-08
description: Developper of a wonderful minimalist blogging platform based in South Africa.
date_added: 2024-08-09
description: Developer of a wonderful minimalist blogging platform based in South Africa.
---
url: https://ludic.mataroa.blog
title: Ludicity
author: Nikhil Suresh
type: blog
date_added: 2024-08-10
description: Software developer and rager against the stupidities of working in the industry. As a software engineer myself I can relate.
---
url: https://www.baldurbjarnason.com
title: Baldur Bjarnason's Notes on the Web
author: Baldur Bjarnason
type: blog
date_added: 2024-08-10
description: Web developer from Iceland. Great thoughts on development and the web, and sharer of many interesting links.
---
url: https://gregegan.net
title: Greg Egan
author: Greg Egan
type: blog
date_added: 2024-08-10
description: My favourite author. He writes the hardest science fiction that I have ever found and his blog helps explain the concepts to help with understanding his books.
---
url: https://www.themarginalian.org
title: The Marginalian
author: Maria Popova
type: blog
date_added: 2024-08-10
description: One of the first blogs that I followed. Philosophy, history, art. A celebration of the beauty of humanity.
---
url: https://www.themarginalian.org
title: The Marginalian
author: Maria Popova
type: blog
date_added: 2024-08-10
description: One of the first blogs that I followed. Philosophy, history, art. A celebration of the beauty of humanity.
---
url: https://manuelmoreale.com
title: Manuel Moreale
author: Manual Moreale
type: blog
date_added: 2024-08-10
description: Developer who writes about anything but. I like the breadth of his interests and he has pointed me to many other wonderful personal websites as well.

View file

@ -12,7 +12,9 @@ description: A list of blogs that I follow
Following links through these is how I spend most of my time online these days.
</p>
<p>
Here they are in no particular order.
Links may not be in the same order on each page load.
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>

View file

@ -27,7 +27,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, links, blogroll, and AI I think.
Interests, colophon, and links I think.
</p>
<ul>
<li><a href="/blogroll">Blogroll</a></li>

View file

@ -6,6 +6,7 @@ use crate::{
use axum::{response::IntoResponse, routing::get, Extension, Router};
use sqlx::PgPool;
use std::error::Error;
use rand::{seq::SliceRandom, thread_rng};
pub fn get_router() -> Router {
Router::new()
@ -44,10 +45,13 @@ async fn blogroll_links(state: Extension<AppState>) -> impl IntoResponse {
}
pub async fn get_blog_links_as_list(pool: &PgPool) -> Result<Vec<String>, Box<dyn Error>> {
let links: Vec<Link> = match Link::read_all(pool).await {
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<String> = links
.iter()