Using Templates with Caddy and Hugo

Hugo is a static site generator. However sometimes we want to serve dynamic contents. We can embed javascript to achieve what we want, but why not use templates when they’re more convenient? Caddy Template Engine Caddy comes with a powerful template engine that is based on golang standard library. Some of the sites (including Caddy’s official website) are built this way. The list of template functions/actions can be viewed here. In addition, caddy also support all Sprig functions....

published on October 10, 2023 · 3 min · 472 words

Using Github Actions to Build Linux Kernels

Google released BBR v3 nearly two months ago. To try it out, we have to use a kernel which is compiled from a source that has this patch. We can compile the kernel ourselves or be lazy and use a kernel compiled by others. But what fun is there if we take the easy way? About GitHub Actions GitHub Actions can be used to automate software workflows, from building to deploying....

published on September 21, 2023 · 4 min · 808 words

Implementing JSON RPC With Python

In a previous post, I mentioned using yt-dlp as a service to extract YouTube information. The method I used has one serious problems: it uses a custom protocol that serves one request per connection and dumps the error as a string if any. To find out if there is an error, we have to parse the result first and if it’s not a valid json string, we can be sure there’s an error....

published on September 6, 2023 · last edited on September 15, 2023 · 5 min · 908 words

Customizing ArtPlayer

ArtPlayer is a modern and fully-featured HTML5 video player that is very easy to use. In this post we show several examples how to customize it to better suit our needs. Schedule a Pause Sometimes we want to pause a video after some time has passed. We can use an input html element to enter the amount of the time after which the video will pause. However, we can sort of hack it as an ArtPlayer setting....

published on August 28, 2023 · 3 min · 480 words

Proxying Youtube Videos Part III

Previous post shows how to create a mpd manifest from the result of yt-dlp and play it using various players. However, there are some problems when we use the manifest with other tools such as ffmpeg and other video players rather than shaka-player and dash.js, mainly in the form of slow buffering. Determine the Cause of Slow Buffering First we determine how a browser requests YouTube assets. Open devtools: Request Query Parameters and Payload We can find the request is a POST request with query parameter range and payload x\n....

published on August 9, 2023 · 3 min · 555 words