(Picture Post) Vault 42 Jumpsuit QR Codes

Finally got the QR Code Machine in Animal Crossing New Leaf, posting this as promised on ACC:

Vault 42, known for their fanatic devotion to a being known only as Dadams, who they claim to be a prophet foretelling the future of the world long after the bombs fell. Little else is known about the Cult of Dadams.

Vault 42, known for their fanatic devotion to a being known only as Dadams, who they claim to be a prophet foretelling the future of the world long after the bombs fell. Little else is known about the Cult of Dadams.

Vault 42 Jumpsuit Back QR Code

Vault 42 Jumpsuit Left Arm QR Code

Vault 42 Jumpsuit Right Arm QR Code

(Picture Post) Animal Crossing, Wood turning, and other shenanigans.

Well, it’s a long post today. Let’s get the pretty shiny video game stuff out of the way first; Animal Crossing: New Leaf. Pro Patterns, in-game screenshots, and what seems to be a markedly easier time catch sharks in this game. This is how I wanted Wild World to be and then some.

I love putting together pattern designs, and when I found out Pro Patterns would be available in New Leaf, I already had ideas forming.

Dr. Eggman's Suitjacket Pro Pattern, Sonic the Hedgehog series

Dr. Eggman’s Suitjacket Pro Pattern, Sonic the Hedgehog series

The Joker's Vest Pro Pattern. Almost makes me look like a respectable mayor, then I remember who wore it first.

The Joker’s Vest Pro Pattern. Almost makes me look like a respectable mayor, then I remember who wore it first.

N7 Armor Pro Pattern from Mass Effect series. For when your bug-hunting expeditions land you in thresher maw territory.

N7 Armor Pro Pattern from Mass Effect series. For when your bug-hunting expeditions land you in thresher maw territory.

Vault Dweller Pro Pattern. If your town turns into a post-apocalyptic wasteland devoid of beauty, at least you can go outside in style with this outfit...

Vault Dweller Pro Pattern. If your town turns into a post-apocalyptic wasteland devoid of beauty, at least you can go outside in style with this outfit…

Richard's Robes, from Looking for Group. He's the mayor of a little village up the coast too, you know.

Richard’s Robes, from Looking for Group.
He’s the mayor of a little village up the coast too, you know.

In addition, the Bug-Off came and went. I won. Nat is bizarre. That’s all that need be said for that day.

Naturally, I had saved a Birdwing Butterfly for this occasion.

Naturally, I had saved a Birdwing Butterfly for this occasion.

Lastly in AC:NL, Shep seems to be of the same mindset as I am when it comes to chiptunes:

I couldn't agree more Shep, I couldn't agree more...

I couldn’t agree more Shep, I couldn’t agree more…

Outside of the Animal Crossing world (oh, reality… right), I’ve been working out in the workshop at my parents place lately; mostly doing cleanup and rearranging the place. On some downtime I turned out a paperweight from a branch off a black walnut tree here on the property. Ended up with a 4″ x 6″ rook; this was a learning experience in itself what with using raw wood that had set to dry for a year. I’ll be doing this again to document the process and give clear instructions on how to knock down the raw piece to roughly round, then turning and crenellating the top of the castle. In the meanwhile, here’s the eye-candy:

Felted bottom, sanded and finished with paste wax polish.

Felted bottom, sanded and finished with paste wax polish.

Lastly, some quick pictures from a project that has been in the works over a year here (There are a few of those..): an IBM Model F Keyboard conversion and retrofit. I’ve written Cherry Manufacturing to inquire about getting a sample of their MX Blue and MX Green switches to test replacing the buckling spring switches with, and hope to hear back by the end of the week. I imagine seeing this keyboard mangled as it is and reading about it’s impending conversion away from buckling spring sets some readers (hah, I have readers… Lulz) to forming a riot mob, but oh well.

I feel like I'm going to have to put a copy of Zork in here somewhere...

I feel like I’m going to have to put a copy of Zork in here somewhere…

Hey look buckling-spring enthusiasts! I cut into the key retainer here and modified that stupid "+" arrow shape! So N'YEH! :P

Hey look buckling-spring enthusiasts! I cut into the key retainer here and modified that stupid “+” arrow shape! So N’YEH! :P

This is roughly the idea in mind with the bare holes on the faceplate filled in where keys used to be.

This is roughly the idea in mind with the bare holes on the faceplate filled in where keys used to be.

Eat your heart out ghetto-riggers. That was cut and shifted down with an x-acto knife, then welded in with a soldering iron.

Eat your heart out ghetto-riggers. That was cut and shifted down with an x-acto knife, then welded in with a soldering iron.

Super key and Context Menu key will go here, in that order. Provides easy access to Super key, and I rarely use the context key itself.

Super key and Context Menu key will go here, in that order. Provides easy access to Super key, and I rarely use the context key itself.

Standardizing the numpad. Any keys seen with sharpie on them are scheduled to be replaced.

Standardizing the numpad. Any keys seen with sharpie on them are scheduled to be replaced.

Animal Crossing: Wild World Palettes

Upon returning to Kalamazoo, I came down with what I can only describe as the worst cold I’ve ever had. Strange (for me) considering it’s spring, but I’ll live.

In any case, I’ve been partaking in copious amounts of rest to get myself better. During my downtime, I’ve been re-playing my old AC:WW game. If you’re unfamiliar with Animal Crossing and are interested in fiddly little time-sinking video games, I highly recommend you Google it.

One thing I enjoy in the game is coming up with new patterns for clothing designs. With Animal Crossing:New Leaf just around the corner, I’m even more anxious to swing my pixel brush at the canvas. Often I try to come up with my patterns in a graphics program before I draw them in-game, and have tried on several occasions to get the color codes for each of the sixteen palette sets in the game to use in my programs. I’ve finally broken down and pulled each color from a small utility called Anicro Desapro and saved the RGB values into GIMP palette files. “Now, why would you do that,” you might ask yourself.

Between needing .gpl files for Inkscape and GIMP, and getting increasingly tired of the current Pattern Editor on ACC, I’ve decided to make my own HTML5-based pattern editor. The current pre-alpha structure looks something like this:

HTML5-based Pattern Editor mockup for Animal Crossing patterns. Functions insomuch that you can draw with the freehand brush and fill the entire canvas  with the wallpaper tool. Each tool uses whatever color you clicked last.

HTML5-based Pattern Editor mockup for Animal Crossing patterns. Functions insomuch that you can draw with the freehand brush and fill the entire canvas with the wallpaper tool. Each tool uses whatever color you clicked last.

Updates will be posted as they come.

Mead (It’s easier than you think…)

I like mead. For those who are unfamiliar with what mead is, check it out on wikipedia.

A little bit of a back-story:
My father loves home brewing. He started when he was younger than I am now and took to it like a fish to water. Subsequently, I grew up with stories of the various batches of beer he would make with a friend of his (the batches wouldn’t last long after being considered finished). It was fascinating to me how easy home brewing seemed, so it stuck in the back of my mind as something I’d like to try my hand at some day.

“Some day” came a few years back, from my last trip to the Renaissance Festival hosted in Holly, MI. They were selling mead there (damn small amounts per price, but that’s the game I guess), and like any good Ren-goer I had to have at least one glass. Delicious as it was, I wasn’t keen on the exorbitant amount charged, which led me back to thinking about the brewing Dad used to do. My mind was made up.

Dad and I sat down and planned out what we would need to brew a batch; surprisingly we had most of what we needed. We googled around a bit for a recipe that looked interesting and settled on an orange-infused mix. Around five pounds of honey dissolved into Lord only remembers how much water, slices of orange (with the peel — this was a mistake), golden raisins, and a few cloves for good measure were added to a gallon demijohn and left in the furnace area of my parents place for roughly a year. The batch was racked off in February, and we finally bottled the finished mead a few weeks ago. Here are the results:

Three wine bottles filled with home-brewed mead

Corks just pressed in

Three wine bottles filled with home-brewed mead

Corked and ready to be laid down for later enjoyment

Having sampled it before bottling, I can tell you be wary of the kind of orange you add in: the peel of an orange can very strongly influence the flavor of your mead. This batch was much more dry than I cared for, but still quite palatable for serving cold.

I’ve started another batch a few months back, smaller and more to test my own recipes and theories. The recipe is as follows, for a gallon test run:

  • 4 lbs honey
  • 12 cups hot water
  • 3 cup cold water
  • 1/4 tsp Fleischmann’s Active Dry Yeast
  • 3-6 pieces of clove
  • Juice from 1 orange
  • Loads of cinnamon
  • Dash nutmeg

Heat the container of honey in a hot water bath, as this will help with pouring and dissolving it into the water. The hardest part of the process will be adding in the yeast: I recommend starting the yeast by mixing it into a small amount of water heated to 100° or so(don’t go above 110°). Mix all other ingredients in before adding the yeast. Check your mix temperature; as long as you’re below 110° you can add in your yeast mix and set up your airlock.

At this point, the rest is up to you. Wait as long as you feel necessary, rack the mix off as often as you feel, and experiment with the recipe. Patience will be your friend in the end, and it will have cost you a hell of a lot less to make your own mead than it would to sample two or three glasses at a festival.

Addendum: I forgot to mention the disappointing development after bottling the first batch. Sadly, the corks did not seal correctly, so for the time being the mead is back in an airlocked demijohn, waiting for me to get new corks. C’est la vie.

Localhost Site Management, v2

Last month I posted about writing a Bash script to manage virtual host configurations for Apache2 on my local machine. Well, I wasn’t satisfied with Bash. Let’s face it; after you add so much to one function to have it handle different actions, a shell script can get pretty messy. Enter C code: https://github.com/akoimeexx/apache2-vhost

Now that I’ve got it roughly working, I’m refactoring the code. I’ve written a couple functions for this program that seem like they’d be useful for general purposes, so for posterity here they are:

/**
 * cprintf - Print formatted text with color
 */
#include <stdio.h>
#include <stdarg.h>
int cprintf(const int fg, const int bg, const int style, const char *format, ...) {
    // Variable arguments list for printf
    va_list pargs;
    
    // Apply console formatting (FG, BG, Style, respectively)
    if(fg > 29 && fg < 38) { printf("\033[%dm", fg); }
    if(bg > 39 && bg < 48) { printf("\033[%dm", bg); }
    if(style == 1 || style == 4) { printf("\033[%dm", style); }
    
    // Handle our printf args and print out the string
    va_start(pargs, format);
    int handler = vprintf(format, pargs);
    va_end(pargs);

    // Reset console formatting
    printf("\033[0m");
    return handler;
}
#include <string.h>
/**
 * strncmp_r - Compare strings from the rightmost side to n length
 */
int strncmp_r(const char *s1, const char *s2, int n) {
    // Set maxlength, then re-assign if second is smaller
    int s_maxlen = strlen(s1);
    if(strlen(s2) < strlen(s1)) { s_maxlen = strlen(s2); }
    // If checking length is smaller than maxlength, use that.
    if(n < s_maxlen) { s_maxlen = n; }
    // Truncate strings to maxlength, from the right.
    char sub1[s_maxlen];
    char sub2[s_maxlen];
    strncpy(sub1, &s1[strlen(s1) - s_maxlen], s_maxlen + 1);
    strncpy(sub2, &s2[strlen(s2) - s_maxlen], s_maxlen + 1);
    // Compare the strings
    return strcmp(sub1, sub2);
}

If these functions actually exist somewhere in a relatively cross-platform standard location, let me know. And hey, keep an eye on the github repository for apache2-vhost; big changes are in the works!

PHP Snip: is_assoc()

I often find myself writing functions time and again across projects. Recently, I’ve begun to collate these into one file that I now use — functions.inc.php. While not a terribly creative name, it serves its purpose well, and now I have these commonly-used functions on hand whenever I need them.

I’ve forced myself to do two things in regards to functions I add in to functions.inc.php: first and foremost, test test test! I hate it so, but know from practical applications that this helps solve bugs that may come up. PHPUnit is great for that purpose. Secondly, I document my functions in the file with a NOWDOC string variable, and have written a function (also in the same file) to easily bring that information up should I or any other person need it. But enough of the backstory, here’s the snip:

<?php 
	function is_assoc($arr) {
$__usage__ = <<<'USAGE'
IS_ASSOC(ARRAY);
Description:
    (boolean)   is_assoc( (array) $arr )
                Checks a variable to see if it is an associative array by 
                evaluating is_int() on array keys.

Parameters:
    (array)     arr
                Passed in array to check

Returns:
    (boolean)   True if variable is an associative array, false if otherwise.
USAGE;
		if(is_array($arr) && count($arr) > 0) {
			foreach(array_keys($arr) as $key) {
				if(!is_int($key)) return true;
			}
		}
		return false;
	}
?>

Localhost Site Management

I’m tired of managing localhost-based sites manually when I do development. Build Apache-based conf file, add it to sites available, link to sites-enabled (I know, you could just make the doc in sites-enabled — but standards man, standards…), update /etc/hosts, then restart Apache. Wouldn’t it be nice if I could just type one command to do it all for me?..

Well, it’s not completed, but here’s a start to handy function to rapidly manage what sites I’m running on localhost:

#!/bin/bash
# Custom localhost manipulation function. Adds, lists, and removes custom 
# apache localhost entries
# Exit codes are used as defined by http://tldp.org/LDP/abs/html/exitcodes.html 
# and C/C++ (/usr/include/sysexits.h)
function localhost () {
	# Get apache2 location, and exit with code EX_OSFILE if it's not available.
	httpdroot=$(apache2 -V | grep "HTTPD_ROOT" | cut -d'=' -f2 | tr -d '"')
	if [[ "$httpdroot" = "" ]]
		then exit 72
	fi
	case "$1" in
		add) (
			if [ ! -f "$httpdroot/sites-available/$2.autogen.conf" -a ! -h "$httpdroot/sites-enabled/$2.autogen.conf" ]
				then (
					if [[ "$3" != "" ]]
					read -d '' CONFDOC <<_NOWDOC_
<VirtualHost *:80>
	DocumentRoot "$(pwd)"
	ServerName $2
	# This should be omitted in the production environment
	SetEnv APPLICATION_ENV development
	<Directory "$(pwd)">
		Options Indexes MultiViews FollowSymLinks
		AllowOverride All
		Order allow,deny
		Allow from all
	</Directory>
</VirtualHost>
_NOWDOC_
					sudo echo "$CONFDOC" > "$httpdroot/sites-available/$2.autogen.conf" || exit 73
					sudo ln -s "$httpdroot/sites-available/$2.autogen.conf" "$httpdroot/sites-enabled/$2.autogen.conf" || exit 73
					hostscheck=$(grep -iox "127.0.0.1	$2" /etc/hosts)
					if [[ "$hostscheck" = "" ]]
						then echo "No entry in /etc/hosts"
					fi
					exit 0
				)
			elif [ -f "$httpdroot/sites-available/$2.autogen.conf" -a ! -h "$httpdroot/sites-enabled/$2.autogen.conf" ]
				then sudo ln -s "$httpdroot/sites-available/$2.autogen.conf" "$httpdroot/sites-enabled/$2.autogen.conf" || exit 73
			else
				echo "Unable to add $2.autogen.conf to $httpdroot/sites-* directories. Do they already exist?"
				exit 73
			fi
		);;
		help) (
			echo "Usage: localhost (add|help|list|purge|remove) <domainname> [port:80]"
			echo ""
			echo "Commands:"
			echo "   add <domainname> [port:80] Creates an autogenerated apache configuration"
			echo "                              using the current working directory as" 
			echo "                              document_root for <domainname> in "
			echo "                              $httpdroot/sites-available/ with optional port"
			echo "                              if it doesn't exist; then symlinks the file to"
			echo "                              $httpdroot/sites-enabled/"
			echo "   help                       This help text"
			echo "   list                       Displays existing auto-gen'ed confs"
			echo "   purge <domainname>         Completely removes autogenerated apache"
			echo "                              configuration from $httpdroot/sites-available/"
			echo "                              as well as $httpdroot/sites-enabled/"
			echo "   remove <domainname>        deletes conf from enabled but leaves in available"
			exit 0;
		);;
		list) find "$httpdroot/sites-available/" -name *.autogen.conf; exit 0;;
		purge) (
			if [[ -f "$httpdroot/sites-available/$2.autogen.conf" ]]
				then (
					localhost remove $2
					sudo rm -i "$httpdroot/sites-available/$2.autogen.conf" || exit 73;
					exit 0;
				)
				else
					echo "file not found"
					exit 74;
			fi
		);;
		remove) (
			# Check to make sure it's a symbolic link.
			if [[ -h "$httpdroot/sites-enabled/$2.autogen.conf" ]]
				then (
					sudo rm -i "$httpdroot/sites-enabled/$2.autogen.conf"
					hostscheck=$(grep -iox "127.0.0.1	$2" /etc/hosts)
					if [[ "$hostscheck" != "" ]]
						then echo "We found an entry in /etc/hosts"
					fi
					exit 0
				)
				else
					echo "file not found"
					exit 74
			fi
		);;
		*) echo 'usage: localhost (add|help|list|purge|remove) [domainname] [port:80]'; exit 0;;
	esac
}