cover image about deleting files

Easily Copy/Delete Hidden Files in a Directory

Those nasty little dot files… When I tried to setup a Gitlab continuous deployment, I encountered a tiny problem: How to remove all files within a Linux directory? Apparently it is quite easy. Just with a simple rm -rf dir/* Wrong! The above command rm -r dir/* only remove all visible files and directories from the directory dir. It does not remove hidden files and directories. Similarly, I also had to copy all files from one directory to another....

July 13, 2021 · 3 min · bhat
cover image about fixing zsh glitches

Fix Annoying Cursor Glitches of Zsh Autosuggestions

Installing new Arch Linux machines are always delightful. Customization, lightweight, and maximum performance. However, in my career of installing 5 Arch Linux servers, there is this one server that always seems fishy. When zsh-autosuggestions tries to suggest past commands, the terminal’s cursor always gets messed up and starts to glitch everywhere. Deleting current characters would result in random characters disappearing, and random typing errors would appear when you press enter. This has never appeared on my other machines....

July 12, 2021 · 1 min · bhat
cover image about Wireguard with shadowsocks

Hide your VPN traffic: Obfuscate Wireguard with Shadowsocks Tunnel

Wireguard sure is nice. It is both easy to use and has quite good network performance. It is almost unambiguously better than its predecessor, OpenVPN. Moreover, Wireguard is already deployed everywhere (yes, Cloudflare Warp is pure Wireguard). So, what’s the problem? If Wireguard is so good, just use a Wireguard VPN everywhere, and you can forget about leaking your IP addresses or being DDoSed. Besides the miniature network latency impact, there is a simple problem: Wireguard traffic can be easily identified....

July 11, 2021 · 4 min · bhat
cover image about AVIF images

Use AVIF Images in your webpage with JPEG Fallback

AVIF is the next big thing in image format. It is a lossy/lossless image format that originates from the video codec AV1. In other words, AVIF to AV1 is like HEIF to HEVC, except AVIF is open, royalty-free, and pushed by a lot of big companies. Just like AV1, AVIF has a bunch of modern features. HDR, 10-bit color depth, etc. In a webpage, AVIF means saving bandwidth and higher compression ration....

July 1, 2021 · 2 min · bhat
cover image about printing docker env variables

Output Environment Variables of a Docker Container

One time, I set up a Docker container with my Cloudflare API token as the environment variable. docker run -e API_KEY=<my_api_key> <some_user/some_container> I forgot the token in the process, and now I want to retrieve the API token. It should be as easy as listing all manually added environment variables. Apparently Docker does not have such function? There is no such command as docker container env ls. Well, turns out we have to do it the old-fashioned way....

June 27, 2021 · 2 min · bhat