Feb 292020
 

I used to be able to remember all of the keyboard short-cuts I’d set up to insert ‘fun’ (or useful) Unicode characters … but my memory isn’t quite what it used to be, and I happened to catch a video that mentioned a menu to insert Unicode characters.

So I set out to create my own …

#!/bin/zsh
#
# Run a menu of Unicode characters to put into the clipboard

read -r -d '' menu << END
Þ       Thorn (Sym-t)
Þ	Capital thorn (Sym-T)
✓	Tick (Sym-y)
✔       Alternate tick (Sym-Y)
π	pi (Sym-p)
Π       PI (Sym-P)
★       Star
🖕      Finger
END

selectedchar=$(echo $menu |\
  rofi -dmenu -l 20 -fn misc-24 -p "Unicode inserter" |\
  awk '{print $1}')
if [ -z "$selectedchar" ]
then
  notify-send "Unicode Inserter" "Cancelled"
else
  printf "%s" $selectedchar | xclip -selection clipboard
  notify-send "Unicode Inserter" \
    "Character $selectedchar now in clipboard"
fi

This script :-

  1. Creates a variable with a whole pile of text inside it. The original script contains a lot longer list, but including it would be a) boring and b) give too much away. As it stands, the format of each line is pretty much anything you want as long as the first character is the Unicode character followed by whitespace.
  2. Runs rofi with the variable as input and selects the first field of the response.
  3. Guards against the empty selection (when the menu was cancelled) for neatness mostly.
  4. Prints the selected character (without a newline) into xclip so it can be pasted in. I did try using xdotool to type it directly into the active window, but this didn’t always work so well (i.e. xdotool couldn’t “type” some of the more esoteric characters).
  5. And uses notify-send to alert the dumb user (me!) that something has happened.

Lastly, to make this useful, I added an entry to my sxhkd configuration :-

super + F11
  /site/scripts/m-unicode-insert
Feb 242020
 

Every so often, I tune into a video on some form of virtualisation which perpetuates the myth that ‘virtual cores’ that you allocate to a virtual machine are equivalent to the physical cores that the host has. In other words if you create a virtual machine with two cores, that is two cores that the rest of the host cannot use.

Preposterious.

Conceptually at least, a core is a queue runner that takes a task on a queue, runs that task for a while, and then sticks that task back on the queue. Except for specialised workloads, those cores are very often (even mostly) idle.

To the host machine, tasks scheduled to run on a virtual core are just tasks to be performed waiting in the queue; ignoring practicality, there is no reason why there should not be more virtual cores in a virtual machine than there are in the host machine.

If you take a look at the configuration of my virtual Windows machine in VirtualBox :-

You see :-

  1. I’ve allocated 8 virtual cores to this machine. I rarely use this machine (although it is usually running), but it does not take much resources to run idle cores.
  2. VirtualBox arbitrarily limits the number of cores I can allocate to the virtual machine to the number of threads my processor has; it also has a warning at the number of cores my processor has but doesn’t stop me allocating virtual cores in the “red” zone.

Qemu on the other hand has no such qualms about launching a virtual machine with 64 cores – well in excess of what my physical processor has.

Of course you have to be sensible, but creating a virtual machine with 4 cores does not make four cores unavailable to your host machine. If a virtual machine is idle, it won’t be running much (no machine is ever completely idle) on your real cores.

Oct 262019
 

All those “intelligent” voice assistants – Google, Siri, Alexa, smart cars (not not “Smart cars”), etc. all have a seriously damaging misfeature. It is most evident (and indeed amusing) when you are watching a review of a smart car.

All of these voice assistants activate when they hear a particular sound pattern (a word) which is fixed. Now there are probably technical reasons why it is fixed, but that does not mean they cannot be overcome.

I don’t want to address a smart device by a name that I cannot change. I want to shout “Slave! Get me a cup of coffee”, not “Alexa! Phone Alex”. Which is of course a nice to have feature, not a bug.

But what about about attacks? Say “Okay Google, turn off all alarms” (and your victim is late to work), say “Okay Google, set an alarm for 3am” (and your victim is grumpy at work).

That ‘trigger word’ (or phrase) is in effect a password – not a very secure one, but one never-the-less.

Lastly there is what hilariously happens when you see a review of a new car with a voice assistant made by a certain car company whose name starts with “M”. Because of course a reviewer will use the “M” word whilst describing the vehicle, and the miscommunication with the assistant is a hilarious indication of how rubbish voice assistants are (they aren’t really but that’s the impression you get).

Make the trigger word/phrase adjustable, and this all goes away.

Surf In The Wind
Oct 082019
 

I was reminded of something recently when someone was using a gooey; they hadn’t made any changes, but clicked “Ok” after reviewing something. A bug in the gooey resulted in a whole bunch of DNS CNAMEs being removed.

The fault is of course with the gooey for having a silly bug, but it was also a reminder to reduce risk whenever you have root (or equivalent).

  1. The “Ok” in a gooey should be read as “Please make the changes I have asked for”; if you are not intentionally making changes, why click on it?
  2. One of the reasons I switched to zsh was that I’d heard of accidents involving wildcards, so I wanted the feature that expanded wildcards within the shell before activating the command.
  3. If you are looking at a configuration file, why are you using an editor? Use view rather than vi, and if you are in vi quit (“:q!”) rather than save and exit (“ZZ”).
  4. If you have an account with special rights , don’t browse the Internet with it. You should have two accounts – one for ordinary stuff and one used just when you need additional rights. That’s two long and strong passwords to remember; life is hard; get used to it.

But this is more than just a few tips for reducing risk; it’s about an attitude that goes beyond simply being careful and towards designing your work flow in ways that reduces risk.

Old Metal 3
Sep 282019
 

It is quite possible I have commented on this before now, but I felt like a rant and I’m too lazy to search through the old posts to see if I’ve ranting on this subject before.

Windows, Icons, Mouse Pointer … or the gooey. Icons are an integral part of the gooey experience. Or so we are led to believe.

But really aren’t they just a little bit shit?

And I should clarify, I am not talking about file icons – pictures of folders (although given the lack of physical folders these days, a bucket might be more appropriate), and pictures of the kind of contents to be expected within files. Although I’m sure there’s a rant to be had with filesystem browser icons, and I do think they can be a bit silly, this rant isn’t about those.

It’s about those silly little icons in the toolbar of an application … or similar ‘functional icons’ which when activated perform some function. All it takes to misinterpret the icons is lacking the perspective of the icon designer, and then they take on a whole new meaning.

For example, the browser I am using to write this has a bunch of icons just below a strange “V” symbol (because it’s uncool to use a sensible word-based button like “Menu”).

The next stupid icon is an arrow in a circle – obviously intended to indicate a function to rotate the web page (although it’s actually to reload the web page), the left and right arrows are obviously a way to navigate between tabs, and there’s a cloud icon; no idea on what that one does.

In ‘normal’ applications there is of course the classic floppy disk icon, which just about everyone has attacked because it is just such an obvious target. Who uses floppies these days? And how many people under the age of twenty actually know what a floppy is anyway?

And my DAP has an icon that looks like two snakes getting friendly – no idea what that is supposed to represent although I believe it has something to do with “shuffle”.

We have a perfectly adequate way to communicate; one which we spend years learning how to use. It’s called writing.

What’s wrong with writing? Well there are two problems :-

  1. There isn’t much in the way of space inside of an icon to get too wordy.
  2. Words have to be translated which can get expensive.

When you come down to it, pictorial icons are just a half-arsed solution to save money.

Tower Stonework