Tuesday 9 December 2014

On conspiracy theories...

The (perhaps hasty) assumption that conspiracy theory deniers are not a spook-stooge becomes evidence in favour of such theories.

Un-initiated, and without conscious inducement they defend such organisations as may exist.

By induction this may apply to various degrees at various levels, each person doing what they think is right and natural, a little self serving here and there - but selected because their resultant actions are convenient.

If you want a deed doing, find someone who wants to do the deed and let them do what they want. No direct commuication or coercion required. Their visible well meaning is all the better a disguise.

The strength of any conspiracy theory is it's veracity which trumps all so-called weaknesses.

Veracity is naturally hard to measure, particularly against a weakness of the defensibility of a theory when mistaken for a weakness of the theory.

A weakness of the theory would relate to difficulty for the parties of the theory to act according to the theory.

A weakness of the defensibility of the theory would be an implausibility of the theory which depends largely on the experiences of the listener and less on the theory itself.

What works wins. Does there have to be a grand design, or will natural selection work? or is that the grand design? I note that some players win many games of chess despite the implausibility of long term prediction of the opponents moves.

Let the hungriest power mongers fight it out, and nudge to authority those who can be led by their desires. And then lead them. That's the world we live in, and it has typically been so.

I happen to believe that the one with the most power is good, known as God, who does not enforce but rather invites, who can deliver the captives of the mighty and the prey of the terrible. This does not absolve me of responsibility but rather realises it.

And this is why I like Christmas. The birth of the one who was not deceived, who followed the will of the Father and provides the means to escape for all who will.

Hows that for a Christmas sermon? I can't apologise - for the ideas are inseparable; we can't save ourselves.

I think that a typical defence against truth is to find a reason not to listen. We cannot bear the horror of the world we live in, and pretend it is just about starving orphans in war torn droughts, attacks on the liberty of good manners and lazy rich people who've taken all the money.

Wednesday 3 December 2014

Don't be illl (sic)

The danger of lapsing into sickness.

We think one small affliction will do us no harm, and maybe even some good - but then we find it becomes habit forming and we can hardly manage to get well again.

Consider the virtue of procrastination. Why get sick today if you can be sick tomorrow - or even next week!

Even better, make it a new years resolution and put it off for years. If you can procrastinate sickness, then maybe try to put off that final exit from life!

You know it makes sense!

Friday 26 September 2014

shell-shocked: Updaing bash on Linux Mint Olivia

shell-shocked: Updaing bash on Linux Mint Olivia

I've go some old laptops running Linux Mint, Olivia release, based on Ubuntu Raring Ringtail which is not a long term support, and so no ready fix is available.

The bug is shown with this test
rm -f echo ; env X='() { (a)=>\' bash -c "echo date"; cat echo
bash: X: line 1: syntax error near unexpected token `='
bash: X: line 1: `'
bash: error importing function definition for `X'
Fri Sep 26 09:37:44 BST 2014
which wrongly creates a file called echo holding the output of the date command.

Here is what is required to fix the bash shell-shocked bug.

1. Update the no-longer supported repositories to the new location:

(You should already have done this).

You first need to make sure you have src-deb repositories enabled:
cd /etc/apt/sources.list.d/ 
test -r official-source-repositories.list ||
cp official-package-repositories.list official-source-repositories.list &&
sed -i -e 's/raring/trusty/g;s/^deb /^deb-src/' official-source-repositories.list
And then update the server to old-releases:
sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' official-package-repositories.list
apt-get update

2. Install all updates for your system anyway

apt-get update
apt-get upgrade

3. Build bash from the trusty sources

apt-get build-essential bash
apt-get -b source bash

4. Install bash

dpkg -i bash*deb

5. Test the fix

# rm -f echo ; env X='() { (a)=>\' bash -c "echo date"; cat echo
bash: X: line 1: syntax error near unexpected token `='
bash: X: line 1: `'
bash: error importing function definition for `X'
cat: echo: No such file or directory

Monday 1 September 2014

Corollary to Hanlons Razor

Hanlon's razor is an eponymous adage that allows the elimination of unlikely explanations for a phenomenon. It reads:
Never attribute to malice that which is adequately explained by stupidity.

The corollary is: The malicious will hire stupid fools to do their bidding.

Which then leads to: The first rule of choosing a a good stooge is to find one who for reasons of his own already wanted to do whatever it is you were to ask.

And therefore: Watch out for those who appoint stupid fools without a sound justification

More obfuscated C

Who can work out what this is for:

//* */ 1

and in what language(s) would it be useful?

Tuesday 26 August 2014

Obfuscated C

sizeof a++ does not modify a

Unless of course sizeof has been #define'd.

And don't forget that there is a difference between:
#define sizeof ...
#define sizeof(x) ...

Oh, the possibilities...

Google TV & Movies DRM on Mint/Ubuntu

Google Play Movies & TV works best under Chrome on Linux, but unless HTML5 is working for you, Flash is needed for playback and DRM Flash playback requires the long since deprecated HAL.

Fortunately an updated HAL is maintained for this purposes. The hal ppa is at:

Most of these details are thanks to Justin Watt at askubuntu.com/questions/166760/how-do-i-play-movies-on-google-play who says:

sudo add-apt-repository ppa:mjblenner/ppa-ha
sudo apt-get update 
sudo apt-get install hal
cd ~/.adobe/Flash_Player
rm -rf NativeCache AssetCache APSPrivateData2

I wonder

I wonder

I wonder where I'm going
andI wonder where I've gone,

I wonder what I'm doing here
andwhen I'm moving on

I wonder when I'm going
asI think on where I've been

I wonder what I'm going for

whatever can it mean:

This coming and this going

from there and place to place

whatever do I do it for;

I know it's not a race

I wonder what I'm doing

what I'm here for anyhow

And does it really matter

If I don't do it now?

I know it has a reason

but what that is I don't know

I've tried to find out all my life

I have to find out so —

I'll remember where I'm going
andI'll know just where I've been

I'll know quite what I'm going for
andremember what I've seen

 (c) 1991 Sam Liddicott
I found this a bit sickly at the time and my view hasn't changed much in the last 23 years. verse 2 and 3 were scribbled through but I've included them here.

Inspired by mission transfers; and the first couple of minutes of this video:

The next wonder poem

The next wonder poem

Sometimes I'll wonder
&sometimes I'll won't,
&sometimes I'll wonder
why sometimes I don't

And when I sometimes wonder
Why I'm sometimes won't
I'm sometimesing wonder
how I still am.
nothing at all.

(c) 199x - 2014 Sam Liddicott

Poem: On wondering too much

On wondering too much


I also wonder

I wonder why I wonder,
What I do it for, and how,
I wonder as I wonder why I'm wondering right now

And as I wonder wonder wonder wondering today
I wonder if I should have really
stayed in bed today

(C) 1992 - 2014 Sam Liddicott

Friday 18 July 2014

Windows can have UTC hardware clock

Thanks to reddit's Sceptically for this:

There's a registry setting you can use in windows to make it work with UTC on the hardware clock.


I don't know why they don't press that for you before it leaves the factory...


Friday 30 May 2014

MessageFormat {0} for bash

Here is an sample string formatter written in bash, that works along the lines of the java string format class, see http://docs.oracle.com/javase/7/docs/api/java/text/MessageFormat.html.

#! /bin/bash
# Sam Liddicott sam@liddicott.com
# e.g. formatecho "Hello {1}, date of {0} is {0,datetime}, using '{0,datetime}'\n" 1401444493 "$USER"

cutstr() {
  printf -v "$1" "%s" "${4%%$3*}"
  printf -v "$2" "%s" "${4#"${!1}"}"

formatstr() {
  local target="$1"
  local format="$1"

  local result
  local start
  local arg
  local func

  # slice up to ' or { and process
  while test -n "$format"
  do cutstr start format "['{]" "$format"
     case "$format" in
          {*) cutstr start format "}" "$format"
              cutstr arg start , "${start:1}"
              arg=$(( arg + 1 ))
              if test "${start:0:1}" = ","
              then result="$result"$(${start:1} "${!arg}")
              else result="$result${!arg}"
        "'"*) format="${format:1}"
              cutstr start format "'" "$format"
              # empty string means ' but bash 4.2 errors stop me defaulting 
              # to ' or $'\x29' so I copy the ' from format

  printf -v "$target" "$result"

formatecho() {
  local _message
  formatstr _message "$@"
  printf "%s" "$_message"

datetime() {
  date -d @"$@"

formatecho "$@"

Wednesday 7 May 2014

Passive Aggression

This essay so far only covers passive-aggressive as a defence against the narcissistic psychopath, and not as a method of attack used by the narcissistic psychopath, or as a substitute means of communication.

Arguably, this is not true passive aggression but rather a refusal to engage. For a fuller look at passive aggression, see http://www.theguardian.com/science/brain-flapping/2015/feb/19/ok-dont-read-this-article-about-passive-aggressive-behaviour-honestly-its-fine
Passive Aggression
Passive-aggressive: Term for practitioners of non-violent inaction, employed by those who have not yet discovered the futility of ridicule against the practice.
Much so-called passive aggression is not so much aggression, as dis-interest.
The accusation of passive aggressive is the last attempt of the psychopath to manipulate and dominate those who have made the ultimate withdrawal from a hostile environment, by refusing to participate.
It's older equivalent from the age of physical violence, which may still be familiar to some, is: "Come back and fight me you snivelling little coward!" or as it was understood by the hearer: “Come back so that I can beat you into submission!”
Those whose eloquence or tired persistence have crumbled before the illogical, unreasonable and unremitting demands of the exploitative bully have concluded that the only way to win is not to play the game; that validation from the psychopath is unsatisfying, that the promise of validation is unbelievable, that while yielding may defer immediate pain into future pain, playing the game only promises pain.
And what's wrong with passive-aggression, if we can call it that? How about calling it non-violent inaction? Does one really prefer passionate aggression, or violence? And does one leave place for those who don’t?


The accusation of passive-aggressive is an attempt to blame failure to engage, or to kindle even the smallest spark of trust, on the one whose engagement is to be exploited.
Having spent every cent of political capital, the passive-aggressive-accuser will attempt to bully-up some more, revealing themselves as a psychopathic snake-head demanding the privilege to present, ad-infinitum, scenario after scenario until they can find one that will cause the other to willingly do their bidding.

Preferred Environment

Those who prefer passionate aggression may thrive in an environment of passionate aggression. It may be that they think that they are the most aggressive and persistent and that they can dominate that environment and “do things right” (because, “Hey! If I was wrong, I would have changed my mind”)
Likewise one might expect that those in favour of actual aggression also suppose themselves to be among the biggest and the strongest.
One might suppose that PA accusers are attempting to perpetuate an environment in which (actual violence being outlawed) they can win by force of personality, while simultaneously preventing their victims from carving out a sanctuary of their own.

What does the passive-aggressive see?

The passive-aggressive’s behaviour silently says: “Why should I be interested in your little scheme? I’m not a resource to be exploited to your ends!”, but has somehow found it no longer worthwhile to say this out loud. It is not worthwhile to provide the psychopath with feedback how to constructing a more effective message/weapon.
The passive-aggressive sees no union, no meeting of the minds, except perhaps superficially.
The psychopath will offer scenarios that ostensibly are desirable to both parties based on the superficial union, but the passive aggressive is aware of an additional cost that is too expensive to explain.

How to deal with a passive aggressive

Take some actual real unselfish interest in the welfare and independence of the passive aggressive.
If you find that this doesn’t work then it wasn’t really unselfish, just more latent psychopathy.
Clue: it’s not supposed to work, what were you actually trying to do? Try granting the other person a little self-sovereignty.

Not passive, just hidden?

It isn’t all non-violent inaction though. Here are some classic petty revenges.

The revenge must be perfectly balanced, the punishment must fit the crime.

So is passive-aggressive nature or strategy? How are latent psychopathic in all of us manifest when we are not in a position to get caught by those who matter?

Sunday 20 April 2014

MAKEDEV and double virtualization

MAKEDEV can run in a couple of seconds - even on a virtual machine.

But if your virtual machine is hosting a qemu guest, then in that guest a fork/exec can take 0.2 of a second, and MAKEDEV generic-i386 can take a couple of hours. (This is because the kqemu kernel module is not available, http://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/qemu-running-on-ubuntu-vmware-guest-cannot-find-dev-kvm-936253/).

The first hacky-hack to cut down on the number of fork/exec is to stop calling sed quite so often, cue this patch (requires MAKEDEV to run under bash).

--- /sbin/MAKEDEV 2009-07-30 08:39:09.000000000 -0700
+++ /MAKEDEV 2014-02-21 06:31:43.000000000 -0800
@@ -1,4 +1,4 @@
-#! /bin/sh -
+#! /bin/bash -
 # $Id$
@@ -116,7 +116,9 @@
 devicename () { # translate device names to something safe
  # A-Z is not full alphabet in all locales (e.g. in et_EE)
- echo "$*" | LC_ALL=C sed -e 's/[^A-Za-z0-9_]/_/g' 
+ #echo "$*" | LC_ALL=C sed -e 's/[^A-Za-z0-9_]/_/g' 
+ echo "${*//[^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]/_}"
 makedev () { # usage: makedev name [bcu] major minor owner group mode
@@ -231,12 +233,14 @@
  exec 3<$procfs/devices
  while read major device extra <&3
-  device=`echo $device | sed 's#/.*##'`
+  #device=`echo $device | sed 's#/.*##'`
+  device="${device%%/*}"
   case "$major" in
-    safedevname=`devicename $device`
+    safedevname="${device//[^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234566
     eval "major_$safedevname=$major"
     devices="$devices $device"
@@ -247,7 +251,8 @@
 Major () {
- devname=`devicename $1`
+ devname="${1//[^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234566
  if [ "$opt_d" ]
   echo -1 # don't care
@@ -2149,7 +2154,8 @@
    exec 3<$procfs/devices
    while read major device extra <&3
-    device=`echo $device | sed 's#/.*##'`
+    # device=`echo $device | sed 's#/.*##'`
+    device="${device%%/*}"
     case "$major" in

The next hack is to stop the 5 or 6 fork/exec when MAKEDEV deletes a device node, creates a (temporary device node), chmods it, chowns it, and renames it.

How do we do that? We run MAKEDEV -n so that it does none of these and then feed the output to a perl script which will do them.

Sadly perl has no native mknod call and there are no libraries in this environment, and so I use perl's blessed syscall function with a hard-wired syscall 133 for mknod (as it is, on my kernel):

time /MAKEDEV -n generic-i386 | perl -ne '
($c, $f, $node, $major, $minor, $own, $perm) = split; 
if ($node eq "->") { 
  symlink($major, $f) || die "sym: $!";
} else {
  # system("mknod",$f,$node,$major,$minor) && die "mknod($f,$node,$major,$minor): $? $!"; 
  # chmod(oct($perm), $f) || die "chmod: $!"; 
  $n=0010000 if ($node eq "f");
  $n=0020000 if ($node eq "c");
  $n=0060000 if ($node eq "b");
  $n=0140000 if ($node eq "s");
  if (syscall(133, $f, oct($perm) | $n, (($minor & 0xff) | (($major & 0xfff) << 8)
          | (( ($minor & ~0xff)) << 12)
          | (( ($major & ~0xfff)) << 32))) == -1) { die "syscall: $!"; }
  chown($user,$group,$f) || die "chown: $own $!"; 

Leaving in the system("mknod,...) took around 24 minutes, but moving straight to syscall(mknod,...) takes1 minute 8 seconds.

I did toy with having bash use printf or something to pack a binary tar archive (or even getting perl to pack a tar archive) to pipe to tar -x, but... this will have to do for now.

I suspect this depends on a bug in MAKEDEV which seems to still create sub-directories needed even in -n mode.

It would have been better to pipe the output to a c program which would parse it, I will do that, another day...

Wednesday 19 March 2014

NFS/LDAP only at home

NOTE: This doesn't work reliable for only some users. It seems like nsswitch.conf needs faking earlier than that. A better answer might be to iptables-rst the ldap requests or something so that ldap fails quickly.

I have this pre-init script in /etc/init/autofs.conf

start on runlevel [2345] and net-device-up IFACE=wlan0
pre-start script
    modprobe -q autofs4 || true
    if iwconfig | grep 00:18:84:26:7E:1B 
    then sed -e 's/ #ldap/ ldap/' /etc/nsswitch.conf > /var/tmp/nsswitch.conf && mount /var/tmp/nsswitch.conf /etc/nsswitch.conf -o bind
    else ! true
end script

and these lines in my /etc/nsswitch.conf

passwd:         compat #ldap
group:          compat #ldap
shadow:         compat #ldap

When I'm on my home wireless network (detected by the access-point mac address, autofs will run to mount home directories, and ldap will be enabled and used to validate user accounts.

Otherwise it is a standalone laptop and will revert to built in accounts and home directories.

Tuesday 25 February 2014

A Christmastime Computer Ghost Story, or, a loop in time

The poor coder was running out of time for his deadline, and right before the Christmas holidays

The new system was not working. PAM had been updated to a newer version which choked on the old style pam.d files which used the old @ style include directives.

This meant that CRON was failing with permission denied because it's config file could not be processed.

Examination of the source version control system showed that old versions of the system used the same new version of pam and yet did not have that problem at all.

The pam.d config files were not supplied as part of the pam source, and so had come from somewhere else - and came from the base file system on which the system was based.

An older version of the system was fired up, and sure enough, it had a different set of pam.d files to cope with the newer pam release that was also in use on the older system.

It seemed simpler to just transfer the pam.d files from the old system to the new system - and indeed that fixed the problem.

These were then added as a fixup to the pam project, so that the new pam.d files would be installed whenever the new pam project was used. Otherwise, the original files would still be used.

The build system was tested and it did indeed deposit the new pam.d files in the correct place.

A new build was fired up and just before delivery for QA was found to fail in exactly the same way as before.

Things get spooky...

Analysis showed that the old pam files were installed after all; and this was because the old pam files had been packed in the install image, and this was because the fixup to the pam project contained the old pam files.


Didn't the coder fix that to have new pam files the day before? Version control showed that he did, but version control showed that the fixup archive contained the old files, known not to work; and only those files were committed.

The previous system was fired up again, and to his surprise it was using the old pam files too and yet was NOT failing - because it was using the old pam libraries, and not the new pam libraries!

The command history showed that it's pam files had been packaged up using tar ... | base64, for cut-n-paste from window to window, so there was sadly not left behind any temporary files of evidence of what was actually packaged. But it was clearly the machine from which the files were taken.

The new system on which the replacement pam files had been tested had been re-installed to test the new build, and so it had the newly installed old broken pam files and not the new ones that had been proved to work.

There had been a fix and it had worked but all that was left was the same old pam.d files that did not work. And nowhere to get a fix from.

The coder then remembered that the previous installation is always preserved on a backup partition, and so quickly mounted this on the new system and found the new, different, pam.d files - which worked.

The coder packaged these up to a fixup to the pam project, just like 2 days before.

And kept a back up just to be sure.

The coder was glad to have his fix in time for the deadline, and have his Christmas holidays, but if the newer fixed files had not come from the working older system (which did not use new pam after all), where had they come from... and where did they go to... But he did not let these questions prevent him from starting a new build for QA, and going off to enjoy his long anticipated holidays.

Monday 27 January 2014

A Plea for Social Equality

True democratic wealth is time: everybody has 24 hours of it a day.

The significant social inequality of the day is that some peoples time is not exchangeable for much value, while other peoples time is very much in demand and exchangeable at a high rate.

I simplify somewhat, for a person can sometimes exert control over their exchange rate by means of how much effort they put in; but even at maximum effort there is still a large disparity between the exchangeable values of the time of different people, or in different locations.

In the corrupt imperial west there is a notion that 8 hours of effort per day should be exchangeable for necessities of life (and some discretionary comforts) but the opportunity to make this exchange is not granted equally to all people (and nor is the standard of life).

In the name of social conscience and humanity, this inequality is often reasonably addressed by moving a surfeit of value from those who found favourable exchange, to those who who found a poor rate of exchange.

Yet paradoxically, the extreme inequality of those who found no exchange is addressed by an attempt to provide the value of life necessities with no exchange required.

This does not introduce equality but instead introduces further inequality for in transferring the surfeit of value to those who find no exchange, it leaves them with a surfeit of time. It reduces them to the status of beggar and provides no way to contribute.

It would be more equitable to provide opportunity of exchange to those who found no exchange, making all equal contributors to society from the universal and collective wealth of time, and condemning none to the status of beggar.

TLDR: Or in other words, why in the UK when taxes are going up, and public works are going down, why, are we paying people to do nothing?

It is no socialist triumph to lose the working class and gain another idle class (however unwilling).

Let the time of each be valued equally - sufficient for life, and let all contribute.

And here's hoping for a shorter working day for all, enough time for dancing and singing.