BigReactors – TurbineMonitor in ComputerCraft

So I happen to be a fan of Modded Minecraft, and have been playing FTB Infinity lately. One of the mods in FTB Infinity is BigReactors. Big Reactors allows you to build a nuclear reactor that can either directly produce power or it can be configured to produce steam. If you produce steam, in order to produce power you must build turbine(s) to convert the steam to power. Once you setup your reactor and turbines, you quickly realize that you can produce A LOT of power. So much that I found I can not use it quickly enough. I put in a battery to store it the excess power but the battery filled up quickly. This lead to my turbine sitting full with power, still running wasting fuel. It was quite easy to configure my reactor to power up and down as needed with 3 Reactor Redstone Ports and a simple RS Latch, but there is not an easy equivalent for the turbine.

This lead me to find the Turbine Computer Port. The computer port allows you interact with the turbine via ComputerCraft, another mod included in the FTB Infinity Mod Pack. I have used ComputerCraft for many simple projects, but have never used it with BigReactors. I read through the API and decided that is was very feasible and should be able to much more than the simple Redstone Ports. I wrote a program is Lua that runs on a computer to manage any number of Turbines. It will turn on and off the Induction Coils automatically to keep a small amount of power in the Turbine. It will also turn on and off the steam to keep the Turbine up to speed.  It  also will find any attached monitors (Via Modems and Cables) and display the status of each Turbine on each Monitor (I did this because I wanted one monitor in my power room, and one in my main foyer). To use the program is quite easy.

Craft an Advanced Computer, Modems, and Networking Cable. If you would like the displays (Not needed), craft as many Advanced Monitors as you would like for them.

Place the Modems on the Computer, Turbine Computer Ports, and Monitors. Make sure you activate the Modem on the computer last. This may not be necessary, but I had problems when I did not do this

Open up your computer, and type in

pastebin get T8pMizre TurbineMonitor

This will download the program to your computer and name it TurbineMonitor

You can edit the Program by typing in

edit TurbineMonitor

You can change all the colors and text that displays on the Monitors, as well as the target RPM for your turbine.

If you setup everything correctly, all you should have to do now is type

TurbineMonitor

and it should start working!

Code to Follow:

Multiple Public IPs for a Single DDWRT Router

I have created a very simple tool to help configure and forward ports for Multiple Public IPs on a DD-WRT enabled router. The biggest issue, in my opinion with DD-WRT and Multiple Public IPs is the requirement to use the commands to manually add all the ips. This can be tiresome when you have many small changes to make, want to add new port forwards, remove ips, etc. So I put together this simple tool.

You can find it on its dedicated page along with all it’s documentation.

Chatinator for Twitch.tv

I wanted to learn C# and .NET. I sat and thought for a long while what project I could do that would keep my interest long enough to produce a result others would actually use. I took a break from brainstorming to watch one of my favorite twitch.tv streams, Wyld. He ran a giveaway on his chat using one of the current bot tools out there. The winner was chosen at random from the chat and posted to the chat. Problem was there was so much traffic in the chat that most people did not see the winner. Then it came to me, there are no good programs to display results from chat polls, giveaways, and the like on stream. So I sat down and started working on Chatinator for Twitch.

Everything related to it can be found on GitHub Project Page
The installer can be found on my blog page for Chatinator

Creating Life – A study into HTML5 Canvas, Webworkers, and Life Simulation: Part 1

Let me start off, I am no pro in any of the following you are about to see. I have spent the past few weeks trying to learn about HTML5 and some of the cool new things its brings. First off, you can see a demo of all my work on GitHub.io. I should tell you right now, I think it will only function on chrome. I know there are some styling issues on Firefox and the last time I tried running it in firefox it didn’t run at all.

All of the source code can be viewed an GitHub. Please feel free to clone the project and see what you can figure out on your own.

So what is it? Well, its a pond with 4 map types. Empty (dark dark blue), resources (dark blues and purples), materials (lighter blues and purples), and organisms (green and red). The organisms can either be producers (green), or consumers (red). Producers convert resources to materials. Consumers eat the materials. There are 3 type of each resource, and 3 types of each material. Each resource converts to exactly 1 corresponding material, and each organism will only desire 1 type. Producers are designed to work together, sharing resources and materials in a simple attempt to keep the entire pack alive. Consumers are greedy, not caring at all about the heard in general. Each mitosis that occurs has a chance of mutation. Mutations change color as well as a variety of attributes about that organism.  Some configurable options include goal resources on board as well as organism spawn rates.

The application which runs the simulation is separated into three primary pieces. The UI, the worker, and the drawer. The UI is the master controller. It start, stops, and communicates with the webworker. It asks for data from the worker, and when it receives a reply, it renders it to the screen as well as passes it along to the drawer. The Webworker does all the heaving lifting. This includes processing the flow of the pond, the spawning of resources, and the life and death of organisms. Anything pertaining directly to the pond other than the rendering is done in the webworker. The drawer does the canvas drawing. This includes the pre and post filtering.

The first technical aspect I want talk about is how I figured out how to quickly send >25000 datapoints from a Webworker to the UI Thread. In order to do this, we can not use any of the classic javascript types. Objects, arrays, strings, ints, and floats all are copied (duplicated) on each message. This is fine for small bits of data, but for a huge dataset, this can add significant overhead, especially since we want to send this data as many possible times per second as our renderer can handle (On my PC, this is about 12-13 FPS). In order to not have a full copy occur we must use one of the transferable object types. One of these types happen to be a type compatible with ImageData. The following snippet of code shows both how a large array of data could be converted to a transferable datatype, transferred from the webworker to the UI, and then quickly applied to the canvas. For sake of simplicity, I am only showing relevant code to this idea, without any of the other application logic and organization.

Next Time I will talk about in depth the different flow algorithms that are implemented so far, as well as a couple that are up and coming.

Extracting the icons from an EXE in PHP on Linux

For a project I am working on I wanted to add the ability to see an EXE’s built in icon file in a web application. I am running a Debian Linux / PHP5 stack and figured out a way to extract a png out of a Windows EXE. To accomplish this I am using icoutils to extract an ico file from the exe, then search for the target size icon I want and extract a png from that ico file. The script is commented and should be pretty easy to understand and edit to fit your needs. Help with icoutils can be found on the wrestool and icotool man pages. The gist is below:

jQuery.flipper: A jQuery plugin for retro clock-like animations, and more!

After a little bit of searching around on the web for a javascript solution to create a flip-down animation for a clock a wanted to build, I decided to build my own. I started from this flip-down clock animation css3 example/test page. I have a github repo here which documents all the options and usages. I also have two examples, one that demonstrates all the options and one that shows off the queueing feature.

Again, Important links:

Please feel free to clone the repo and make your own transitions, or maybe improve upon my current transitions.

Perl Script to automatically put emails into a MySQL Database

I have written/highly modified a perl script to take piped in emails and insert them into a MySQL database. I accomplish this by having my MTA pipe them to this script. You can download the script from this Github Repo, or you can download it directly from here.

This script requires that you have Perl installed with the following Modules:

  • DBI
  • Email::MIME
  • Email::Address
  • HTML::Strip

To use this script, first replace the following items in the script:

  • _DATABASE_ The name of the Schema/Database
  • _SERVER_ The host of the MySQL Server. ex: localhost, 192.168.0.10, etc
  • _USER_ The user of the MySQL database
  • _PASSWORD_ The password of the MySQL user

Place the script on your server and make sure it is accessible and executable by your MTA. Set your MTA to pipe incoming emails to this script. That should be all that is needed.

GitHub Repo: https://github.com/mrkmg/email2mysql
Original Script: http://www.blazonry.com/perl/mail2mysql.php

Chive Project Debian Package

I put together a .deb to install the Chive Project MySQL Administration Package automatically. It is based off of the phpMyAdmin deb package. I have made a github project for the deb package.

Installation is simple.

  • Download the “chive1.1-0.deb
  • From the terminal, run
    sudo dpkg -i chive1.1-0.deb
  • In your preferred browser, navigate to http://localhost/chive

Important Links.