As a gift for a niece, I have developed this worksheet which should make it a bit more fun to learn the very basics of Binary.
binary leaf 1, page 2
I’m starting a new repository on GitHub which will be an svg based set of scientific icons.
This is just the start of making some free to use (CC-BY-SA 4.0), science based icons that will be compiled into a web font (ttf, oeff, svg etc) and provide a css file to easy drop in placement into many websites in the science fields.
A lot of the icons are meant as inaccurate depictions. The goal is to convey the general idea behind the button or status without having to have every proton in the right place.
If you’d like to help, there are instructions on the github page for contributions.
I got tired of Evolution email client giving me those horrid error messages when ever I try to email someone who’s key isn’t in my current list of keys.
The design of this is appallingly bad. It discourages the use of GPG rather than encouraging the importing of keys and it makes no mention of helping you acquire keys if possible. It also allows for no additional or optional footer to explain to the recipient that their message couldn’t be encrypted because they don’t use GPG.
While I couldn’t do much about the later, without hacking on the evolution codebase directly. I did do a bit of hacking on the former with a gpg middlware. Yes, when I say hack, I mean HACK. A dangerous and potentially devastating way of wrapping the gpg binary with my own python script that could intercept the evolution call and do work to search, display and add keys to encourage the use of encryption overall.
The design was simple. When we are asked to encrypt for a person who we don’t have the keys for, we do a search. The results are shown in a GUI to the user and they can select a key to use. This then is added to the key ring and used to encrypt the email.
This setup allows for experimentation with user prompting and workflow. It’s not something I would recommend be installed on user’s computers. But for designers and developers, this sort of match-stick making is a valuable platform to build, try, test and rebuild quickly.
I use zenity for the user interface. This is a Gtk command line tool that lets you launch a window from the command line and the interface is good enough to support photos in lists and returning which item was selected. Very cool.
Bellow you will find the script I created for this hack, this is saved to /usr/bin/gpg and gpg is moved to gpg.orig:
#!/usr/bin/python # # Wrap the gpg command to provide evolution with a bit of extra functionality # This is certainly a hack and you should feel very bad about using it. # # Public Domain, Authored by Martin Owens
2016 # import os import sys import atexit from collections import defaultdict from subprocess import Popen, PIPE, call from tempfile import mkdtemp, mktemp from datetime import date from shutil import rmtree to_date = lambda d: date(*[int(p) for p in d.split('-')]) class GPG(object): keyserver = 'hkp://pgp.mit.edu' remote_commands = ['--search-keys', '--recv-keys'] def __init__(self, cmd='/usr/bin/gpg', local=False): self.command = cmd self.photos =  self.local = local self.homedir = mkdtemp() if local else None atexit.register(self.at_exit) def at_exit(self): """Remove any temporary files and cleanup""" # Clean up any used local home directory (only if it's local) if self.local and self.homedir and os.path.isdir(self.homedir): rmtree(self.homedir) # Clean up any downloaded photo-ids for photo in self.photos: if os.path.isfile(photo): os.unlink(photo) try: os.rmdir(os.path.dirname(photo)) except OSError: pass def __call__(self, *args): """Call gpg command for result""" # Add key server if required if any([cmd in args for cmd in self.remote_commands]): args = ('--keyserver', self.keyserver) + args if self.homedir: args = ('--homedir', self.homedir) + args command = Popen([self.command, '--batch'] + list(args), stdout=PIPE) (out, err) = command.communicate() self.status = command.returncode return out def list_keys(self, *keys, **options): """Returns a list of keys (with photos if needed)""" with_photos = options.get('photos', False) args = () if with_photos: args += ('--list-options', 'show-photos', '--photo-viewer', 'echo PHOTO:%I') out = self(*(args + ('--list-keys',) + keys)) # Processing the output with this parser units =  current = defaultdict(list) for line in out.split('\n'): if not line.strip(): # We should always output entries if they have a uid and key if current and 'uid' in current and 'key' in current: # But ignore revoked keys if revoked option is True if not (current.get('revoked', False) and options.get('revoked', False)): units.append(dict(current)) current = defaultdict(list) elif line.startswith('PHOTO:'): current['photo'] = line.split(':', 1)[-1] self.photos.append(current['photo']) elif ' of size ' in line: continue elif ' ' in line: (kind, line) = line.split(' ', 1) if kind == 'pub': current['expires'] = False current['revoked'] = False if '[' in line: (line, mod) = line.strip().split('[', 1) (mod, _) = mod.split(']', 1) if ': ' in mod: (mod, edited) = mod.split(': ', 1) current[mod] = to_date(edited) (key, created) = line.split(' ', 1) current['created'] = to_date(created) (current['bits'], current['key']) = key.split('/', 1) elif kind in ('uid', 'sub'): current[kind].append(line.strip()) else: current[kind] = line.strip() return units @property def default_photo(self): if not hasattr(self, '_photo'): self._photo = mktemp('.svg') with open(self._photo, 'w') as fhl: fhl.write("""""") self.photos.append(self._photo) return self._photo def recieve_keys(self, *keys, **options): """Present the opotunity to add the key to the user: Returns - True if the key was already or is now imported. - False if keys were available but the user canceled. - None if no keys were found within the search. """ keys = self.search_keys(*keys) if not keys: return None # User doesn't have GPG # Always use a temporary gpg home to review keys gpg = GPG(cmd=self.command, local=True) if not self.local else self # B. Import each of the keys gpg('--recv-keys', *zip(*keys)) # C. List keys (with photo options) choices =  for key in gpg.list_keys(photos=True): choices.append(key.get('photo', self.default_photo)) choices.append('\n'.join(key['uid'])) choices.append(key['key']) choices.append(str(key['expires'])) if len(choices) / 4 == 1: title = "Can I use this GPG key to encrypt for this user?" else: title = "Please select the GPG key to use for encryption" # Show using gtk zenity (easier than gtk3 directly) p = Popen(['zenity', '--width', '900', '--height', '700', '--title', title, '--list', '--imagelist', '--print-column', '3', '--column', 'Photo ID', '--column', 'ID', '--column', 'Key', '--column', 'Expires', ] + choices, stdout=PIPE, stderr=PIPE) # Returncode is generated after communicate! key = p.communicate().strip() # Select the default first key if one choice. # (person pressed ok without looking) if not key and len(choices) == 4: key = choices if p.returncode != 0: # Cancel was pressed return False # E. Import the selected key self('--recv-keys', key) return self.status == 0 def is_key_available(self, search): """Return False if the email is not found in the local key list""" self('--list-keys', search) if self.status == 2: # Keys not found return False # We return true, even if gpg returned some other kind of error # Because this prevents us running more commands to a broken gpg return True def search_keys(self, *keys): """Returns a list of (key_id, info) tuples from a search""" out = self('--search-keys', *keys) found =  prev =  for line in out.split("\n"): if line.startswith('gpg:'): continue if 'created:' in line: key_id = line.split('key ')[-1].split(',') if '(revoked)' not in line: found.append((key_id, prev)) prev =  else: prev.append(line) return found if __name__ == '__main__': cmd = sys.argv + '.orig' if not os.path.isfile(cmd): sys.stderr.write("Can't find pass-through command '%s'\n" % args) sys.exit(-13) args = [cmd] + sys.argv[1:] # Check to see if call is from an application if 'GIO_LAUNCHED_DESKTOP_FILE' in os.environ: # We use our moved gpg command file gpg = GPG(cmd=cmd) # Check if we've got a missing key during an encryption, we get the # very next argument after a -r or -R argument (which should be # the email address) for recipient in [args[i+1] for (i, v) in enumerate(args) if v in ('-r', '-R')]: # Only check email addresses if '@' in recipient: if not gpg.is_key_available(recipient): if gpg.recieve_keys(recipient) is None: pass # We can add a footer to the message here explaining GPG # We can't do this, evolution will wrap it all up in a # message structure. #msg = sys.stdin.read() #if msg: # msg += GPG_TRIED_FOOTER #sys.stdout.write(msg) #sys.exit(0) # We call and do not PIPE anything (pass-through) try: sys.exit(call(args)) except KeyboardInterrupt: sys.exit(-14)
This last two weeks I’ve been wearing a safety pin. It’s a small symbol of my personal commitment to support and interfere with public displays of hatred and intolerance.
In the last week there’s been backlash. Some calling it white guilt, others calling it a twitter action and many being critical of the sincerity of people who want to show that they will do something.
The first criticism that this symbol is a matter of white guilt is completely daft. Firstly because it’s a symbol I’ve seen non-white people wearing and also because I’m not guilty that I’ve had privilege thrust at me, I’m angry about it. I know what it’s like to be on the opposite end of that particular stick and moving between my home town in the English north to the USA has turned the way people see me around. From being an uneducated criminal class waste of space to being a quaint English, articulate, sensible Beatles accented gentleman in the space of a six hour flight.
If anything, I would stand up for the working class of any colour or creed. It’s a built in part of me and it will probably get me into trouble. There might be people out there who will wear it as fashion, or guilt, but I see no value in doubting the sincerity of people. And that’s realyl what the backlash is, a disrespectful doubt that the motives or the carry through will not live up to the symbol.
That leads me to that second point. That this is a Twitter action. That is, a re-share of an idea with no substantive action backing it up.
This is something which will remind me to do something, if that means putting myself in danger, calling the police or just comforting the victim. I have made a vow to myself to be that voice if called upon. I know I live in a liberal city where I will not be called upon often, and that habitation does make it less useful. But there is racism here, there is misogyny here. It’s always been in Boston and I’ll always disprove of it.
But now, if it manifests in public, I’ll have to do something about it.
For the past few weeks we’ve been running a contest to pick the next about screen. It’s a regular contest that we run and this one is special for me because it’s the first time we’ve managed to run the contest on inkscape.org instead of the deviantArt page. Because of this, we’ve had really good response this time around and the voting process is now ongoing:
The other good news is that the Free Software Conservancy has set up a spreadshirts account for inkscape, so the plan is to try and produce some physical goods. At first we’ll just inkscape logo items, but we’ll try and move to getting other items too. Maybe even incorporating artworks. Although that’ll bring up a good discussion we’ll have to have with the artists to make sure they’re happy with the idea, even if they’ve licensed things under CC.
This year was the focal of manure. We have no idea what the future will hold, but the probability for happiness and a quiet life is diminished.
Good luck everyone.
I’ve been doing a bit of art for a local band, The Army of Broken Toys. This is a card of one of the members who was pregnant on stage, during their album release event.
I’ve been reading “The Dictator’s Handbook” this week, a recommendation from CGP-Grey (youtube) and a damn good one. It’s a description of how people who want power, get power and how they keep it once they have it. I won’t go into the nitty gritty, but suffice to say that it has a lot of good things to say about murdering people to get what you want.
The idea I want to explore in this blog post is using understanding, and “Life the Universe and Everything”. For those of you who have not had the pleasure of listening to The Hitchhiker’s Guide to the Galaxy; in the story we are told:
There is a theory which states that if ever anyone discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.
There is another theory mentioned, which states that this has already happened.
This is why in the story the answer to the question of Life the Universe and Everything is “42”, but that the question itself was unknown. Knowing both question and answer would cause the above self destruction/recreation and it’s imperative that the characters never find out both.
The nature of understanding in that universe is thus that it is not just non-understandable, but deliberately evasive. The rules of the game will change as soon as you know the rules of the game. Not in some god like way of keeping you in the dark deliberately, as if the universe had agency, but because somehow what you know is tied to how things work.
So how does this relate to Dictators?
Well the book is so good at explaining the mechanics of the interpersonal relationships in ruling a country or business that it may change the behaviour of people who have read the book. It may change their behaviour enough to actually make the book’s premise false. Not that it’s false when you haven’t read the book, only that it’s false when you have.
But, this make one giant Saturn sized assumption. That it is possible to change how you act in a certain circumstance given this knowledge. If it’s not changeable, then knowing it doesn’t matter and no amount of self-help or ingenious insights into the human condition will change our society. But the book’s preface is that knowing the rules that rulers rule by can help improve society, so it expects behaviour to be changeable and if is then someone somewhere will figure out how to exploit this new behaviour.
Once you have the sort of second order exploit, you get a very complicated dance between people who understand, people who do not understand and people who want to exploit either group.
Hence the mechanism described in the book will “instantly disappear and be replaced by something even more bizarre and inexplicable”. Thanks Douglas Adams.
To drive this idea a bit further. This in my mind creates two quantifiably different types of truth. That which is understandable but unchangeable is solid or foundational truth. Like Mathematics, knowing 2 + 2 = 5 and why doesn’t allow you to change it’s truthfulness. Then there is mutable truth, where knowing how and why something is true allows you to manipulate it into falsity. This is especially true in biological and social sciences where adversarial mechanisms are in constant flux.
What do you think?
A fairly complete set of graphics comparing imperial and metric units.