TAIM (Alpha Version): GHCI integration with vim
Overview
TAIM aims to couple either a local or remote ghci instance with vim. Similar to SLIME which does the same thing for emacs and common lisp. In short you can evaluate code in place, and receive feedback, without having to reload the whole buffer into ghci.
Dependencies
- Python 2.6
- Vim 7.2
- Haskell Platform
- Only tested on Linux so far
Current Usage
- Download taimReleaseAlpha.tar.gz
- Unpack it, and in the taimReleaseAlpha directory run cabal install
- Run the taimReleaseAlpha program, under ~/.cabal/bin/taimReleaseAlpha
- Open up vim and source taim.vim, or just install taim.vim as a plugin
- In vim :StartTaim which will split the window for you
- In command mode press<C-x><C-e> (Control+x followed by Control+e) to evaluate the line the cursor is currently at.
Screencast
Click the image below to see a video of it running. You will see :EvalCode at the bottom every time <C-x><C-e> is pressed:
TODOs
There is a ton left to do, some of the major ones being:- Evaluate functions that won't work directly in ghci (ie. without let)
- Handle imports
- Handle grouping functions via module
- Handle module renaming
- Severely clean up code
- Start taim.hs executable from taim.vim
- Handle type/class definitions
- Auto installer for vim script
- Test on Windows
- Fix scrolling issues on toggle of windows
- Consistent output flushing
- Configuration file to allow placement and size of output window, and network location of ghci session.
Conclusion
This is pretty basic right, but I've already been finding it pretty useful. It makes it alot easier to toy around in ghci right now, and can hopefully be expanded to be a pretty comprehensive development environment for Haskell.
Comments(2)
2010-06-06 16:06:31
CheaTorrent -- An evil BitTorrent client
Overview
This is the source tarball of a few simple tweaks to ctorrent. It requires knowledge of how to compile programs and run them from the command line. The people tech savvy enough to use this are likely able to falsify their ratios anyway.
With that said, this bitorrent client has an 'evil' set of defaults. It will not upload to peers, reports back that it has uploaded ~70% of what it has downloaded, immediately closes once downloading is complete, and spoofs it's user agent to a known popular client. This is the default behaviour, although some of it can be changed on the command line
There are three reasons I made this:
- Show that upload stats are worthless for determining level of infringement. They can be set by the users themselves.
- Show that private trackers are relying on obscurity to ensure people have good ratios. The underlying mechanism used is flawed.
- Many private trackers have ridiculous ratio requirements. This side steps that issue.
Screenshot

Downloads
cheatorrent_v1.0.tar.gz -- Tarball of source code, with configure scriptConclusion
I didn't change any of the command line options, but would if there was any interest. Also I may, one of these years, add the capability to falsify reported download.
Comments(2)
2010-03-14 23:48:04
Collatz Conjecture in Haskell
Overview
The Collatz Conjecture is based on sequences from the following formulas:
n/2 for even n 3*n + 1 for odd n
Collatz Sequence Code
Code to generate sequences and find the lengths of the sequences:
test :: Int -> Int
test x | even x = x `div` 2
| otherwise = 3*x + 1
collatz :: Int -> [Int]
collatz 1 = [1]
collatz x = x : collatz (test x)
numCollatz = map (length . collatz) [1..]
Output Code
Generates a table that gnuplot can handle.
format x y = show x ++ "t" ++ show y table x = unlines (zipWith format [1..] (take x numCollatz)) main = writeFile "collatz.dat" (table 100000)
Images
1000, 10000, and 100000 numbers respectively



Video
Click the image below for a video of the behavior as we go to higher numbers (Pretty obvious from the above pictures :p).

Code
- collatz.hs --Haskell code described above
- collatz.gnu -- The gnuplot code to generate a graph
Comments(0)
2010-02-28 23:24:35
Continuous Inking System (Epson R300)
Overview
Continuous Inking Systems (CIS) allow you to use bulk ink in a printer, instead of ink cartridges. Basically it involves hooking tubes between bottles of ink and the dampers(The things that distribute ink). Also putting in a custom chipset to basically ignore ink levels and such. Some people are insane and do it themselves using the old cartridges, syringes, and normal tubing. I opted to get a kit from inkrepublic.
This is more or less a review/issues I encountered than a detailed write-up
Pictures
Front of device:
Printed picture of the above image (There was some glare):

Back of device (Rerouted waste ink tube):

Pros
- The major pro is that it is MUCH cheaper. A standard ink cartridge costs ~$20 for 5ml of ink. Bulk ink is $12 for 100ml, which is over 300% cheaper ( If I did my math right :)
- Inkrepublic was fast to ship, and delivery went quick
- Setup was more or less painless, slightly messy though :)
- Print quality is excellent so far
Cons/Issues
- One of the caps was broken on arrival. They said a replacement was shipped, but it never arrived. Thankfully there is a spare cap (Of ambiguous color) with the kit, so it wasn't a huge deal.
- Kinda pricey at $150, might not be worth it if you don't plan to do alot of printing
- Epson sucks, and tries to make you take in the printer to be serviced at the drop of the hat. Part of this scheme is the waste ink disposal, you more or less have to pull out the tube, route it into a container, and do a factory reset.
- Even after fixing the waste ink, it still comes on every time the printer is turned off and then back on. The easy fix is to leave it on all the time :p
- Leaving it on seems to cause it to get out of alignment. This is simply corrected by doing a quick print before doing a real one. This may seem wasteful, but the startup of the printer uses a ton of ink to do this same thing anyway.
Conclusion
Works good, although feels like a hack even with the kit. I didn't see a laser printer for cheap that did color (I can get B&W ones for under $50), and I *hopefully* will be having to print out a ton of stuff soon, so this was the only viable option I could come up with that wasn't really expensive. It will pay for itself after about 25ml of use, which I'm sure I'll reach.
Comments(0)
2010-01-29 23:55:39
Self Modifying 2D Turing Automata
Overview
2D turing machines with 4 possible symbols per space were made. Their state tables were stored in the 'tape' that was used to run the programs, thus allowing self modification. Several of these machines were laid out in the same grid representing the 'tape', and allowed to travel anywhere, modifying themselves or others.
Algorithm
The algorithm is simple. A machine is represented by a 16x16 state table. The columns correspond to the symbols, which also have a direction(More on that later):
- α(0) -- Displayed as Red, moves Up
- β(1) -- Displayed as Green, moves Down
- γ(2) -- Displayed as Blue, moves Left
- δ(3) -- Displayed as White, moves Right
Also since there are 4 symbols we can use each one to represent which direction to move on the 'tape'. We end up with each row in the table as:
| State | (α) Direction | (α) New Symbol | (α) New State(m) | (α) New State(n) | (β) Direction | ... | (δ) New State(m) | (δ) New State(n) |
A lookup based on the current state and symbol underneath is then easily performed. For the actual implementation the state tables and the grid were seeded with random numbers.
Pictures
Start state for one of the runs (They all look similar starting out, since it's random):
A few end state pictures:


Videos
Click images below for timelapsed video:


Code
turingAutomata.pde -- You can set the number of individuals (Must be square) and the grid display size up top, but don't have to.Conclusion
These turned out pretty interesting. They always seem to end up in a steady state of repeated behaviour, usually 'trains' moving around the screen. I've seen a few interesting things happen, such as piston motions, , and really close timing ( moving horizontal chains with small breaks, having diaganol chains going through multiple at once).
Also weird is that it almost always (Roughly 90% of the time) tends towards 2 colors at the end. Also, there is always a dominant color, which makes some sense...I guess. I have alot of other stuff I want to try with them, but I first needed to make sure the basic design worked out.
Comments(0)
2009-12-20 05:05:24
Competing Conway Life Automata
Overview
I took the Processing example implementation of Conway's game of life and hacked it to try to evolve patterns that will take the most space possible. Click the picture below to see a time lapsed video of it running:

General Algorithm
- Take 4 sets of patterns each in a 50x50 space on the board
- Run them for 5000 cycles and rank them by how many spaces they occupy
- Carry over the first and second most successful patterns
- Take the most successful pattern and introduce 5 random mutations (Turn off a cell that's on, or vice versa) to create a new pattern
- Take half of the most successful with half the second most successful to create a new pattern
- Repeat with these four patterns
Download
geneticConway.pde -- The Processing code to run the programConclusion
It reaches a good solution quickly, and then doesn't get much better after about half an hour of running it. They develop interesting, psuedo-intelligent, patterns such as 'shooting' multiple gliders and forming large clouds of activity that are very resilient to another color being introduced.
Comments(0)
2009-12-14 18:17:37
Hardware
Software
- TAIM (Alpha Version): GHCI integration with vim
- CheaTorrent -- An evil BitTorrent client
- Self Modifying 2D Turing Automata
- Competing Conway Life Automata
- X11 Timelapse Desktop Video
- Colored Wolfram Automata With Sound Input
- Pseudo Video Feedback in Processing
- Haskell Cipher Saber
- Illegal FIlenames -- Windows and *nix
- Simple Perl SDL Music Keyboard (Updated)
- Image to Spectrogram
- Pastebin Hell
- OMGWTFRNG (OWR)
- OTP Enhancement : Failure Report
- Java Network File Transfer Tool
- AES Encrypted Filesystem Speeds
- Dual Message Encryption
- PHP Website
- Mp3 Splitting Script
- Random Obfuscation Tool
- Filesystem Speed Comparisons
- Java Based Web Server GUI