Thursday, July 30, 2020

Text Fragments: Highlight text in a page you are linking to

Text fragments are a new feature that you can include in URLs to highlight specific text in the page you are linking to. You can read more about them here (or read the specification for them here), but essentially they let you link to a page and when the user arrives at the page they will see a text fragment highlighted. The spec gives you some flexibility for finding particular fragments of text based on some start and end searches, but the basics are that you add #:~:text=text%to%highlight at the end of your URL and everything just works (assuming your browser supports it).

Note that this is for highlighting a specific block of text, not for finding all occurrences in text. I can highlight a specific phrase. For example, this link highlights a sentence on a post about Docker and port forwarding).

Sunday, June 21, 2020

Installing Node and Angular CLI on Ubuntu

To create applications in Angular, the Angular Command Line Interface is required, which in turn requires Node to be installed. The installation is pretty straightforward, but following the stock instructions from Angular on Ubuntu gave me permission errors. So here is the process to install the required Node parts and the Angular CLI on Ubuntu to allow development of Angular apps.

Friday, January 27, 2017

Port Forwarding to Reach a Docker Instance

I have a docker instance running on a server that I can SSH into, but I am working remotely and would like to access its services. There are ways to set up something running in Docker so that it passes through and exposes the port from the host machine, but who wants to go through some complicated setup for something you are developing temporarily? I just want to be able to reach the web server that is exposed to the host computer without going through too much effort.

Sunday, January 8, 2017

Memtest86

The memory testing tool on bootable Linux distributions seems to have disappeared. It used to be when you booted up a CD or USB with a live Linux distribution like Ubuntu that there was an option for a memory test. Now that option seems to be gone. I needed to test the memory on a desktop PC (a new one with UEFI) and couldn't find it on any bootable downloads. Also, the PC was finicky about what would boot (probably because of UEFI, but I'm not sure about that).

I had never previously used the freestanding Memtest86, but it is a small download and creating the bootable USB was very simple (at least, it was on Linux). It booted just fine on a brand new UEFI PC and ran a comprehensive memory test in a few hours. So if you are looking for a memory test, skip the full distribution download and just get the bootable Memtest86.

Friday, October 21, 2016

Using a previous version of Maven in Ubuntu

There are some issues in the current version of Maven (v3.3.9) that were giving me some problems with a plugin that is in use. I needed to revert to v3.3.3 under Ubuntu. Instead of uninstalling maven and manually installing the previous version, I can take advantage of Debian's update-alternatives infrastructure which is included with Ubuntu. This lets me install both versions that I need and switch between them via a simple command. The instructions for installing the different version of maven are well laid out here.

After following those instructions, a simple "sudo update-alternatives --config mvn" allows me to pick the version which will be used with the "mvn" command and avoid my version-based troubles.

Tuesday, August 30, 2016

Grep for a particular file type

Grep is great for searching recursively through a directory of source code, but it annoyingly wastes time looking at binary files and other file types that I am not interested in. When I am looking through some Java code for a reference to something like writeTextToLog(), I would ordinarily go to my top level directory and use

grep -r "writeTextToLog(" .

But this returns lots of binary target file results like this that clutter the screen and sit there chewing up time:

Grep for a particular file type

Grep is great for searching recursively through a directory of source code, but it annoyingly wastes time looking at binary files and other file types that I am not interested in. When I am looking through some Java code for a reference to something like writeTextToLog(), I would ordinarily go to my top level directory and use

grep -r "writeTextToLog(" .

But this returns lots of results like this that clutter the screen and sit there chewing up time:

Wednesday, June 15, 2016

Some data tools

There are some good command line data tools in this blog post for working with data. Specifically, csvkit is pretty useful.

Wednesday, May 11, 2016

Figuring out which internet connection is being used

Now that fiber connections are more widely available (including in my house) sometimes I will plug my laptop in to a wired connection so that I can take advantage of the higher speeds. For general browsing and listening to music it doesn't make much difference whether I am on wifi or wired in, but when transferring large amounts of data, it can make a big difference. But when I plug in the wired connection, do I need to disconnect my wifi to ensure I am using the connection? How do I tell which connection is being used? The answer is found with the Linux tools route and traceroute.

Monday, April 4, 2016

Viewing login attempts

Open an ssh port to the internet and in a short time you will see all kinds of login attempts. There will be repeated attempts to access your system using usernames such as "admin" and "root" and others that are presumably left unguarded on systems somewhere. There are all kinds of simple steps to take to ensure that these attempts are not successful and that they don't overwhelm your system (such as using fail2ban). The log files auth.log and syslog (found in /var/log) will be full of attempts, but how do you look to see if anyone has successfully logged in?