Instagram filter used: Inkwell
Author: scruss
-
fixing firefox’s fugly fonts on Ubuntu
Update 2015-09: Better yet, install Infinality. It makes font rendering pretty.
Switching back to Linux from Mac is still a process of ironing out minor wrinkles. Take, for example, this abomination (enlarged to show texture):—
… No, I’m not talking about Mr Paul’s antics (or the typo in the TP post, either), but the horrid non-matching ligatures (‘attack’, ‘flubbed’, ‘targeting’) in a sea of blocky text. Almost every programme I was running had this problem. Mouse over the image to see how it could look if you apply this easy fix.
Create (or edit) the file
~/.fonts.conf~/.config/fontconfig/conf.d, and add the following lines:<match target="font" > <edit name="embeddedbitmap" mode="assign"> <bool>false</bool> </edit> </match>
Log out, log back in again, and text is properly pretty. Yay!
-
clean up your GnuPG keyring
For reasons too annoying to explain, my GnuPG keyring was huge. It was taking a long time to find keys, and most of them weren’t ones I’d use. So I wrote this little script that strips out all of the keys that aren’t
- yours, or
- signatories to your key.
The script doesn’t actually delete any keys. It produces shell-compatible output that you can pipe or copy to a shell. Now my keyring file is less than 4% the size (or more precisely, 37‰) of the size it was before.
#!/bin/bash # clean_keyring.sh - clean up all the excess keys # my key should probably be the first secret key listed mykey=$(gpg --list-secret-keys | grep '^sec' | cut -c 13-20 | head -1) if [ -z $mykey ] then # exit if no key string echo "Can't get user's key ID" exit 1 fi # all of the people who have signed my key mysigners=$(gpg --list-sigs $mykey | grep '^sig' | cut -c 14-21 | sort -u) # keep all of the signers, plus my key (if I haven't self-signed) keepers=$(echo $mykey $mysigners | tr ' ' '\012' | sort -u) # the keepers list in egrep syntax: ^(key|key|…) keepers_egrep=$(echo $keepers | sed 's/^/^(/; s/$/)/; s/ /|/g;') # show all the keepers as a comment so this script's output is shell-able echo '# Keepers: ' $keepers # everyone who isn't on the keepers list is deleted deleters=$(gpg --list-keys | grep '^pub'| cut -c 13-20 | egrep -v ${keepers_egrep}) # echo the command if there are any to delete # command is interactive if [ -z $deleters ] then echo "# Nothing to delete!" else echo 'gpg --delete-keys' $deleters fi
Files:
- clean_keyring.sh (SHA-1 checksum: 8c71dabca84c33201184fe348ae35310622d2be6)
- clean_keyring.sh.txt — gpg signature.
-
Compose yourself, Raspberry Pi!
Years ago, I worked in multilingual dictionary publishing. I was on the computing team, so we had to support the entry and storage of text in many different languages. Computers could display accented and special characters, but we were stuck with 8-bit character sets. This meant that we could only have a little over 200 distinct characters display in the same font at the same time. We’d be pretty much okay doing French & English together, but French & Norwegian started to get a little trying, and Italian & Greek couldn’t really be together at all.
We were very fortunate to be using Sun workstations in the editorial office. These were quite powerful Unix machines, which means that they were a fraction of the speed and capabilities of a Raspberry Pi. Suns had one particularly neat feature:
(source: Compose key, Wikipedia.)
That little key marked “Compose” (to the right of the space bar) acted as a semi-smart typewriter backspace key: if you hit Compose, then the right key combination, an accented character or symbol would appear. Some of the straightforward compose key sequences are:
Compose + Accent First key Second key Result Example Acute ‘ e é café Grave ` a à déjà Cedilla , c ç soupçon Circumflex ^ o ô hôtel Umlaut “ u ü küche Ring o a å Håkon Slash / L Ł Łukasiewicz Tilde ~ n ñ mañana Like every (non-embedded) Linux system I’ve used, the Raspberry Pi running Raspbian can use the compose key method for entering extra characters. I’m annoyed, though, that almost every setup tutorial either says to disable it, or doesn’t explain what it’s for. Let me fix that for you …
Setup
Run raspi-config
sudo raspi-config
and go to the
configure_keyboard“4 Internationalisation Options” → “I3 Change Keyboard Layout” section. Your keyboard’s probably mostly set up the way you want it, so hit the Tab key and select <Ok> until you get to the Compose key section:Choose whatever is convenient. The combined keyboard and trackpad I use (a SolidTek KB-3910) with my Raspberry Pi has a couple of “Windows® Logo” keys, and the one on the right works for me. Keep the rest of the keyboard options the same, and exit raspi-config. After the message
Reloading keymap. This may take a short while [ ok ] Setting preliminary keymap...done.
appears, you now have a working Compose key.
Using the Compose key
raspi-config hints (‘On the text console the Compose key does not work in Unicode mode …’) that Compose might not work everywhere with every piece of software. I’ve tested it across quite a few pieces of software — both on the text console and under LXDE — and support seems to be almost universal. The only differences I can find are:
- Text Console — (a. k. a. the texty bit you see after booting) Despite raspi-config’s warning, accented alphabetical characters do seem to work (é è ñ ö ø å, etc). Most symbols, however, don’t (like ± × ÷ …). The currency symbol for your country is a special case. In Canada, I need to use Compose for € and £, but you’ve probably got a key for that.
- LXDE — (a. k. a. the mousey bit you see after typing ‘startx’) All characters and symbols I’ve tried work everywhere, in LXTerminal, Leafpad, Midori, Dillo (browser), IDLE, and FocusWriter (a very minimal word processor).
Special characters in Python’s IDLE Some Compose key sequences — Leafpad To find out which key sequences do what, the Compose key – Wikipedia page is a decent start. I prefer the slightly friendlier Ubuntu references GtkComposeTable and Compose Key, or the almost unreadable but frighteningly comprehensive UTF-8 (Unicode) compose sequence reference (which is essentially mirrored on your Raspberry Pi as the file /usr/share/X11/locale/en_US.UTF-8/Compose). Now go forth and work that Compose key like a boß.
(If you’re on a Mac and feeling a bit left out, you can do something similar with the Option key. Here’s how: Extended Keyboard Accent Codes for the Macintosh. On Windows®?
Out of luck, I’m afraidWinCompose!)