USING MAGIC THE GATHERING ART FOR D&D IDEAS

Recently I’ve spent a bit time reading some of Dragon+ Magazine articles, one particularly grabbed my attention. Using Magic Cards as D&D Items presents a very interesting way to craft items, using Magic the Gathering cards, one can gain inspiration for their next +1 Dagger, or even an Elven Stronghold.

I think the reason I so quickly latched on to this idea was because Magic the Gathering and Dungeons & Dragons are two of my favorite games, plus I really dig the Ixala art work, I mean who hasn’t fantasized about riding a dinosaur to work. Now I absolutely own tons of Magic the Gathering cards, and I could easily grab a handful and start coming up with an epic dungeon delve, but I thought, why not include a little bit of technology.

PYTHON PANDAS AND D&D MONSTERS

As you may be aware the Dungeon Brawl application I’ve been working on defines monsters in YaML format (check out the data/monsters directory) .

I thought it would be interesting to load this data in to Pandas and do a bit of data analysis.

Loading Data

While in the Dungeon Brawl repository I started up an ipython shell, then import a couple libraries:

In [1]: import yaml

In [2]: import glob

In [3]: import pandas

Next I need to find each of my monster’s YaML documents, these files reside in the data directory.

RASPBERRY PI WEATHER STATION

Well it’s been a little over two week and the Raspberry Pi 3 Model B weather station has held up; figured now would be a good time to go a little deeper into the setup. Telegraf has been solid in ingesting my JSON documents periodically, lets have a look at it’s SensorTag configuration:

# cat /etc/telegraf/telegraf.d/sensor_tag.conf
[[inputs.exec]]
 command = "cat /sensor_tag.json"
 data_format = "json"
 name_suffix = "_sensor_tag"
 interval = "60s"

This telegraf configuration inserts the output of /sensor_tag.json every 60 seconds into InfluxDB.

GRAFANA 5.X RUNNING ON RASPBERRY PI

Got around to upgrading my Raspberry Pi 3 Model B weather station with a newer version of Grafana, the Debian packages for ARM are hosted on Grafana’s download page under ARMv7 .

Moving from a 2.x word to a 5.x has been impressive, most notably the drag, drop, and resize functionality. I’m still using InfluxDB and Telegraf to store and populate my time data points.

Latest Raspbian’s (stretch) comes with Influx 1.0.2 and works nicely:

FILE NOT FOUND!

I’ve seen it before, a customer deletes a file and then needs it restored.

Normally a challenging request, but under special circumstances a process may have the file opened.

While showing my son some fun and exciting Linux security scenarios, I recalled all those times I was able to recover data from the /proc (in memory) filesystem. In order to visualize this scenario I threw together a small Dockerfile and had him poke around:

DUNGEON BRAWL

In order to re-familiarize myself with MongoDB I decided to write a little web application utilizing it as a backend datastore. Dungeon Brawl is a Python Flask app that runs inside Docker with the help of docker-compose.

Using this application a Dungeon Master can easily track all things combat for their Dungeons and Dragons group.

Grab the source code from Github , or check out a demo .

ANDROID OPEN TRIVIA DATABASE APPLICATION

This month I went from owning an iPhone to an Android, I also decided to freshen up on the new hotness in the Android development realm.

I learned Kotlin is now an officially supported Language, Android Studio works much better than the old days of Eclipse and plugins, and OkHttp + Gson make interacting with Rest APIs pretty darn easy.

So what did I manage to create?

Using a list of public-apis found on toddmotto’s Github I came across the Open Trivia Database .

MAGIC THE GATHERING CARD RECOGNITION

This weekend I took a bit of time to read up on OpenCV (Open Source Computer Vision Library) , I wanted to capture images of Magic the Gathering cards, then identify them using a Python library called ImageHash .

Below is a demonstration of what I was able to accomplish in about 2 days of research and hacking:

I’ll try and break down the steps and image manipulation functions I used to achieve this.

MYSQL IN OPERATOR NOT USING INDEX

After being alerted for elevated cpu on a staging mysql instance, I logged into the mysql console and ran a SHOW PROCESS LIST :

SHOW PROCESSLIST\G
*************************** 1. row ***************************
     Id: 1
   User: my_user
   Host: x.x.x.x:xxx
     db: my_db
Command: Sleep
   Time: 2
  State:
   Info: NULL
*************************** 2. row ***************************
     Id: 3
   User: my_user
   Host: x.x.x.x:xxx
     db: my_db
Command: Query
   Time: 786
  State: Sending data
   Info: SELECT file_id, fs_file_id
FROM my_data
WHERE file_id IN ('123456', 123457);

A query running for 786 seconds quickly caught my eye, my next course of action was to run an EXPLAIN :

REMOTE CONTROLLED CAR USING RASPBERRY PI AND WEBCAM

Setup

First thing I tackled was setting up the L293D H-Bridge on the Bread Board.

I found myself referencing the following Diagram a couple times.

Step one is connecting your chip down the center of your board:

From here I connected the 3 power pins to my board’s power rail using a few Jumpers :

A few more Jumpers connect each side of the chip to ground:

Finally I use a couple Wires to connect both sides of my power and ground rails: