Because eloquence is, like, whatever.



New project: bash boilerplate generator on

I like to automate. I like it so much that I will not hesitate to spend 8+ hours on writing a script that replaces 5 minutes of work every month. Most of my automation is for CLI (command line interfaces)…. Continue Reading →

Track your (Synology) NAS when it’s stolen

When a friend of mine recently got his MacBook stolen, I quickly verified if I had installed Prey Project on each laptop/desktop PC I have. For those who do not know Prey: Prey lets you keep track of your phone… Continue Reading →

Redirecting with Apache’s .htaccess

When you migrate web sites from one place to another, and the URLS change, you don’t want to lose visitors that still use the old links. If your ‘old’ website ran on Apache, you can use its mod_alias/mod_rewrite functionality to… Continue Reading →

Convert Bind DNS zone into PTR records

The following script I made in order to convert the forward DNS records in a /var/named/db.[domain] file into the correct format for a reverse DNS db.[subnet prefix] file. #!/bin/sh (…) DNSROOT=/var/named PREFIX=$1 DOMAIN=$2 shift 2 DNSPRE=$DNSROOT/db.$PREFIX DNSDOM=$DNSROOT/db.$DOMAIN echo “; save… Continue Reading →

Installing NTP (time synchronisation)

Set timezone (optional) create symbolical link from /usr/share/zoneinfo/… to /etc/localtime: ln -sf /usr/share/zoneinfo/Europe/Brussels /etc/localtime Set UTC mode (optional) if your hardware clock runs in UTC (Universal Coordinated Time) mode, add UTC=true to the /etc/sysconfig/clock file Make sure ntpd is not… Continue Reading →

Perl HTML scraping part #1

Here we are, back at the scene of the crime. Yes, I know it’s been a while. And the task of the day is: GOAL: make an HTML scraper, i.e. a script that grabs another URL and outputs the results… Continue Reading →

Squid cachemgr.cgi UI hack

Squid has a little system statistics viewer built-in: The cache manager (cachemgr.cgi) is a CGI utility for displaying statistics about the squid process as it runs. The cache manager is a convenient way to manage the cache and view statistics… Continue Reading →

Probe disk performance (MRTG)

The hdparam can be used to monitor the throughput speed of a hard disk: # <strong>hdparm -tT /dev/hda</strong> /dev/hda: Timing buffer-cache reads: 888 MB in 2.00 seconds = 444.00 MB/sec Timing buffered disk reads: 20 MB in 3.30 seconds =… Continue Reading →

Date formatting in GAWK: boot time

I have one server with apparently an exceptional stability: # uptime 3:45pm up 524 days, 1:22, 1 user, load average: 0.44, 0.16, 0.13 Unfortunately I know this is not correct (I remember rebooting it some weeks ago). So what are… Continue Reading →

Probe average cpu utilisation (MRTG)

There are two main tools to keep track of your CPU usage: top and vmstat. top is an interactive tool: it shows you the CPU usage of each process, as well as overall statistics, updated every 5 seconds. It’s good… Continue Reading →

Estimate # of lines in a log file

Let’s say you need an (approximate) count of the number of lines in a huge file. The most obvious way of calculating this would be using wc, but this actually can be quite slow: # time wc -l /var/log/squid/access.log 2812824… Continue Reading →

Calculate hit rate from a log file

You have a huge file that contains one line per request/transaction. Some of the lines are of one type (e.g. ‘HIT’), some of another (e.g. MISS). Let’s say you want to calculate the hitrate, but as fast as possible. We… Continue Reading →

© 2019 — Powered by WordPress

Theme by Anders NorenUp ↑