Runar Ovesen Hjerpbakk

Programmer. Software Architect. Technical Manager.


FindRef - find those references!

.Net is awesome and especially .Net Core Global Tools. Similar to npm install -g you can install tools by executing and easy command:

dotnet tool install --global [name-of-global-tool]

Running the tool is as simple as:

[name-of-global-tool] [arguments]

Just like that you get access to thousands of useful tools, without running installers or browsing to find the correct binary for your system. These tools will run on all platforms supported by .Net Core, both macOS, Windows and Linux. This is truly the power of a cross-platform, open ecosystem. The only pre-requisite is an updated .Net Core SDK installed on your machine.

Read More

Script for creating transparent PNGs

Introducing transparent-png, a simple Python script for creating a transparent PNG of a given size.

Read More

Lookup IP from DNS name

As you can read from this blog, operations was never my main interest. But in these days of DevOps, I’m getting exposed to more hosting environments than I’ve ever been before.

Since I was a small child I knew about ping to check if a server was online and see its IP-address. Today I learned about nslookup.

Read More

Simplify your crontab entries with

As you’ve seen from my previous posts, I’ve used cron a lot lately to schedule periodic tasks on my RaspberryPi. cron is driven by crontab, cron table files, configuration files that specifies shell commands to run periodically on a given schedule.

# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday;
# │ │ │ │ │              7 is also Sunday on Raspbian)
# │ │ │ │ │
# │ │ │ │ │
# * * * * *  command to execute

The timing syntax is understandable enough. In addition to numbers, we can use special operators:

*	any value
,	value list separator
-	range of values
/	step values

An expression to achieve At 22:00 on every day-of-week from Monday through Friday looks like this:

0 22 * * 1-5

My problem is that I get the elements confused. Without reading the explanation, is 22 in the expression above minute or hour? You have to read the spec to find out.

Read More

Shrinking a Raspbian installation to save space

Yet another Pi post!

When I put Raspbian on the SD card used by my Raspberry Pi, I used the Raspbian Stretch with desktop version. That was perhaps a poor choice on my part, as I use the machine as a headless server. However, I’m not that skilled with Desktop Linux, so the mere fact that there were buttons to push during the installation and stuff actually worked, made me feel like a pro.

All those packages that I’ll never use, like LibreOffice, still take up precious space, so I wrote a simple script to remove some of them.

Read More

Automatically update and upgrade Raspbian

Continuing the theme of last night, today I improved the upgrade experience of my Raspberry Pi.

Manual upgrade

As per the documentation, update and upgrade are as easy as running these two commands. First update your system’s package list:

sudo apt -y update

Then upgrade all installed packages to their latest version:

sudo apt -y dist-upgrade

I use -y to answer yes to all prompts by default. Easy enough, but in our modern DevOpsy world, we need to automate this.

Read More

Automatically update OpenSSH on a Raspberry Pi

I just bought myself a gorgeous Raspberry Pi 3 Model B+ to use as a headless server and all-round tinkering machine. It’s small, power efficient and fast enough for my usage:

  • Cortex-A53 (ARMv8) 64-bit SoC @ 1.4GHz

Enable SSH support

Installation is super easy, just follow the instructions on Raspberry Pi website, with one exception. As of the November 2016 release, the default Raspberry Pi OS, Raspbian, has the SSH server disabled by default.

To enable SSH, you need to either configure it after OS installation has completed as per instructions here, or while preparing your SD card:

For headless setup, SSH can be enabled by placing a file named ssh, without any extension, onto the boot partition of the SD card. When the Pi boots, it looks for the ssh file. If it is found, SSH is enabled, and the file is deleted. The content of the file does not matter: it could contain text, or nothing at all.

Read More