My Blog

The Lincolnshire Poacher - Beep Song

Written by Justin Goetz -
One night while my friend and I were talking about the mystery of number stations such as the Lincolnshire Poacher Number Station, which played a funny little tune at the beginning of every broadcast, I decided to make a beep script for it so we can continually freak people out (or rather annoy them) with this catchy little tune.

And so, I give you, The Lincolnshire Poacher - Written in Bash for the Linux "beep" command.


Running Jira over HTTPS Apache Reverse Proxy

Written by Justin Goetz -
For my job I have to run a Jira application server. This server needs to be run behind a Apache reverse proxy. The apache server needs to be the one serving the HTTPS. Of course, this couldn't be easy, because Jira has to be the most complex, convoluted confusing software I've ever worked with.
For this, after hours of testing, I realized that you need to use Apache's "AJP Proxy". To install, firstly run:
 a2enmod proxy_ajp

This turns the module on in Apache. Next we need a virtualhost config. This config is done the same way that we normally do apache reverse proxies, only instead of http:// we put ajp://.
Example Config: VHOST.txt
Next we need to change the config files of the jira server itself. Follow this part exactly.
1. Stop the Jira server. sudo service jira stop
2. Nano the server file located at /opt/atlassian/jira/conf/server.xml
3. Replace it with the attached config: server.xml
4. Chown JIRA to the proper directories sudo chown -R jira /opt/atlassian/jira/
5. Start jira sudo service jira start This takes up to 7 minutes, so don't think you broke the install
6. Enable the apache VHOST, ensure you can access it from the web browser.

Raspberry Pi Powered Garden

Written by Justin Goetz -

Just a little project I've been working on that consists of a Raspberry pi, relays, a temperature sensor, and a webcam. The raspberry pi controls the relay on a set schedule, as well as logging and graphing the temperature sensor. The pi also takes a picture from the webcam every day to make a timelapse video in the end of plants growing. Details on construction to come.

Set (Real) HTTPs in OpenCart

Written by Justin Goetz -
While setting up a site for a client, I ran into some trouble with OpenCart and HTTPs. Apparently, for whatever reason it was speculated that HTTPS "slows down" the load time for some pages, so the developers decided to only use HTTPS for the checkout portion of the site. For an e-commerce site, this was completely unacceptable to me. I want EVERYTHING on that site to use HTTPs. So finally after about 5 hours of working with Google, I discovered a wonderful blog post. Here is the link.

The poster said to do the following, and sure enough, it worked!

Look in upload/system/config/catalog.php and upload/system/config/admin.php. Set $_['site_ssl'] = false; to $_['site_ssl'] = true;

X2X, The Underrated Program

Written by Justin Goetz -

Recently, I've found myself in need of a "Keyboard and mouse" sharing application for my linux work stations. I've acquired 2 more work stations, and naturally I couldn’t fit anymore keyboards on my desk... So I needed to find a way to share my keyboard and mouse from one computer to another. A good friend of mine, Adam Longwill, uses a program called a cross-platform program called Synergy to manage his linux computer from his main windows workstation. This program is great, but it is a paid program. I couldn’t quite justify the cost, and I knew the open source community had to have something out there.

I searched for quite a while before stumbling on the "Jewel" of linux mouse & keyboard sharing software. (At least in my opinion.) This program is called X2X. I honestly love this program. It allows seamless mouse and keyboard sharing from one linux desktop to another, all over an encrypted SSH connection.

The downfall? The project has been updated in forever, and some of the files in the github repository date back to almost a decade ago. I'm saddened by the fact that this program has no real home page, and isn't as popular as it should be. With a little TLC, this program could be so much more. I wish I had the coding skills required to contribute to the project, but its beyond my league. Anyway, heres a small guide for myself (And possibly the few readers who see my blog) on how to get this working.

Automating X2X | X2X Can be setup in a way that connecting is seamless. Personally, I have a setup where on my main control PC, I have a desktop shortcut that executes the SSH command. Please note, this method may not be the best way of setting up X2X, but with the lack of support I could find no other way. To begin, I installed x2x on both computers. This is as simple as running:

sudo apt-get install x2x

Next, I setup SSH keys for my SSH session, so I would not be prompted for a password when launching my X2X connection from a desktop shortcut. If you don't know how to setup SSH keys, theres plenty of tutorials online, such as this excellent one from Digital Ocean.

Last, I setup a desktop shortcut to run the following SSH command. Note: This step is not required, and running this command straight out of terminal will work as well.

ssh -XC user@ x2x -east -to 0:0

The above command can be customized. Where -east is, you can set this to where your other workstation will be (North, east, south, west). Leaving the other arguments of the command as default should work fine.

This was just a brief overview of the X2X command, a severely underrated program in the linux world, at least in my opinion. Let me know if you run into issues in the comments.

Rebuilding mdadm RAID 5 Array

Written by Justin Goetz -

Recently, a drive failed in my software RAID 5 Array. These are the steps I found to take.

1st, remove the dying drive from the RAID.

mdadm --manage /dev/md0 --fail /dev/sde1
mdadm --manage /dev/md0 --remove /dev/sde1

Once the drives are removed from the RAID array, power down the server and replace the drive. Be certain that you are replacing the correct one. I used my drive's serial number to identify which one to remove.

Boot the server again, and login to a terminal. Now, the new drive should appear in the same /dev/sd* format as the previous drive. Now we copy the partition table from the other drives to the new drive.

/sbin/sfdisk -d /dev/sda | /sbin/sfdisk /dev/sdb

Once that has completed, verify that the drives have appeared in the /dev directory.

ls /dev/sdx*

Now just add the drive back to the RAID with the following mdadm command.

mdadm --manage /dev/md0 --add /dev/sdb1