Fun Linux Videos

Posted: 2018-11-25 23:31:45 by Alasdair Keyes

Direct Link | RSS feed


I'm not quite sure how (I think it was probably via Hacker News) but I came across the Youtube channel of Bryan Lunduke. https://www.youtube.com/user/BryanLunduke/

I don't really have any idea who he is, but he apparently gives a lot of talks at Linux North West conferences in the US. They're mainly a lighthearted and humourous look at Linux/Operating Systems and software in general. This includes what appears to be a decade long series of talks entitled "Linux Sucks".

As this weekend was fairly slow I got through a few of his videos, some of which I've listed below. Well worth checking out.


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

The Future Is Bright

Posted: 2018-10-22 15:57:09 by Alasdair Keyes

Direct Link | RSS feed


Just what every right-minded developer has wanted. Perl in the browser!

https://webperl.zero-g.net/


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

Advertising and Malware block list

Posted: 2018-09-28 08:59:15 by Alasdair Keyes

Direct Link | RSS feed


Via a Hacker News article https://news.ycombinator.com/item?id=18075159 I came across a link to this git repo https://github.com/StevenBlack/hosts .

It's a curated list of known advertising and malware hostnames that can be added to your system hosts file to protect your system from shady sites accessed by your browser as part of included javascript/tracking pixels etc. As long as your browser still uses your system resolver instead of being set to DNS over HTTPS it should provide a good degree of security for your browsing.


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

Mojolicious v8 release

Posted: 2018-09-19 11:14:22 by Alasdair Keyes

Direct Link | RSS feed


Perl 5 is often seen as a dated, if not dead language, consigned to being hacked together by a sysad to keep some legacy platform from the 90s ticking over.

Sadly that part is true, but there is still life in the old dog yet, helped by the recent release of version 8 of the Mojolicious framework.

If you've not played with Perl but you have an interest, Mojolicious is a good entry point and I'd recommend it for any new projects. It's built in support for web-sockets makes it very suitable for modern back-end platforms.

https://mojolicious.org/


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

Github and Gitlab user public keys

Posted: 2018-09-02 11:18:15 by Alasdair Keyes

Direct Link | RSS feed


During installation of Ubuntu Server 18.04 today I noticed that the user creation section had an option for configuring SSH public keys from Github, this is a very useful feature but I was intrigued as to how these were exposed. It turns out that you can use the following URLs to get the keys for a given user for Github and Gitlab

https://gitlab.com/<username>.keys and https://github.com/<username>.keys


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

Nagios NRPE wireguard check

Posted: 2018-08-30 16:41:36 by Alasdair Keyes

Direct Link | RSS feed


After playing around with Wireguard today (of which I'll no doubt do a more fully featured post). I wrote a quite Nagios NRPE check. There's not much to check with Wireguard, but it queries the wg show output for the number of interfaces and peers. Full arguments are in the README. Let me know if you have any suggestions for future behaviour.

https://gitlab.com/alasdairkeyes/nagios-plugin-check_wireguard


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

akeyes.co.uk - Now on HTTP/2

Posted: 2018-08-29 14:48:04 by Alasdair Keyes

Direct Link | RSS feed


Since HTTP/2 was implemented in NGINX, I've wanted to use it on my sites. Unfortunately due to one of my VPS providers not providing a Debian 9 image, I was stuck on Debian 8 with an NGINX version that didn't support it.

Now that I've upgraded all my machines to Debian 9 I have finally updated my sites to make use of HTTP2. Combined with the upgrade to PHP7.x at the same time it should allow some performance increase for my sites.


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

LXC config error after update

Posted: 2018-07-19 21:46:48 by Alasdair Keyes

Direct Link | RSS feed


At some point in the recent past Linux Mint 18.3/Ubuntu 16.04 Xenial had updated lxc containers to a more recent version and when running lxc-ls I was greeted with the following error for all of my containers.

# lxc-ls
Failed to load config for mydevcontainer1
Failed to load config for mydevcontainer2
Failed to load config for mydevcontainer3
Failed to load config for mydevcontainer4

It appears support for an older container config version has been discontinued and it was unable to read the old versions, a bit of Googling found the answer was to use lxc-update-config helper utility.

# lxc-update-config -c /var/lib/lxc/mydevcontainer/config
# lxc-start -n mydevcontainer
# 

For those with a lot of containers, the following one liner will resolve them all for you in one fell swoop

lxc-ls 2>&1 | grep "Failed to load config for" | awk '{print $NF}' | xargs -i lxc-update-config -c /var/lib/lxc/'{}'/config


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

From Github to Gitlab

Posted: 2018-07-08 16:54:20 by Alasdair Keyes

Direct Link | RSS feed


I've had a Gitlab account for a couple of years because of their facility for free Private repos and since then I have pondered moving all my Public Github repos across but never had the inspiration. The main reason not to was because Github was the de-facto Source Control site, so when dealing with non-tech people like recruiters, it was easier to just point people at Github rather than explaining the lesser known (at the time) Gitlab.

Now with the acquisition of Github by Microsoft, I've got the inspiration. With the exodus of many repos to Gitlab, they now have a much greater reputation outside the tech-circle so my code has now been moved.

The Github projects still exist but just have a README.md directing people to Gitlab.

https://gitlab.com/alasdairkeyes


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

Perl Capture::Tiny

Posted: 2018-05-31 08:01:22 by Alasdair Keyes

Direct Link | RSS feed


For such a versatile language, Perl has no good built-in way of running an external commands.

You can obviously use exec(), system() or even the dreaded back ticks ``. But often when running commands you require different things. Maybe you just need an exit code, so system() is good. If you're looking to capture output, exec() or backticks are more suited for the job, but then escaping input and using pipes or redirects then becomes a nightmare.

Last year worked on a project that required a large amount of systems integration and calling binaries, to run tasks and process output so I had to find a reliable and useful method. Mixing system(), exec() was possible but as I would be handing the code off to the customer, having a single way of running commands is a lot cleaner.

I came across https://metacpan.org/pod/Capture::Tiny. It provides a clean interface for capturing output from both Perl code and running system binaries.

#!/usr/bin/env perl

use strict;
use warnings;
use Capture::Tiny ':all';
use v5.20;

my ($stdout, $stderr, $exit_code) = capture {
    system("ls", "/var");
};

say "STDOUT\n$stdout";
say "STDERR\n$stderr";
say "EXITCODE: $exit_code";
STDOUT
backups
cache
games
lib
local
lock
log
mail
opt
run
spool
tmp

STDERR

EXITCODE: 0

The only flaw seems to be that it doesn't handle the capturing of output long running processes that will spit out text slowly. For that you will want to use something like pump on https://metacpan.org/pod/IPC::Run


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

IT Consultancy Services

I'm now available for IT consultancy and software development services - Cloudee LTD.