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?

Wednesday, February 24, 2016

Running Python pip on a specific python installation

Python versions are a bit confused on my Ubuntu install right now. If I type "python" at the command line I get Python 2.7. If I type python3 then I get Python 3.4. And python3.5 gives me Python 3.5. Not usually a problem because I put the correct entry in the shebang of the script I am running, but it is sometimes difficult to get pip to install in the right place (or, I should say, to figure out where pip installed and determine if it is where I want it, because who knows what the "right" place is?).

Wednesday, November 18, 2015

Useful Byobu Commands

Using the terminal in Linux is a must, but sometimes it is a little restricting (especially when logged in over an SSH session). Screen has been a longtime solution for these limitations, providing a terminal user some simple commands to switch among terminal sessions and easily keep sessions running in the background, but recently I have been using Byobu instead. Byobu is built on Screen as well as another solution called tmux.