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...
- Virtual movements of
j
andk
keys over wrapped long line (equivalents for^
and$
are simplyg^
andg$
respectively---these are not remapped by default). - Added F12 shortcut to force Vim to re-parse the file contents for syntax highlighting.
- Making visible various invisible whitespace characters that shouldn't be around.
- Use of
@
character to show a wrapped long line. - Hexadecimal representation of character under cursor to track awkward Unicode related issues.
- Local time clock in ruler.
- Text width highlight (defaults to 76 characters for historical reasons).
- F5 to insert ISO-8601 format timestamps.
- Shift-F5 to replace existing ISO-8601 format timestamps.
- Workarounds for
strftime()
in Windows (for versions prior to Vim 8.1). - Auto time-stamping of print outs (requires workaround for Windows for versions prior to Vim 8.1).
- Large file detection to reduce lag (threshold set at 10MiB).
^
,0
, and$
are remapped tog^
,g0
andg$
respectively. This mode does foul up the loading of other files, so it is best used in a separate instance. - 256-colour terminal support where available.
- Reduction of migraine inducing effect in
vimdiff
. - Made line joining with comment characters automatically remove said comment characters.
- Language specific overrides of the above default behaviours using
autocmd
to keep things in one file. - Added automatic highlight to column to Python and regular text files for alignment purposes. This may be slow on slower terminals, so consider turning it off if it is the case.
- Added F7 and F8 shortcuts to trigger NERDTree and tagbar respectively.
- Special
retro_dos
flag to set up a retro-DOS editor colour scheme.
Highly recommend using it with the following plugins (easy to install for Vim 8+ without additional plugin manager):
- Vim Polyglot. Loads up the syntax highlighting just that fraction faster.
- NERD Commenter. Excellent for mass commenting/uncommenting lines. By default, uses
\
as the ``leader'' or user-defined escape key. - NERDTree. Allows browsing directory without losing sight of the whole tree.
- Tagbar. Requires either Exuberant Ctags or Universal Ctags.
bzip2
).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.
bzip2
).QuickBASIC/QBasic Syntax Highlighting in Vim
Syntax highlighting script for the QuickBASIC/QBasic language for Vim. Key features include:
- All keywords that appear in the QuickBASIC help file's index pages have defined matching rules.
- Use
qb_qbasic
flag to limit keywords to only those that QBasic recognises. - Ignores case for all keywords and identifiers.
- Very rudimentary lexical-level syntax error highlights.
- Supports highlighting
TODO
,FIXME
, andXXX
tags in comments.
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.
bzip2
).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.
tar+bzip2
).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.
tar+bzip2
).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:
- Power status (AC/DC).
- Overall battery status (charge, discharge, neutral).
- Overall charge status in gauge form (including lost capacity from wear and tear).
- Miniature gauges for individual batteries.
- Time estimates for either complete discharge or complete charge.
- Up to 10 batteries searched.
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.
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.
tar+bzip2
).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.
tar+bzip2
).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:
- Linear chaining via head node linked list to resolve hash collisions.
- Array doubling to increase capacity when specified load factor is exceeded.
- ``Rustic'' iterator mechanism to run through all elements.
- Shallow copy of elements made on insertion.
- Self-contained memory management via
malloc()
.
Like the Extensible Buffer, look for the header file (minihash.h
) for details on how to use it.
tar+bzip2
).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.
tar+bzip2
).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.
tar+bzip2
).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.
zip
); access help file.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.
tar+bzip2
).