Feng's Notes Isn't coding fun?

Learn How to Build Go Applications From Grafana

Grafana has developed really fast in the past few years. It has been the de facto standard for observability. I have been using grafana and loki for a while and I am really impressed by its performance and the quality of the code. Grafana builds most its backend components in Go. Meanwhile I am also using Go to build stuff. So it seems a good idea to learn some good practice from Grafana’s codebase.

Build Go Commandline App With Cobra

The framework I am using to build this blog is Hugo. Under the hood, it uses Cobra to build the command line interface. Besides Hugo, Cobra is also used by many other popular projects such as kubectl, github cli, etc. I was curious about how it works so I decided to learn by building a simple command line app with it. The app I am going to build is a regex tool that uses openAI’s API to generate a regex expression based on a list of strings or the semantic meaning of the given strings(e.

Goroutine Pool review

Goroutine is perhaps the main reason why people choose golang for their projects. It is a lightweight thread managed by the go runtime. It is also easy to use. You can simply use go keyword to start a goroutine. However, if you need to run a large number or cpu intensive goroutines, you might want to use a goroutine pool to manage them and make sure you don’t run out of memory or cpu resources.

Task queues in different languages

Task queue is used widely in software development. It is a mechanism to distribute work across threads or machines. It is also a way to coordinate workers to perform tasks. The scenario could be a web application that needs to process a large number of requests, a data pipeline that needs to process a large amount of data or a scheduled job that needs to run periodically. I have used task queues in different languages.

Rss reader in golang -- Miniflux review

Background I have been using feedly for years to read rss feeds. It is a great service however it grows more and more complicated and tries hard to sell me their premium features. I understand that they need to make money, but I decided to find a self-host solution for my simplest need: read self selected rss feeds on a clean UI. no AI recommendation, no social sharing, no fancy features.

Cache on the edge with Cloudflare Workers

I recently found a nice project which offers iframe line to display stars of any github repo. I found it could be useful on my another building website which aims to track the trending repos on github. So I tried to put it on and it worked well…at first. How when I put several repos on one page the tool stopped working and don’t show the star number. I checked its source code https://github.

Streamlit app to manage your cloudflare images

In my previous article I introduced how to build a sql chatbot with langchain and streamlit. I was then thinking if I can use streamlit to manage my image gallery on cloudflare. I found it was as easy as I thought, of course with a bit help of chatgpt.. Why I need this I have been using cloudflare images service for a while and satisfied with its speed. However, it doesn’t have a good UI tool.

How to queue up jobs in nodejs

I have a service written with nodejs when I found some requests took too long to process. so I decided to queue up the requests and process them one by one. I used Celery in python projects before, so I was looking for something similar in nodejs. Then I found Bull which is a Redis-based queue for Node. Here are some essential notes that would be helpful if you want to use Bull in your project.

How to Build An Browser Extension Plugin 2023

I use several browser extensions in my daily work. One of the most useful one is youtube-playback-speed-co it is so simple yet so powerful and saved me a lot of time on adjusting the playback speed of youtube videos. Then I wonder how it works and if I can make one myself. So I did some research and here is what I found.

Github Action Manual Approval Practice

Our team has been using github action for CI/CD for a while. It’s very convenient and easy to use. We use it to build docker images, push to docker registry and deploy to kubernetes cluster. But there is one thing that we are trying to improve, that is we want to have a manual approval step before deploying to production. We tried many methods but none of them works well until we found this manual-workflow-approval action.