A collection of hacks and programming ideas that I have published on this blog.

npycat is a cat-like utility for examining and summarizing numpy-generated .npy and .npz files. It provides an array of useful manipulations that are handy in the python deep learning world of pytorch, tensorflow, pycaffe, and theano.

turtlebits.net is a LOGO-like open CoffeeScript programming sandbox for kids (and grownups) to learn programming. It is the companion to a pair of elementary programming textbooks that I am writing. I am convinced that the CoffeeScript language designers have produced a uniquely useful language for pedagogy.

davidbau.com/conformal is a tool for visualizing complex-valued functions as conformal maps. It provides a visualization of complex roots, poles, and unity values, and it also provides a mode where the surface of the earth can be rendered as a conformal map, according to the complex-valued function of your design.

davidbau.com/stuck_pixel/ is a webpage that blinks one pixel that you can move around. Rumor has it that you can sometimes fix and LCD stuck pixel by doing this for a few minutes.

dabbler.org is an open javascript playground with a built-in syntax-coloring editor that gives you a place to edit and post javascript programs. It includes beginning programming examples such as Guess My Number, Caesar Cipher, Fifteen Puzzle, Mutating Madlibs, Concentration, Mastermind, Tic-Tac-Toe, Polygon Drawer, Root Finder, and Cannon Game.

davidbau.com/downloads/pi.py is six-line python algorithm that rapidly generates an unbounded stream of the decimal digits of pi. It is an implementation of an algorithm published by Jeremy Gibbons in 2005. More discussion on pi day 2010, here.

davidbau.com/formula is an interactive text editor for LaTeX-style formulas embedded within HTML. It uses the Google Chart Service for formula layout, and it is what I use to write formula-heavy blog entries like this article about 355/113.

seedrandom.js is an open-source javascript implementation of a seedable pseudorandom number generator to replace Math.random. It provides a cryptographically strong source of random numbers, and it can be seeded manually or using strong sources of true randomness like random.org. A detailed discussion of this library here.

davidbau.com/encode is a simple secret code webpage for my kids that uses seedrandom.js to scramble letters. The ciphertext is always generated in a way that is paper-and-pencil-friendly.

davidbau.com/mandelbrot
is an interactive mandelbrot set explorer that computes and renders the well-known fractal set using the canvas tag. It renders incrementally for speed, and it lets you zoom in by up to 12 orders of magnitude by clicking on on areas of the fractal. Discussion here.

davidbau.com/reversi is a javascript-based Reversi (Othello) player that deploys an AI written in javascript against you. It's reasonably clever, and you have to work a bit to beat it. You can play white or black, undo your moves, etc. The javascript reversi gadget also makes an apperance playing against itself in this blog entry about arbitrage. Some discussion of reversi here.

davidbau.com/taxman is a javascript implementation of a mathematical solitaire game having to do with divisibility explained here. It is a nice teaching tool for young ones learning about primes and factors.

davidbau.com/sudoku is a sudoku hint machine and a sort of "word processor for sudoku puzzles". You can use it to enter any sudoku puzzle, fully or partially specified, or partially solved, and then it can either make it into a fully specified puzzle or give you hints as to how to solve the puzzle. It's also a useful gadget for making a URL for a sudoku puzzle that you can email to somebody else.

downloads/templet.py is a beautiful python string templating library that works by giving you a simple python function decorator that makes a python function into a string template. It has proved to be terrifically useful for me when putting together both big and small HTML templating hacks - I find that it is faster, simpler, and more maintainable than complex template systems like the one that comes with Django. More about my string templating library here.

davidbau.com/generated/maze.pdf is a PDF maze generator implemented in 152 lines of python code and discussed a bit here. You can use the form to control how complicated you want the maze to be. The nice thing about the generated mazes is that you can generate mazes with crossings, which makes them far harder to solve.

davidbau.com/fireball is a flash game that Anthony and I put together one weekend using open-source tools mtasc and swfmill. This is pretty much the limit of my experience with Flash.

davidbau.com/generated/sudoku.pdf is a printable PDF sudoku generator implemented in 250 lines of python code. The generator is discussed here.

davidbau.com/python is a two-day lesson plan for teaching elementary school kids how to program in python by having them build a game of Hangman. More discussion here.

davidbau.com/downloads/pylife.py is a silly python (and curses) implementation of Tomas Rokiki's amazingly fast implementation of Conway's game of life. By using very clever hashing, the algorithm can double the number of generations and cells computed at each iteration. It is a rare example of an exponentially-fast algorithm. More discussion here, along with links to an unbelievably fast C implementation.

Haarg, world is a series of articles about trying to teach my oldest son to program in python when he was six years old. Great fun.

**Some Less Recent Hacks**

Dave's Quick Searchbar Deskbar is a little Windows search gadget hack I wrote in 2001 that became popular and grew a little developer community that continues to maintain it now. It was my first direct experience with the power of the GPL.

davidbau.com/downloads/life.scr is a "Conways game of life" screensaver for Windows that I wrote to run on Windows 95 to replace the similar screensavers I had written for Mac and NeXT. While those other screensavers have long since become impossible to run, through the magic of Windows compatibility, the Windows 95 version still works today.

davidbau.com/downloads/labyrinth.ps is my winning entry to the 1993 Obfuscated Postscript Contest. You can still print it today, and if your printer implements a random number generator, it still comes out differently every time.

Posted by David on March 15, 2010
| Comments (0)

Copyright 2021 © David Bau. All Rights Reserved.