linux

Installing G-Mouse GPS Receiver And Reading GPS Data On A Raspberry PI

I was looking to add GPS to my Raspberry Pi (specifically the Clockwork uConsole) and found this USB GPS Receiver with 2m Extension Cable on the PiHut website.

The unit has a USB interface, a 2 meter long cable, and the GPS receiver itself is magnetic and so can attach to lots of different surfaces. Plus, since it was sold on the PiHut website I was quite confident that it would be easy to get working with the Raspberry Pi. As it happens, it was easy to get working, I just needed to install a couple of extra tools to make sure it was producing the correct data.

In this article we'll look at what happens when you plug in the GPS receiver, and then look at a couple of packages you can use to verify that the GPS receiver is working correctly. This assumes that you are running the latest version of Raspberry Pi OS.

Clockwork Pi uConsole CM4: A Review

I was doing some research into the Raspberry Pi a while ago and I happened to come across a neat little enclosure for the Raspberry Pi Compute Module 4 (CM4) called the uConsole.

The CM4 is essentially a normal Raspberry Pi 4, but it comes without the normal USB/HDMI interfaces that the Pi 4 comes with. This means that in order to use the CM4 you need to plug it into a separate PCB, which then provides the interfaces needed to attach monitors and peripherals.

This is where the ClockworkPi uConsole comes in. The uConsole (or micro console) is an enclosure for the CM4 that features a built in screen and keyboard, a track ball, small speakers, a battery pack, and an optional mobile network card.

Using The Fingerprint Scanner On Pop! OS 22.04

I work on a couple of ThinkPad laptops (T490 and a P14s) and whilst they have fingerprint scanners I haven't really considered using them. I once attempted to get a fingerprint scanner working in Linux on an old HP laptop and that experience put me off trying again.

When I looked into the getting the fingerprint scanner working on a ThinkPad with Pop! OS installed it turned out to be quite easy. The drivers were already present so it was just a case of installing the correct software and adding my settings.

Timing Page Responses With Curl

Timing web requests is possible in curl using the -w or --write-out flag. This flag takes a number of different options, including several time based options.

These timing options are useful for testing the raw speed of requests from a web server and can be an important tool when improving performance and quickly getting feedback on the response.

The -w or --write-out flag in curl has a number of different options, far more than I can add here. You can use these options by surrounding them in a "%{parameter}" structure and passing this as a string to the -w flag.

Turning On Or Off Fn Mode In Ubuntu Linux

I was typing on my Keychron K2 keyboard today and realised that I hadn't used the function keys at all. Not that I hadn't tried a few times, it's just that the function keys were linked to the media keys for the laptop I was using. When I pressed the F2 key it would increase the screen brightness, which was fine, but I realised that I had missed using the function keys for a while.

I was using Ubuntu 20.04 and there appeared to be no option to turn this off in the settings. After a little research I found a solution to the problem.

Repointing A Symlink To A Different Location

In Linux, creating a symlink is a common way of ensuring that the directory structure of a deployment will always be the same. For example you might create a symlink so that the release directory of release123/docroot will instead be just current. This is done using the ln command in the following way, the -s flag means that we use the ln (aka link) command to create a symbolic link.

Finding My Most Commonly Used Commands On Linux

I'm a proponent of automation, so when I find myself running the same commands over and over I always look for a way of wrapping that in an alias or script.

I spend a lot of my day to day job in the command line and I realised today that I must have typed 'git status' for the millionth time and wondered what my most commonly used commands were. So I found a stack overflow post showing my most used commands in a nice little bash one liner.

history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl |  head -n10

This command extracts information from the bash history and shows me the root command I have run. This showed me the following on my current system.

Grep Context

Grep is a really powerful tool for finding things in files. I often use it to scan for plugins in the Drupal codebase or to scan through a CSV or log file for data.

For example, to scan for user centric ViewsFilter plugins in the Drupal core directory use this command (assuming you are relative to the core directory).

grep "@ViewsFilter(\"user" -r core

The -r flag here recursively scans the 'core' directory. This command returns the following output.

Scanning Linux For Intrusion With RKHunter

RKHunter (or Root Kit Hunter) is a program that can be used to scan a Linux machine to see if there is anything there that might be a sign of a security breach. It will scan all of the files on the system and look out for any suspicious files or unexpected changes to system files that might indicate a security breach. Just like anti-virus systems it has a database of root kit definitions that it will use to compare files against to see if they are infected but will also just check for changes to core system files.

Some Useful Curl Snippets

Curl is an incredibly useful tool and has all sorts of flags and options available for every situation. I tend to use curl quite a lot for all kinds of stuff, and not just downloading large files. So I thought I would post a few of the most common things that I use the tool for. Note that most of the following URLs don't really exist, they are just for demo purposes. I have also left out the output of these commands as they vary from a few lines to many pages of output.