Run a comamnd after network-online.target is ready

tl;dr: Use this shell command in my crontab: @reboot sh -c "while ! systemctl status network-online.target > /dev/null; do sleep 1; done; exec /foo/bar.sh" The problem I've encountered is, sometimes /foo/bar.sh would failed at boot. After digging into details, I found it's because the network was not ready, therefore the script could not get network …

Flutter + auto hot reload/restart in console (CLI)

Flutter in CLI (mainly flutter run) cannot auto hot reload by itself in Linux, so we need to setup some commands to trigger it. The basic idea is to use inotifywait in inotify-tools (which is already in Debian/Ubuntu's APT repository): inotifywait -e create,delete,modify -mr android/ lib/ | awk "{system(\"test -e .git/flutter-run.pid && pkill -USR1 -F …

Disable TLS 1.3 for ocserv's segfault workaround

ocserv is an open-source VPN software compatible to many proprietary solutions including Cisco AnyConnect, so I use it for my iOS devices. Recently I noticed that my ocserv service was not working after upgrading to Ubuntu 22.04, and got this message: [Tue Sep 26 17:35:27 2023] traps: ocserv-worker[6826] general protection fault ip:7f09bab28898 sp:7ffd36c9add0 error:0 in …

Stream logs to Slack in Perl

I want to stream my logs on my home RPi3b to a Slack channel for my vacation side project. With some searches I found an article including a simple shell script to implement this function: "Stream Any Log File to Slack Using curl". However it's a little tricky as the script replaces " to ' …

The weird part of AWS bandwidth cost

I just got curious during handling the invoice of AWS. My gut feeling is that all inbound traffic are free (mostly), for example, you can see this in "Amazon EC2 On-Demand Pricing": Data Transfer IN To Amazon EC2 From Internet All data transfer in $0.00 per GB But if you're dealing with inbound traffic across …

Golang software packaging for offline environment

Open build services like Launchpad PPA usually forbid internet connections during building, therefore it's impossible to download dependencies during building, and we need to include all dependencies into the source package. Two things need to be done for building Golang softwares on no-internet building services: Download all dependencies into vendor/ via go mod vendor command. …