``Computer Stuff''

I ran out of good naming schemes for stuff relating to computers that are cool to download and use that are not part of existing projects, so I'm just calling it ``Computer Stuff'' for now. Stuff that I have here are configuration files, and other miscellaneous projects that fit nowhere.

Files here tend to be processed with tar and bzip2, with the occasional zip.

Configuration Files/Scripts

Here are some customisations that I have done for some of the tools that I use on a daily basis. The new URLs provided are canonical, but I will still retain the old ones from the past via the .htaccess file just for convenience.

Vim Configuration

My customised configuration file for Vim. Key features include...

Highly recommend using it with the following plugins (easy to install for Vim 8+ without additional plugin manager):

Download .vimrc (bzip2).
Updated at 2021-10-01T02:15:53+0800.

GNU Screen Configuration

I use GNU Screen as my terminal multiplexer when working on virtual machines and servers. This configuration file is merely to set up GNU Screen to use 256-colours in its terminal emulation.

Download .screenrc (bzip2).
Updated at 2016-03-05T03:28:10+0800.

QuickBASIC/QBasic Syntax Highlighting in Vim

Syntax highlighting script for the QuickBASIC/QBasic language for Vim. Key features include:

For it to work properly, I suggest modifying your .vimrc file to contain this incantation in it:

au BufNewFile,BufRead *.bas,*.bi set filetype=basic.qb

The idea here is to make use of the compound file type feature of Vim to apply the syntax highlighting rules from left to right, using the `.' as a separator. qb.vim discards all the rules of basic.vim to replace it with its own, but we still need the ``basic'' string to be present for downstream tools to do the right thing (like NERD Commenter).

You will also need to place the unpacked qb.vim in a search path for the syntax highlight loader to find it. Details may be found in in this tutorial.

Script was inspired by the weakness of the built-in and updated version of basic.vim and features from freebasic.vim. This is really a long time coming---I just wasn't annoyed enough till now to make my own version that works to what I believe it ought to be.

Download qb.vim (bzip2).
Updated at 2021-10-03T15:01:14+0800.

Command Line Tools

This section is for some small programs that I wrote to accomplish some specific outcome. I am language agnostic, and so these tools may be written in any language that suffices for my purpose; usually these are either in Python 3, or C/C++.

Typewriter-like Line Printer Emulator (ASCII version)

This is a tool that takes in an ASCII text file and generates a passable PostScript file that emulates the output of a printer that was sent this file. This supports emulating overstriking of characters to as many depths as memory allows, as well as a ``typewriter'' mode where each character generated is jittered to simulate the imperfect register of the keys striking the typewriter ribbon.

The command line help is relatively extensive, but there is no interactive interface whatsoever---just pipe the ASCII text file in and redirect the output to a file for conversion from PostScript to some other format.

As noted in the README, you may need some tool to convert from PostScript to whatever format you want the file to be in.

This is the ASCII (or technically, Latin-1) version. I have a Unicode one also.

The source has been updated to work with Python 3 as Python 2 will no longer be supported beyond Jan 01, 2020.

Download LPR Emu (tar+bzip2).
Updated at 2020-10-16T20:36:21+0800.

Typewriter-like Line Printer Emulator (Unicode version)

Like the previous tool, this emulates a typewriter like printer. Unlike the previous tool, this supports the full Unicode range that GNU Unifont supports.

The tool works the same way as before, but requires a database of bitmaps for all Unicode characters to be generated from GNU Unifont. The README will have more information.

Download uLPR Emu (tar+bzip2).
Updated at 2020-10-16T20:36:21+0800.

Powerbar Display for Windows

The idea of this tool is to provide a fast command-line version of a gauge and associated estimates for battery information for laptops in Windows. The inspiration for such a tool comes from my general trend of working almost exclusively in a full-screen command line prompt with the taskbar hidden, which removes the ability to see at a glance the battery status. Features include:

Provided here are two files: the C++ source code in bzip2, and a ready-to-go version zip file. The zip file includes the cygwin1.dll file from Cygwin, which is provided unchanged to allow the compiled exe file to run on its own without a full Cygwin installation under the linking exception of the Cygwin licensing terms. To compile the C++ source file for oneself in Cygwin, the relevant incantation is:

g++ -Wall pbarwin.cpp -lsetupapi -opbarwin.exe

Interestingly, the included exe version is built with:

g++ -Wall -static -Wl,-s pbarwin.cpp -lsetupapi -opbarwin.exe

The added flags remove the need to distribute the C++ related DLL files, since they have been statically linked in. The stripping flag reduces the output exe file from 11+ MiB(!) to less than 900kiB.

Compiling it in Visual Studio is also possible, but involves creating a new project for the pbarwin.cpp source file, and including the setupapi.lib library to link to. No project file is distributed here to do this though---it is messy to get right, and the compiled program somehow managed to be both smaller in size and slower by an order of magnitude (when compiled in Visual Studio). It is a simple enough program that the instructions provided here should be enough to re-create it if so desired.

Download pbarwin.cpp (bzip2); pbarwin.exe (zip file including dependencies).
Updated at 2021-09-15T02:01:13+0800.

Uncategorised Projects

These are just stuff that I had done over time that are in a form that can be released. As a general rule of thumb, they are meant to be downloaded and run on the local machine, with a high chance of being unrunnable on a web browser. The usual disclaimer applies---bug fixes and other constructive comments are always welcome.

None of the projects here include anything from my work unless otherwise noted.

Small Chew

Small Chew was a quick-and-dirty summer project that I did in 2008 with the intention of implementing a really bare-bones stack machine that runs Forth. It was also an exercise in messing around with micro-architecture design, not to mention my first real use of Python to do anything; the coding style really stinks.

Since this is such a hack job, there is no proper interface to the compiler (technically a source translator to virtual machine)---details can be found in README. It was a really fun project though, and gave me some insight on how to design a simplistic stack machine.

And mess with Python.

Recently updated to work with Python 3, and fixed some weird memory bug that didn't show up before; not sure why about that bit.

Download Small Chew (tar+bzip2).
Updated at 2021-02-05T22:46:41+0800.

Extensible Buffer

This simple C/C++ package implements an extensible buffer which allows one to keep appending octet data to it without running into buffer overflow problems. It was created when implementing some application-level protocol for a server programming class specifically to deal with that buffer overflow attack.

Word to the wise: the code is stupid simple and relatively self-explanatory. Read e_buffer.h to get a sense of the data structure and the ``methods'' available to operate on the data structure.

There are better ways to do this, but this code is useful for when the larger libraries are not applicable for some reason.

Download Extensible Buffer (tar+bzip2).
Updated at 2016-03-05T03:28:10+0800.

Mini Hash

A simple implementation of a hash table in C/C++. Probably not useful now, but great for low-level C programming without access to the STL. Features include:

Like the Extensible Buffer, look for the header file (minihash.h) for details on how to use it.

Download Mini Hash (tar+bzip2).
Updated at 2016-03-05T03:28:10+0800.

Mini List

A simple implementation of lists in C/C++. Probably not useful now, but great for low-level C programming with access to the STL. Basically a head node singly-linked list.

Like the Mini Hash, look for the header file (minilist.h) for details on how to use it.

Download Mini List (tar+bzip2).
Updated at 2016-03-05T03:28:10+0800.

Adaptive Simpson's Rule

Numerical integration of a function through the use of an adaptive form of Simpson's Rule. ``Adaptive'' in the sense that the number of sample intervals are controlled using the error estimate for that interval as the main interval for the integration is recursively carved up.

Written in Python.

Download Adaptive Simpson's Rule (tar+bzip2).
Updated at 2016-03-05T03:28:10+0800.

Notation for Exotic Pitched Events

As part of my final project for Introduction to Computer Music in Spring 2009, I wrote a tuning layer that sits between the user program and the underlying Nyquist system.

I'm still maintaining this code, but there really hasn't been much that needs to be amended. Don't let the ``legacy'' prefix in the URLs below fool you---the legacy aspect comes only from the fact that I did not update the design of the help file to conform to what I am currently using.

Download Tuning Layer (zip); access help file.
Updated at 2016-01-19T22:22:15+0800.

Slim 8×8 Console Font

I created a slim 8×8 console font for use in pure consoles. This replaces the default 8×12 bitmap font and provides 50 lines of text in console mode.

Mostly useful for the ``raw'' VGA console in Linux machines.

Download Slim 8×8 (tar+bzip2).
Updated at 2016-03-05T03:28:10+0800.