Backcountry Binaries

Climb Mountains & Automate Things

Category: Development

‘Rungeon’ – A Working Title

My newest project in the game-space is a very faithful recreation of Zelda for the Super Nintendo.

It’s under active development, and the name will absolutely be changing! This is my first time delving into map chunking, A*, and most other specifics of game development that go along with a Zelda-like.

Playable’ here! ‘Playable’ due to the fact that there’s no win condition, and if you let the log bump into you 40x, your character will die! As always, feedback is greatly appreciated and can be sent to

Admincraft – Setting up a Minecraft Server

This tutorial will teach you how to set up a dedicated Minecraft instance. I’ll be doing this on a Debian 7.11 x64 VPS from DigitalOcean. My goal in writing this tutorial is to give a quick, step-by-step walkthrough that will let you get a secure “Vanilla” Minecraft server up and running in under 30 minutes.

To follow along, you’ll need an SSH client. For the quickest and easiest, i’d highly suggest puTTy. If you really want to immerse yourself in a Linux environment even from Windows, check out Cygwin – i’ll make a walkthrough on how to configure it later on.

ssh as root :(

Root puTTy connection

Let’s get started. Open up puTTy or your preferred SSH client and enter your connection details. Initially, we’ll be connecting as the root account to get things configured.
Your screen should look similar to to the image to the right.


connected over ssh as root! for shame!

After password reset, you should see this screen.

Next, hit enter, and you’ll get a prompt telling you that the hosts key is not cached in the registry. We’ll come back to this in the future, but for now, click “Yes” and you’ll end up with a login screen. Enter the password for your root account and hit enter, then follow the prompts to change your password.

Finally, you’re on your server. Now the fun stuff begins.

Let’s run a few commands (the parts in bold):

First, update all existing (system default) repositories and programs to the most recent version available in your repositories.
root@1:~# apt-get update
root@1:~# apt-get install nano

Next, we’ll install Python 3. We won’t actually use it in this tutorial, but we’ll come back to it!
root@1:~# apt-get install python3

Once that’s completed, we need to add some new repositories, then install Java 8.
root@1:~# echo "deb trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list
root@1:~# echo "deb-src trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
root@1:~# apt-key adv --keyserver hkp:// --recv-keys EEA14886
root@1:~# apt-get update
root@1:~# apt-get install oracle-java8-installer
root@1:~# java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

Assuming the output of the java -version command looks good, we’ll install tmux (equivalent to “screen”).
root@1:~# apt-get -y install tmux

Now that all of our software prerequisites are installed, we’ll want to get off of the root account. Before we can do that, let’s add a group for our admin accounts and other accounts.
root@1:~# sudo groupadd MinecraftAdmins

Add a few users here, one for yourself and one dedicated to running the Minecraft server. You may want to add individual accounts for each of your admins
root@1:~# adduser minecraft
root@1:~# adduser colin
root@1:~# sudo usermod -a -G MinecraftAdmins minecraft
root@1:~# sudo usermod -a -G MinecraftAdmins colin

Add elevated rights for the Minecraft user with visudo.
root@1:~# visudo
# Add this line to the visudo page.
Minecraft ALL=(ALL:ALL) ALL

At this point, disconnect as root, and reconnect as your new ‘minecraft’ user.

Now the fun stuff! We’ll organize and download the minecraft server executable. We’ll be downloading version 1.12.2
minecraft@1:~# mkdir ~/servers
minecraft@1:~# mkdir ~/servers/vanilla
minecraft@1:~# cd ~/servers/vanilla
minecraft@1:~# wget -O minecraft_server.jar

So close! Just a few more steps. Let’s set up a basic launcher script.
minecraft@1:~# nano
You can copy and paste the following into the script, or type it out if you want to!
java -Xms1G -Xmx2G -jar minecraft_server.jar -o true

Save and quit (if you used nano, it’s , then Y.

Make the script you created executable and run it!
minecraft@1:~# chmod +x
minecraft@1:~# ./

The first time we run this, it will fail since we haven’t accepted the EULA yet. Edit the file that was generated in the ~/servers/vanilla directory called “eula.txt”
minecraft@1:~# nano eula.txt

Let’s create a new tmux session and start up the server!
minecraft@1:~# tmux new-session -n vanilla -s vanilla
minecraft@1:~# ./

And it’s up! In the next sections we’ll go over making our server more secure, automating some tasks, backups and a bunch of other stuff.

Thanks for reading and I hope this was helpful, leave a comment if you have issues with any of the steps!

Automating Audit Additions

…With alliteration.

Hey there and thanks for reading. Today I wanted to talk about a few recent additions I made to one of the SQL schemas I run! I was tired of manually adding a LastWriteTime and LastModifiedBy column to each table as they were created in the database, so naturally, I wanted to automate it.

This is a two part process, and it might be a little hacky but it works well enough in development and staging databases. I’ll need to see what the overhead is like in production, but I don’t anticipate any issues.

First up, we need a stored procedure to add 2 columns to a table. Nice and easy:

USE Development;


SET @sql = 'ALTER TABLE ' + @TableName + 'ADD LastWriteTime smalldatetime NOT NULL DEFAULT GETDATE()'
-- Change to NOW() for MySQL instead of SQLServer

SET @sql = 'ALTER TABLE ' + @TableName + 'ADD LastModifiedBy VARCHAR(60) NULL'
-- For purposes of the demo i'll allow null values

All of the code in this demo is available on my github page.

Cool, so that’s the easy part, you can execute that by passing any table in your schema to it and it’ll add the columns. LastWriteTime will have a default value of the time of execution or row addition. LastModifiedBy has no default due to how we use it, but you could set it to a value if you so choose.

The next part was a bit more challenging to figure out, I needed to parse event data from the CREATE_TABLE event and determine how to get the name parameter passed to it.

Event data is captured in a trigger by assigning EVENTDATA() to an XML variable. The data comes in a pretty easy to consume XML structure (i’ve formatted this one to make it look pretty, it’s normally displayed without whitespace or linebreaks).

The below event data is captured from the simple line:
CREATE TABLE MyTable (Integer int);

        		<CommandText>CREATE TABLE MyTable (Integer int);</CommandText>

As you can see, we have a lot to work with in this data set. In this example, we’re going to be particularly interested in the <ObjectName> object, since that contains the table name that we’ll want to pass to our stored procedure. Let’s create a trigger to do just that!

Use Development;




	DECLARE @tablename varchar(max)

	SET @data = EVENTDATA()
	SET @tablename = CONVERT(varchar(max), @data.value('(/EVENT_INSTANCE/ObjectName)[1]','nvarchar(100)'))
	EXEC AddAuditColumns(@tablename)





That trigger above will snag the EVENTDATA() from the CREATE_TABLE event and add the columns defined in the stored procedure. This is a very extensible way to add columns on create and the best I could come up with on the fly.

Worth noting! If you want to enable this audit creation on the entire schema, you’ll need to modify the Trigger create a little bit, change:


If there’s feedback or issues with the above scripts i’d love to see some pull requests on Github or just leave a comment.