Harrison

Working on a custom cup holder for the car. Modern cup holders do not hold modern cup sizes for coffee... todo[...]

Working on a cup holder for the car. Scanning the cup holders and the cup. I could measure but why when you have a 3d scanner that works?[...]

Scanned my boot. Why not? Pretty good results.todotodo[...]

Received an Creality Ferret. Pretty good results.[...]

I am looking at keeping old images cleaned up from a VM that I have access to. I'm looking at keeping storage space minimal is because there is low hard disk space. Let's do this from a daily crontab.

Create a file in /etc/crontab.daily

nano /etc/crontab.daily/docker-prune

In the contents of the file we will insert the following.

#!/bin/bash
podman system prune -af  --filter "until=$((30*24))h"

Allow the file to be executed.

chmod +x /etc/crontab.daily/docker-prune

NOTE: I use Podman instead of Docker but the command above is interchangeable in this instance.[...]

Adding an authentication middleware to my microservices in Golang using the HTTP Gin framework.

 func authMiddleware() gin.HandlerFunc {
	return func(c *gin.Context) {
		// Define the list of endpoints that require authentication
		securedEndpoints := []string{
			"/users/",
			"/admin",
		}

		// Check if the current request path requires authentication
		for _, path := range securedEndpoints {
			if path == c.Request.URL.Path {
				// Check if the header exists and has the expected value
				headerValue := c.GetHeader("Authorization")
				expectedValue := "your_super_secure_password"

				if headerValue != expectedValue {
					// If the header value doesn't match the expected value,
					// return a 401 Unauthorized response
					c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{
						"error": "Unauthorized",
					})
					return
				}
				break
			}
		}

		// If the path doesn't require authentication, continue to the next handler
		c.Next()
	}
}

When setting up the router. You can use

r.Use(authMiddleware())

This will run before each method.[...]

Been writing micro-services in GoLang utilizing the gin HTTP web framework.[...]

Looking into generating QR codes and keeping track of the scans. However, I wanted a image in the center. Here is a quick summary of how I accomplished this.

  • Download Qrencode
  • Ran the following command. qrencode -s 6 -l H --foreground="3599FE" --background="FFFFFF" -o "qr.png" "Your text here"
  • Download ImageMagick
  • Run the following command to layer another image on top. convert qr.png \( beard.jpg -resize 100x100 \) -gravity center -composite test.jpg

Will generate the below QR Code. todo[...]

I ran into an interesting problem setting up PiHole on Podman. Pihole was not seeing the client IPS. This is due to how rootless containers work. Adding --network slirp4netns:port_handler=slirp4netns forwards the source address. After this, I enabled Pihole listening on all interfaces. I am now able to group devices and have different block lists. Do note that this is slower, don't use the slirp4netns network unless necessary.[...]

Working on an internal cluster that utilizes firecracker for micro vm's. Project is coming along nicely![...]

I'm testing podman on WSL and wanted to create a podman service. I just created a sh file and runs the following command.

podman system service --timeout 0 unix:///home/michael/podman/site/podman.sock

This creates a sock file that allows Nomads Podman plugin to work. 🔥[...]

Discovered that there are some posts that are missing from the old site. Working on migrating those now.[...]

Been migrating everything to podman. Enjoying every bit of it![...]

🔥 Tech Tip: Make it a habit to specify the full URL for your container image. Reduces the chance of pulling an spoofed image.[...]

👋 Hey there again friends! Working on switching my docker environments over to podman. Daemonless containers by default? I'm up for that.[...]

👋 Hey there friends!

The new site uses Blazor which requires Websockets to work. I have a Nginx server in front of the application. Without adding the config below, the SignlR library was falling back to polling. Upsetting Cloudflare as they were notifying me about bot traffic.

Add the below to the correct section in the nginx config.

               proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection $http_connection;
```[...]

Need to schedule an Azure Devops job on a schedule? You can do cron type schedules to achieve this!

schedules:
- cron: "0 0 5 * * *"
  displayName: 5 AM Build
  branches:
    include:
    - devlop

Starts the job every day at 5AM.[...]

This site is now controlled mainly by CI/CD. The blogs and toots are saved to a markdown repo, that triggers a pipeline to convert to html for this site and pipelines to update the actual site code. Fun stuff.[...]

Looking for a c# library that will connect to a docker container and redirect the STDIN/STDERR to the browser using Blazor.[...]

Ordered some mosfets for the 3d printers.[...]

An error has occurred. This application may no longer respond until reloaded. Reload 🗙