KnockKnock

Igor's C++ Grimoire

This is an attempt at documenting, in a vaguely human-readable form, C++11, C++14 and C++17. I am slowly starting to get around to adding C++20 to it.

The document is deliberately written as a single HTML page (with all CSS, pictures, etc built-in) so it can be saved and copied as just a single (rather large - about 2MB) file. If you find it useful and refer to it a lot, then please make a local copy of it and check back now and then for updates. If you find any problems with it (errors, omissions, or just suggestions) then please let me know; details are in the Introduction

Please note that when saving local copies of web pages, some browsers will default to packaging them up into a '.mht' format. As this is a single file anyway, there is no need to do this; just save it as a normal '.html' file

Enough rambling... Here is Igor's C++ Grimoire. Latest version is dated 12/02/2022

Stoprot

Stoprot generates Reed-Solomon error correction data for any file you care to throw at it. I wrote it to protect data that I store on my backup drives. Magnetic storage systems, CDs (remember them?), etc are not perfect and over time suffer from 'bit rot' (random errors accumulating in the stored data). Some more sophisticated file systems can protect against this, but most (like the ones I use on my backup drives) do not

Stoprot can be used in two ways; one way is to take the original data file and generate the RS code from it in a separate code file, leaving the data file unmodified. This allows the data file to be used as-is, with the RS code file only being needed when errors are detected/suspected in the data file (by feeding the data file and the code file into Stoprot, it shall attempt to recover from any corruption that has accumulated). This is very convenient and is the method I normally use

The other way of using Stoprot is to take the original data file, and output a new file which contains the data with the SR code interleaved within it. Assuming only this new combined file is saved, the original data file is recovered by feeding the combined file back into Stoprot which will unpack it, checking it along the way. This is obviously not as convenient as the first method but it has the advantage of keeping the data and the SR code in a single file. For complicated reasons, it is also very slightly more robust (it is able to recover from more severe bit rot) than the method that generates a seperate code file, though the difference is very marginal

Either way, the protection Stoprot gives is pretty robust and it is able to recover otherwise pretty badly corrupted and unusable data. One thing on my TODO list is to make Stoprot multi-threaded. At the moment it is not and the RS code generation is quite computationally intensive meaning that it can take some time to process large data files. But it works well and it's reliable

You can find Stoprot here; stoprot.tar.bz2 (v1.3 18/05/2022)

Some useful vim plugins

A (currently very small) collection of vim plugins written my me. See the README files in each case for full details. As standard, to use each plugin, just un-tar it into your ~/.vim/bundle/ directory and read its README file

SessX Simple Session Management

SessX defines some simple, but very useful, enhancements to the standard session operation. Includes support for saving and restoring the SelX plugin status. Here is is; sessx.tar.gz (10/04/2022)

SelX A Rainbow of vim Selection/Highlighting & Search

SelX provides additional highlighting functions that operate in a very similar way to the standard '*' (and similar) key mappings and the standard '/' (and similar) command line search operations; the difference is that multiple, multi-coloured highlights are supported, operating on a per-tab basis. The highlight selections can also (optionally) be saved as part of a vim session. SelX is intended to complement rather then replace the standard vim selection/search highlight facility. Note that this plugin needs a bit of setting-up to use (but it's definitely worth it!); see the README file. Here it is; selx.tar.gz (02/05/2022)

DrawX ASCII and Unicode Art (etch-a-sketch style)

DrawX allows you to directly draw boxes and lines in vim to create ASCII-art diagrams. There are also functions for drawing boxes and ellipsis (filled and unfilled), flood fill, cut and paste operations that deal with the complexities of drawings (rather than just text) and which also support pasting upside-down and back-to-front. DrawX supports plain ASCII as well as a number of Unicode line styles, or you can create your own line style on the fly. Here it is; drawx.tar.gz (20/04/2022)

MarkX Display where you've placed that mark!

MarkX places signs in the left margin (the signs column, funnily enough) to indicate where marks are placed. It also includes some extra functionality to make using marks a bit more interesting, such as auto-selecting the 'next' mark to place (so you don't have to remember which marks are in use and which are not). Here it is; markx.tar.gz (08/05/2022)

Prose An environment for creative writing

Prose constructs an editing environment intended to help with creative writing. It does this by setting various configuration options and using several other plugins. These is also a syntax file for '.prose' filetypes. Here is prose; prose.tar.gz (03/04/2022), and here are the prose syntax and filetype detection files; prose_syntax.tar.gz (05/06/2021)

Shady A distraction-free display for creative writing

This may be used as a stand-alone plugin or the 'Prose' plugin can be configured to start/stop it. It dims all the text on the screen except for the current paragraph. Here it is; shady.tar.gz (03/04/2022)

My vim configuration

My Vim Config (12/05/2022)