Using GitHub Actions as a VPN Server

In regions where the Internet is strictly regulated (e.g. China), direct access to well-known websites such as Google, youtube, Twitter, etc. is not available. This article introduces a technique to break through network blocks based on the GitHub Actions service, which allows you to watch YouTube 4k videos smoothly, with unlimited traffic, completely free! GitHub Actions is a free build tool provided by Microsoft for developers. Whenever a task needs to run, GitHub creates a virtual machine (2C4G) in the Azure cloud.

NGINX Dynamic and static mixed path Overlay

I recently came across a requirement to implement something like Overlay FS with NGINX when deploying MediaWiki. Specifically, I was using the Git version of MediaWiki and needed to add some custom files to the directory (such as logos, favicon.ico, various verification files, etc.). I wanted to keep these files separate from the source code in order not to pollute Git and to reduce the hassle when upgrading. To abstract the problem, NGINX needed to serve from /srv/foo/orig, and now it needs to additionally try to search for files from /srv/foo/overlay in addition to the original path (note that unlike Overlay FS, the original path is used first).

Golang Generics in HTTP API

Golang started to support generic types from version 1.8 start, and I believe many people are in the same wait-and-see state as me. Now that Golang has been released to version 1.19, I think it’s a good idea to give it a try. Example of adding two numbers together One of the most common examples of previous calls for Golang to introduce generics is a scenario like adding two numbers together.

How to implement hot reload config

Sometimes some processes must inevitably have the problem that restarting is too costly. For example, there are processes with long connections where restarting will disconnect and then all clients will need to reconnect, or processes that already have a lot of content cached in memory that will need to be rewarmed if restarted. But then there are configurations where we want to modify the configuration of the process without restarting it.

Compiling Rust projects with Nix

Rust projects are generally managed with Cargo, but it has the disadvantage of having to recompile all dependencies once per project, taking up a lot of hard disk space, and not being able to share the build cache across projects. After some research, there are several Nix-based Rust build tools: cargo2nix: https://github.com/cargo2nix/cargo2nix carnix: no longer updated crane: https://github.com/ipetkov/crane crate2nix: https://github.com/kolloch/crate2nix naersk: https://github.com/nix-community/naersk nocargo: https://github.com/oxalica/nocargo I’ll try out each of these tools below.

From .go text files to executable files

Go is a compiled language, and the *.go text files we write are called source files, and the contents of the source files are our source code. For the source code to run on the target machine, it must be compiled into a binary machine code file, or executable, that is directly recognized by the operating system using the Go compiler (abbreviated gc, which stands for Go compiler). The operating

volatile in C

When learning C language there is a strange keyword volatile, what exactly is the use of this? volatile and the compiler First look at a piece of code like this. 1 2 3 4 5 6 7 int busy = 1; void wait() { while(busy) { ; } } Compile it and note that O2 optimization is used here: Let’s take a closer look at this generated assembly.

void_t in C++17

I recently discovered an interesting feature: void_t. void_t is a new feature introduced in C++17, and its definition is simple (some compiler implementations may not be, but they are broadly similar). 1 2 template< class... > using void_t = void; It looks simple, but with SFINAE it can be very useful in template metaprogramming. For example, determining at compile time whether a class has a certain type using.

DNS Query Principle Explained

The IP address of the domain name is obtained by DNS lookup in order to access the website. So, how exactly does a DNS lookup work? This article describes the steps behind it in detail with examples. 1. DNS Servers The IP addresses corresponding to domain names are stored in DNS servers. When we enter a domain name, the browser will automatically send a request to the DNS server in the background to get the corresponding IP address.

Install and use tftp server on Centos.

1 Installation If the network is available, you can install it directly via yum. 1 yum install tftp-server You can also download the rpm package first and then install it, download at http://rpmfind.net/linux/rpm2html/search.php?query=tftp-server Then install. 1 rpm -ihv tftp-server-0.49-8.el6.x86_64.rpm After installation, you can find an additional in.tftpd file in the /usr/sbin directory. 1 2 $ ls /usr/sbin/in.tftpd /usr/sbin/in.tftpd 2 Configuration in.tftpd is managed through the xinetd service.