I have been using AI coding assistants for a while now. They all do roughly the same thing: help you write and understand code faster. But the one I k[……]
Category: Programming
AWS dynamic IP ranges
Need to know the dynamic IP ranges used by AWS in a specific region? AWS publishes this as a JSON file.
curl -s https://ip-ranges.amazonaws.com/ip-ra[......]
Find sdx device/ATAx mappings
When dealing with hardware, you often see log messages like:
ata9: hard resetting link
ata9: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
To map[……]
Convert Squid/timestamps to a human readable format
Somebody had the brilliant idea of using Unix timestamps in Squid log files. It makes parsing easy but reading them is not so human-friendly.
This is[……]
bash – remove first line with tail and last line with head
Say you have a file called test.txt:
line 1
line 2
line 3
Remove the first line:
tail -n +2 test.txt
Remove the last line:
head -n -1 test.txt
R[……]
sed – match and replace BIND/DNS serial number programmatically
I had to make modifications to several BIND zone files. Sed proved itself invaluable once again.
The zone files looked like this:
domain.com. IN SOA[......]
Remove all non-ascii characters with perl
Sometimes when creating one-liners, the source contains non-ASCII characters that make parsing harder. To strip them all out, use Perl:
cat dirty-sou[......]
Converting spreadsheets to text files with ssconvert
ssconvert is a utility shipped with Gnumeric, a command-line spreadsheet converter. It is useful when you have data in a spreadsheet and want to parse[……]
How to update all docker base images with one command
To pull the latest version of all your Docker images at once:
for docker in $(docker images | awk '{print $1,$2}' | sed 's/ /:/g' | grep -v REPOSITOR[......]
How to update all pip python packages with one command
To update all your pip-installed Python packages at once:
sudo pip install -U `pip list -o | cut -d ' ' -f1 | tr '\n' ' '`
This lists outdated packa[……]