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.
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.
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.
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:
Again, Important links:
- Github: https://github.com/mrkmg/jquery.flipper
- Demo 1: https://mrkmg.com/flipper/
- Demo 2: https://mrkmg.com/flipper/wordplay.html
Please feel free to clone the repo and make your own transitions, or maybe improve upon my current transitions.
I have been writing a couple PHP CLI scripts, some that are long running. I wanted a simple way to keep a running average of how many times certain actions were taking place. In comes TPM. A very small and simple class that keep tracks of “ticks” per minute for you.
Hope you find it useful!
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:
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.
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
- GitHub Project Page: https://github.com/mrkmg/Chive-Project-Debian-Package
- Chive Project Page: http://www.chive-project.com/
- Chive Project Debian Package: https://github.com/downloads/mrkmg/Chive-Project-Debian-Package/chive1.1-0.deb
Earlier today I found a very very useful program to help cut down in the massive amount of spam system administrators receive from cron emails. I decided to create a simple installer for it. Check out cronic at http://habilis.net/cronic/. To install automatically to your system, just run this command as root.
wget https://mrkmg.com/install_cronic.sh -qO - | sh
There is no error checking in the installer, use at your own risk.
install_cronic.sh for your reference if you do not want to trust running a shell script from the internet.
#!/bin/sh mkdir /tmp/cronic echo "Downloading Cronic from habilis.net" wget http://habilis.net/cronic/cronic -qO - > /tmp/cronic/cronic echo "Installing Cronic into /var/local/cronic/cronic" mkdir -p /var/local/cronic/ cp /tmp/cronic/cronic /var/local/cronic/cronic chmod 755 /var/local/cronic/cronic echo "Linking Cronic into /usr/bin" ln -s /var/local/cronic/cronic /usr/bin/cronic echo "Cronic is installed and ready to be used. Checkout" echo "http://habilis.net/cronic/ for more information." echo "Installer created by Kevin Gravier <[email protected]>"
I found a very nice and easy to use script to place a floating clock on your CLI in linux.
wget https://gist.github.com/raw/2713194/cb9eb0426dc81f3411c7bb2e592963378bb3b2d7/tclock.sh chmod 755 tclock.sh ./tclock.sh&
I also made a simple installer
wget https://mrkmg.com/install_tclock.sh -qO - | sh
Quick update to AxelFE, no more console! Everything is now contained and run in the GUI. Check out the new version. https://mrkmg.com/?page_id=79