Archive by Author | Darren

TDE icon stuff — extract an icon from an EXE or DLL

First, I got a look at the old TDE icon — you can use icoutils to extract icons from Windows EXE and DLL files:

$ apt-cyg install icoutils
$ wrestool tdew.exe
--type=3 --name=1 --language=1033 [type=icon offset=0x580ec size=872]
--type=14 --name=1 --language=1033 [type=group_icon offset=0x58458 size=20]
--type=16 --name=1 --language=1033 [type=version offset=0x58470 size=752]
$ wrestool -x -t14 --output=. tdew.exe



Very small, quite pixelly.

Fuzzy T

Old TDE icon

$ convert tdew.exe_14_1.ico tdew.exe_14_1.png

To get a replacement that matches, I imported this into a drawing program, even MSPAINT.EXE would do, scaled it up, typed a capital T in a matching font over the top of it (bold Times New Roman seems to match closely), then made a new, empty file and used the same font, and and saved it back to an ico file (can use convert to make the ico).

New one is just a white T on a black background, with rounded corners, cutoff bits transparent (see eg this post).

Here we have it:


New less fuzzy icon

Bigger, possibly better …



Wrong tab icons in Firefox

Tabs in Firefox show the wrong icons.

Mismatched icons -- eg ebay has Telstra icon

Mismatched icons crossed out!

I opened a terminal and typed:

$ find . -iname "favicon*"

And it dug up:


So I quite Firefox and went:

$ rm ./.mozilla/firefox/abcdef.default-1234567890/favicons.sqlite

Then restarted Firefox.

I now got:

All blank icons

Is this any better?

Now, I visited each link.

Most of them found and used the correct icon. A few did not; they mostly sorted themselves out soon enough! Better, I think.


A simple pandoc/markdown cheat sheet

pandoc is a tool suite for converting between text formats. I find it useful as a writer (rather than a techie) to convert something written in plain text into an RTF file that I can read readily, with some formatting, in a word processor, up to and including the dreaded Word. What I outline here is a tiny fraction of what it can do.

It is as simple as:

$ pandoc -s file.txt -o file.rtf

(Replace ‘rtf’ with html etc to get something else.)

It can convert a file of nothing but typing, but if you use a little simple formatting, pretty much a version of markdown syntax, you can get a nice RTF with some useful extra features (italics, for example). For a heading, underline with equals or hyphens on the very next line;

Heading here


Heading here

when processed, that gives a heading. (Though for proper H1 H2 etc, see below.)

Paragraphing is determined by empty lines, so this text gives one paragraph in the RTF, and…

This text
also gives
one paragraph
in the RTF.

If I want to force a return, I end a line with a backslash.

This will not work inside back ticks (see below), which is the verbatim environment, so for example if I want a bunch of stuff verbatim, without interparagraph spacing, I end each line with a backslash outside the backtics:

`line 1`\
`line 2`\
`line 3`

will give

line 1
line 2
line 3

Formatting fonts

The word is the character used to delimit the modified text. The code, verbatim, is also given.

underscore _underscore_

dollar (math, which does not translate into RTF) $dollar$

caret (superscript) ^caret^

tilde (subscript) ~tilde~

2 tildes ~~tilde~~

2 underscores __2 underscores__

2 asterisks **2 asterisks**

3 asterisks ***3 asterisks***

back tick `back tick`

Note that when using back ticks (verbatim) the nesting of the instructions matters

***back tick outside 3 asterisks***

3 asterisks outside back tick

2 asterisks outside back tick

1 asterisk outside back tick

Other stuff

(Note, line above (‘Other stuff’) was underlined with hyphens on the immediate next line.)

nonbreaking space – precede a space with a backslash: ‘\⌴’ (I’m using ⌴ for a space)

block quote: > (greater than introduces a block quote indented by 1 tab)

block quote, again: >> same, bigger indent

So, for example

>This text would appear as a block quote indented by 1 tab.

H1 (1 hash, #)

So type:

# Here is my heading 1

H2 (2 hashes, ##)

## Here is my heading 2

H3 (3 hashes, ###)

### Here is my heading 3
  • bullet point (+ at start of line, then space)
  • bullet point (- (hyphen) at start of line, then space)
  • bullet point (* at start of line, then space)
  1. Numbered list
  2. Numbered list still
  3. Numbered list again

(just start a line with a number and a stop)

– 2 hyphens for en rule

— 3 hyphens for em rule


Some formats (eg HTML) like metadata to be specified. Simplest is to put

% title
% author(s)
% date

at the very top of the file (replace ‘title’, ‘author’ and ‘date’ with your own text).

Chalk it up.

gnu diction — find wordy and commonly misused phrases in texts

The gnu program diction searches text files for known poor constructions, based on a database. (See also gnu style.)

I installed it from GetGnuWin32.

For example:

$ diction -s makeemf.txt 
makeemf.txt:5: I have all the poppler stuff installed, [so -> (do not use as intensifier)]:

makeemf.txt:13: I use pdfcrop from TeXLive pdfcrop --margins "-52 -250 -20 -25" page4.pdf page4-crop.pdf [So -> (do not use as intensifier)] now I have my PDF.

makeemf.txt:17: [Can -> (do not confuse with "may")] I import it into Word?

3 phrases in 14 sentences found.

The things to be checked are enclosed in square brackets. The -s causes diction to provide suggestions.

Tools to be used along with it might include unrtf, unhtml, libreoffice command line, and other tools that convert marked-up and formatted files to plain text.

Look here for interesting examples of how to make a custom style to find things in your documents:

The diction databases are, in my case, stored in:


I imagine on a Linux system they’d be in /usr/share, but I have not checked. Anyway, typically a file look like this:

$ head /cygdrive/c/Users/darren/installs/getgnuwin32/GetGnuWin32/gnuwin32/share/diction/en
 a considerable amount of much
 a large number of many
 a lot of Often obsolete, should sometimes be replaced by "many"
 a majority of most
 a man who
 a matter of concern (cliche, avoid)
 a need for need
 a number of many, several
 a particular preference for
 a small number of few
(and so on)

Note that the left is the phrase to check for — including any leading spaces — and then after a tab (must be a tab to distinguish it from spaces within the phrase) comes the suggestion, if there is one. Very simple!

Could easily make up a diction file to look for your pet hates or common errors.


Wherever you go, there you are. — hahahahahahahahah

Here is a book searched up on the .au site:

Mathematics into type on amazon Australia — price, $374

And on the US site:

And in the US — $22

OK, postage will be more from the US. But $350? I don’t think so.

In the end I bought a copy from discoverbooks.

Amazon, indeed.

The twin window manager

The Text WINdow manager, twin, is quite a nice piece of software if you don’t
want to have to run X, though it can run within an X term.

GitHub – cosmos72/twin: Text mode window environment. A “retro” program for embedded or remote systems, that doubles as X11 terminal and text-mode equivalent of VNC server

I have found that it works extremely well with the ‘leggie’ fonts, from
Leggie, a legible, pretty bitmap font

Here is an example of a twin session, captured using fbcat.

4 windows within a twin session

twin is great for running a bunch of text applications

So this was a twin session, using the leggie18 font, on a netbook.

Top-left is a Gopherus session, top right is a window on my account, bottom-left is Vim editing a LaTeX file and bottom-right is an Alpine
mail window.

twin has many capabilities — this only shows you what it looks like. One cannot run framebuffer graphics inside twin windows — eg fbi, or dosbox (which uses sdl) — but I have found that a twin window on one virtual console, and then a ‘bare’ framebuffer on a second one makes for a good combination for working without X.

I have noticed that some fonts give ugly outlines on the windows (rows of diamonds or non-characters). The leggie fonts on 32-bit Debian give neat lines around the windows. YMMV.

Some nice features include a built-in clock (see bottom-right corner), and the ability to type in a window while keeping it behind others. That’s why the screen capture command is invisible in the screen grab above. Alpine, links, lynx and other text-based network tools work fine, plus all your other console tools. It is very light on resources, too. top suggests it uses about 0.5% of my memory and CPU — and I am running an old netbook with 1GB RAM and an Atom N550 chip!

Could form the basis of a Linux distro to challenge TinyCore,



Black screen with mouse after Windows login

Note to self

  1. Booted Win 10 machine.
  2. Got usual login screen.
  3. Logged in as per usual.
  4. Got a black screen with a working, visible mouse pointer.
  5. Ctrl-Alt-Del.
  6. Got the menu and chose Task Manager.
  7. Went to start up items and disabled most items, but enabled ‘Lenovo Utility’.
  8. Used Ctrl-Alt-Del to reboot.
  9. Got the screen back.

Of course, I’ve skipped all the messing around that I really did.

I don’t know why. Other non-admin account on the machine worked fine, so something funny happened in a setting somewhere. Anyway, there you go.

Win 10

tilde — my crude automated webpage

The whole world of ’tilde’ accounts is to give you a little server space where you can monkey around in bash and maybe build a website the 1990s way — by editing HTML in nano, emacs or vim.

Mine is here:, and this is how it looked as-provided by the admin:

A brand new tilde club page

As provided

I have set it up so that if I scp files into the right directory, they will be automatically added to the index.html.

Consider the following bash script. I log into my account and run it from ~/public_html using nohup so that it does not stop when I log out. The script lives in the ~/public_html/pages directory and just creates a block of HTML with links to each of the HTML files it finds in there.

The script then creates a little file with the time and date updated information in it, then cats all the bits together, then sleeps for a day and runs again. My scripting is very crude, but seems to work.

while true
  cd pages
  cd  ..
  echo \<p\> \</p\> > date
  echo \<p\> \</p\> >> date
  echo Last updated: `date` >> date
  cat pages/index.middle.html date index.tail.html > index.html
  rm date
  sleep 24h

Here is the text of It loops over all the .html files in the directory. The echo command prints out a line of the form of a basic HTML link. It grabs the second line of the html file for use as the link text (that is what the head/tail bit does) then creates the link.

rm index.middle.html
for f in *.html
	echo \<p\>\<a href=\"pages/$f\"\>$(head -2 $f | tail -1)\</a\>\</p\> >> index.middle.html

The output of looks something like

$ cat pages/index.middle.html 
<p><a href="pages/hermes10.html">The Hermes 10 electric typewriter</a></p>

So all I have to do is make sure I upload a HTML file (with its dependencies) that looks something like the one below. Top 3 lines are:

  1. open comment
  2. link text
  3. close comment.

After that, any legit HTML should do.

Link text - always here.
  <h1>Main heading</h1>



So I make up my new page locally, with the correct 3-line header, then scp it to the correct folder, and the script wakes up once a day and adds the page to the index.

Crude, but effective. Obviously, I can complexify what I do and add more features, but I’ll let that evolve with time.



Simple surface plot in gnuplot

Here’s a random example for no good reason.

Here is the gnuplot script (

set iso 30
set samp 50
unset key
#set title "sin(r)"
set xlabel "x" font "Times:Italic,14"
set ylabel "y" font "Times:Italic,14"
set zlabel "z" font "Times:Italic,14"
set xrange [-4:4]
set yrange [-4:4]
set xtics offset -0.5,-0.5
set ztics 1
unset surf
set style line 1 lt 4 lw 0.5
set pm3d
set term post level1 color font "Times,12" fontscale 1.0
set output "plotfile.eps"
splot sin(sqrt(x**2+y**2))

Here are the commands run at the command line:

$ gnuplot 
$ epspdf plotfile.eps
$ xpdf plotfile.pdf
$ pdftoppm.exe -r 600 plotfile.pdf > plotfile.ppm
$ convert plotfile.ppm plotfile.png
$ display plotfile.png
$ rm plotfile.ppm

And this gives me an eps, a pdf and a png:

89K  plotfile.eps
56K  plotfile.pdf
990K plotfile.png
A coloured surface plot drawn in gnuplot using the script above


And here’s a simple script to plot sections through the surface:

$ cat 
unset key
#set title "sin(r)"
set xlabel "x" font "Times:Italic,18"
set ylabel "z" font "Times:Italic,18"
set xrange [-4:4]
set yrange [-1:1]
set border lw 0.25
#set style line 1 lt 4 lw 0.5
set term post level1 color font "Times,12" fontscale 1.0
set output "plotfile-cut-y=0.eps"
plot sin(sqrt(x**2+0**2)) lc rgb 'black' lw 4
set output "plotfile-cut-y=1.eps"
plot sin(sqrt(x**2+1**2)) lc rgb 'black' lw 4

And here is plotfile-cut-y=1

A section through the surface, where y=1; looks a bit like a capital M

Section where y=1


Making a little icon for the webpage

You know those icons you get in the tabs when you view a webpage? They are really easy to do.

This is how I did one for my page.

First, I found an image I wanted (from something related to this). It was in a PDF I had made some time ago, so I converted the PDF to a raster format, then cut out the bit wanted.

$ pdftoppm -f 1 -l 1 -r 600 mzfntdoc.pdf > icn.ppm
$ pnmcut 2935 2600 138 80 icn.ppm > cut.pnm

Convert to ico and png

$ convert cut.ppm cut.png
$ convert cut.ppm cut.ico

Copy to the filespace on the account.

$ scp cut.png

Add a single line to the index.html — in the <head> … </head> field.

	<title>Random pages</title>
	<link rel="icon" href="cut.png">

That’s it. Here is the icon:

M Z in blocky text

The icon

And here it is in action — the webpage viewed in Firefox shows the icon in the tab.

The icon appears on the tab in Firefox

There it is!

That was easy!