Mark Fickett | Code

Legal Stuff

For now, consider anything with source provided under the GNU General Public License, and anything without source to be All Rights Reserved. If in doubt, ask; if enjoying, tell; if buggy, complain: contact Mark Fickett.

Contents

Scripts (usually small, hopefully useful tools)

UPenn (graphics and games for intro programming at the University of Pennsylvania)

Pretty (just to look at)

Scripts

Most of these I use by putting something like this in my .profile (the startup file for /bin/bash, default under MacOS X):

alias comics='~/Documents/code/comics/allcomics.command'

Then, I just type comics to invoke the script.

Details for installation and setup, if applicable, will be in a README.txt. In most cases, this involves unzipping (double-click in MacOS X, tar xvfz script.tar.gz under any *nix), perhaps editing a configuration file, and optionally aliasing the script file (as above).

comics (shell script; MacOS X/*nix)

Download: comics.tar.gz

This checks a number of comics (or other sites I look for periodic updates from), and opens any with new content. A typical invocation looks like this:

markfickett: comics $ comics
cat: bunnyhtml: No such file or directory
Error in bunny: no match.
  No new catandgirl.
  No new dooce.
  No new drmcninja.
     New ddoi!
  No new samandfuzzy.
  No new orneryboy.
  No new qc.
  No new scarygoround.
     New shortpacked!
  No old gc.
  No new asofterworld.
     New qwantz!
  No new flakypastry.
  No new postsecret.
  No new xkcd.
  No new wondermark.
  No new webkit.
markfickett: comics $

(In this case, the server hosting bunny was down.) The default configuration, for MacOS X, uses the open command; by changing OPENCMD='open' to, for example, OPENCMD='firefox' in comics.sh, it can easily be made to run on Linux.

spawn (shell script; MacOS X)

Download: spawn.sh

This spawns one (by default) or more new Terminal windows (by default) or tabs in the current directory (pwd). I frequently find myself working on a file and needing to sumultaneously edit 'nearby' files; this saves a little trouble. With minor editing, the same scheme also allows starting other commands in new Terminal windows.

Here, spawn was executed from the top window, which spawned the four new windows below.

usage: spawn [n]

timesheet (Java, Text UI)

Download: timesheet.tar.gz

This aims to make arbitrary-time hourly pay easy to calculate (for example: tracking hours while working from home, when not working on a rigorous schedule). A typical interaction goes as below:

markfickett: markfickett $ timesheet
Type "help" for help, "quit" to quit.
> start
Starting entry at 2007 Jan 07 01:43
> end
Ending entry at 2007 Jan 07 01:43
> summary
Mark Fickett
Example Job
3.047 for 01/07
> show
name    Mark Fickett
job     Example Job

# Date  (Day)           Start   End     Time    Rng/Weely total

2007 Jan 07 (Sun)       01:43   01:43   3.047   3.047   3.047 for 01/07

> save
> quit
markfickett: markfickett $

The timesheet itself is stored in a human-readable / human-editable file; what is dumped to the terminal when the show command is issued. The configuration file (specifying timesheet file location and allowing multiple jobs to be tracked), ~/.timesheet.conf, looks something like this:

default ese112
ese112  cse1xx
sample  ~/Documents/code/timesheet/sample.timesheet
cse1xx  ~/Documents/work/cse1xx/times.txt
psych   ~/Documents/work/psych/times.txt

In the above, ese112 is the default job, and is an alias for cse1xx.

screenshot (shell script, Automater; MacOS X)

Download: screenshot-2006Oct13.tar.gz

Now and again, I want to take a screenshot from the command line on MacOS X; this lets me do it. Invocation looks like this:

markfickett: markfickett $ screenshot
Creating directory /Users/markfickett/Desktop/screenshots
Capturing screenshot
Waiting.....
Saving as /Users/markfickett/Desktop/screenshots/Screenshot.070107-022241.png
markfickett: markfickett $

After execution, there's a (in this case new) screenshots directory on my desktop with an appropriately named new file in it.

gmail (shell script, Java; Linux)

Download: gmail.tar.gz

Uses: GMail API for Java

When I am without my Gmail widget, this serves as a command-line replacement. It checks my accounts (in parallel), and then prompts to open any with new messages (in sequence). At the moment, it relies on what might be a bug in either g4j or my use of it, which isn't ideal, but works on Linux (Ubuntu). Invocation looks like:

$ gmail firstaccount: 0 anothergmail: 3 yorkshire: 1 open firstaccount (y/[^y])? [y] n open yorkshire? (y/[^y])? [y] y $

By default, it opens the Gmail accounts in firefox in the background, although it can easily be configured to behave differently. (The prompt, means: (y/[^y]) the options are y or not-y, and [y] the default is y.)

UPenn

These Java apps (presented as applets) were developed for the University of Pennsylvania's introductory computer science course(s), mostly for CSE 110. As such, their source isn't to be freely distributed (and the posted examples are obfuscated — please don't decompile).

The general philosophy behind them is to allow beginning programmers to write very simple models (a MineSweeper cell that knows whether it's a bomb, if it's uncovered, and how many neighboring cells are bombs), which when dropped in with provided code provide a fully functional, GUIed product, at the core of which is their code.

Mechanicals

View: Applet

Download: mechanicals-obf.jar (executable jar)

mechanicals in action: a bolt with a slider and two cranks attached in sequence, input location/angle and output location/angle displayed

This system aims to demonstrate simple mechanical devices (sliders and cranks) which are composable (one can be stuck onto the end of another) and memoryless (previous states don't affect them).

In the applet, a bolt must be created first, then others can be attached. Click and drag on the green circles to rotate; click and drag on the yellow double-triangle to move a slider along its rail. As a bonus, tap r to move all sliders and rotate all cranks, leaving a trail of bolts.

MineSweeper

View: Applet

Download: minesweeper-obf.jar (executable jar)

a minesweeper game in progress

Enter desired dimensions/mines in the initial window, then hit 'enter' to start. Controls are (what are probably the standard ones):

BotWorld

View: UPenn BotWorld page

an illustration for the MazeBot assignment

BotWorld is intended as a friendly introduction to Object-Oreinted Programming, letting students play with OOP (and graphics) first, rather than going through the overhead of building (procedural) programs first. The assignments start with one that just lets them play with Bots — moving them around through DrJava's interactions panel — then steps back to do some method-writing and algorithm design. The MazeBot assignment comes later in the sequence, after simpler assignments like implementing turnRight() from turnLeft() or move(int n) from move().

I am responsible for most of the BotWorld code; this assignment was originally by Kevin Lerman, though I reworked it somewhat.

BotWorld grew out of a PacMan assignment (aiming to be more general/friendly), and drew some inspiration from Karel J. Robot.

Frogger

Yet to be happy running from an applet.

frogger, having drowned once and been hit by a car once, among cars with the river yet ahead

Pretty

Just because it's fun to play with / look at.

Fluidballs (Java, using Java2D)

View: Applet

Download: fluidballs.jar (executable jar)

Download: fluidballs.tar.gz (source, scripts for starting with various interesting parameters)

balls with simple physics, behaving like a wave

The original intent of this was to become a MacOS Screensaver; I got as far as a Java/Java2D port, but couldn't find a good example or how-to for building a full screensaver. As is, there are lots of options to tweak (documented in the README.txt file) for an amusing viewing experience; also, the colors are more exciting than the original, with outlines that blink on contact and a fill that varies with velocity.