Create stuff with AI

todo

Using AI to create bas-relief. Three different AI models were used to create the depth map here. [...]

Fixed a broken switch!

Had a Nintendo switch that stopped showing anything on the screen. It would make a sound when you touched the screen. Took the back off and discovered a ribbon cable was unplugged.

todo

Plugged the cable back in and it worked.
todo[...]

New SLA Printer

🔥 Received an SLA printer. Just printing random items now. width="400px" height="400px" alt="todo">[...]

Lets make a cup holder

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

Lets make a cup holder

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?[...]

3d Scanning My Boot

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

New tool: Creality Ferret.

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

Prune Docker Images Daily

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 authentication to your Golang microservice!

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.[...]

Create micro-services in GoLang!

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

Generating QR Code

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[...]

Getting Client Source in a rootless container

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.[...]

Firecracker VM.

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

Podman as a service

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. 🔥[...]

Missing Posts

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

Podman is awesome

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

It'll be a bad day when you pull an spoofed image.

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

Is podman the future?

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

We suck at websockets!

👋 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.[...]