Hey👋 I’m Oscar

Welcome to my technical blog!
Here, you’ll find useful insights and knowledge to help you stay ahead in the industry.
Thanks for stopping by, and I hope you enjoy what you read.
Find about me more ⬇️

[Security/Gitea] How to Secure Your Public Gitea Server Without Complex Configuration

Last time when I restarted my Gitea server was when I upgraded it to 2.20.11. It has been six months. Although I almost pushed code everyday, I didn’t notice that my Gitea server was already attacked by hackers for a couple of months. I found out that the hackers created few users and repositories on my Gitea server everyday. I was lucky that I found out this issue before it was too late. ...

linux-execute-a-binary-in-background

[Linux] How to Excute Binary in Background

1. Problem You may meet the situation where you want to execute a binary in Linux, but you don’t want to keep the terminal open. You want to close the terminal and let the binary run in the background. 2. Solution In Linux, you can use the nohup command to run a binary in the background. The nohup command is used to run a command or script that keeps running after you log out of a shell. ...

jellyfin-invalid-address-or-port-bind

[Jellyfin] Windows Tray Will Not Start Server

1. Issue Well, if you are using Jellyfin as your home media solution, you may confront the issue that the Windows tray cannot start server. There is no specific error message. Just simply doesn’t work. As a technical person, I always try to find the root cause of the issue. So I opened the Jellyfin server log file and found the error message like below. By the way, I installed the Jellyfin server on Windows with installer. ...

[Web/Golang] What is CORS Error and How to Fix it in Golang

If you search Cors error, you can find tons of answers. But most of them are not clear enough to understand, especially you are new to web development. So I will explain what is Cors error and how to fix it in Golang. 1. What is Cors? CORS stands for Cross-Origin Resource Sharing. It is a security feature implemented by web browsers to control how web pages in one domain can request and interact with resources hosted on another domain. ...

Drone CI Slack Notification

[DroneCI/Slack] How to Send CI Build Notification with Slack (Step by Step Tutorial)

Today let’s have a look at how to integrate Slack to your CI pipeline. The CI platform we are using is DroneCI, which is a self-service Continuous Integration platform for busy development teams. 1. Benefits Well, there are many benefits to integrate Slack to your CI pipeline. Here are some of them: You can get notified when the CI pipeline is running, failed or succeeded. The notification will be sent to the Slack channel you specified. Therefore, you can easily track the CI pipeline status in the Slack channel. You can also get notified when someone pushes the code to the repository. This is very useful when you are working in a team. You can get notified when your team member pushes the code to the repository. Slack is a very popular communication tool. Your team is probably using it. Therefore, it’s very convenient to integrate Slack to your CI pipeline. 2. Prerequisites You have a Slack account. You have a DroneCI account. 3. Steps 3.1 Create Slack Channel Create channel for receiving the notification. Give a name, for example, #ci-pipeline. Remember the name, we will use it later. Specify the channel visibility. In this example, we will make it private. Then click Create. 3.2 Create Slack App Make sure you have the permission to create Slack App. If not, please contact your Slack administrator. ...

[Golang] Retaining Specific Folders and Removing the Rest under A Target Path

Let’s consider a situation where there are multiple folders located under a specific path, and we only have the names of a few folders that we want to retain while removing the rest. For instance, the folder structure is presented below, with all entries being folders: ├── 123123 ├── 123456 ├── 123678 ├── 123789 ├── target-folder-1 └── target-folder-2 To tackle this scenario, we can approach it in two logical ways: Firstly, we can move the known folders to a different folder at the same level as the target path, as a temporary measure. Then, we can delete the target path and rename the temporary folder to match the path name. Alternatively, we can traverse through the target path and eliminate all folders except those we intend to keep. In this post, I will demonstrate how to implement the second method using Golang. ...

[mTLS] How to Generate Self-Signed mTLS Certs and Keys in 10s (No Click Bait)

1. Introduction No matter if you are a software developer, a quality assurance engineer, or a DevOps engineer, you may need to generate a self-signed mutual TLS(mTLS) or TLS certificates and keys for testing purposes. As the title shows, this post is not a click bait. I will show you how to generate a self-signed TLS certificate and key in 10s for both server and client. Of course, if you have mTLS certificate and key files, you can also use part of them as self-signed TLS certificate and key. ...

[ent/SQLite3] insert nodes to table "users": near "RETURNING": syntax error

Problem If you use ent with sqlite3 driver in your Golang project, you may encounter the following error when you try to insert a new record to the table. insert nodes to table "users": near "RETURNING": syntax error Analysis The error message indicates that the sqlite3 driver does not support the RETURNING clause. If you are using Golang sqlite3 package github.com/mattn/go-sqlite3 in your project. The issue may be caused by the version of the package. ...

traefik reverse proxy to non-containerized service

[Traefik/OCI] Exposing Internal Non-Containerized Services with Traefik on OCI: A Step-by-Step Guide

Traefik is a popular reverse proxy that can be used to expose internal containerized services to the public in a simple and intuitive way. However, if you want to expose internal services that are installed and configured directly on the host system instead of containerized, you may encounter some difficulties, particularly when using Oracle Cloud Infrastructure (OCI). This technical post will provide a step-by-step guide on how to expose internal non-containerized services to the public using Traefik on OCI. ...

[Gitea] RewriteAllPublicKeys failed: open /data/.ssh/authorized_keys.tmp: permission denied

Gitea has recently released version 1.20.0, and I endeavored to upgrade my locally-hosted instance from version 1.17.0 to 1.20.0. During this process, I encountered the following error when attempting to execute the docker-compose file: routers/init.go:60:mustInit() [F] code.gitea.io/gitea/models/asymkey.RewriteAllPublicKeys failed: open /data/git/.ssh/authorized_keys.tmp: permission denied Received signal 15; terminating. This issue is not exclusive to the new version, as some users have reported similar problems when upgrading from older versions, such as 1.17.3 to 1.18.0. ...

DigitalOcean Referral Badge
Sign up to get $200, 60-day account credit !