An introduction

This is a semi-public place to dump text too flimsy to even become a blog post. I wouldn't recommend reading it unless you have a lot of time to waste. You'd be better off at my livejournal. I also have another blog, and write most of the French journal summaries at the Eurozine Review.

Why do I clutter up the internet with this stuff at all? Mainly because I'm trying to get into the habit of displaying as much as possible of what I'm doing in public. Also, Blogger is a decent interface for a notebook

Thursday, May 19, 2011

stdout.be argues that shortage of metadata is specifically an internet problem:

It’s kind of humbling to see that even a quarter of a century ago, news formatted in International Press Telecommunications Council standards like IPTC 7901 , NITF or NewsML had more metadata associated with it than a lot of websites of today.

The “big blob of text” phenomenon we’re stuck with now wasn’t caused by newspapers sticking to their old, wary ways, but by the transition to a new medium, the internet.


via the mojo list

Tuesday, May 17, 2011

I've seen things you people wouldn't believe

There's a quote from Blade Runner which has long irritated me. It's sampled in some Juno Reactor track, and so slides into my subconsciousness every time I try to zone in/out with the trance:

I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion. I watched C-beams glitter in the darkness at Tannhäuser Gate.


Out of context, it just seems so petty. You're describing the wonder and immensity of the universe, I thought, and this is the best you've got? All the cosmos can offer you is the pretty pictures? It's the equivalent of dropping acid, then just admiring the hallucinations as pieces of theatre.

I was planning a blogpost to that effect.

Then I looked up the video, and suddenly I'm a convert:


I probably shouldn't try to put the effect of the clip into words. Suffice it to say, all is forgiven. This isn't somebody bragging, it's the hopeless attempt to telegraph into dying breath the most intense moments of a 'lifetime'. The machine will not communicate -- it can't, any more than a human can verbalise hir innermost thoughts. But there's glory in the attempt.

Removing whitespace with sed

Use sed to remove leading whitespace:

sed 's/^[ \t]*//'


The particular reason I want to do this is to turn my todo-list (a tree of tasks, marked off by when i completed them), into a sorted record of what I've done on a particular day. In other words, I want to go from this:


Code
Thule
OED javascript
other tasks
2011-04-17 16:57:33 Sort out markdown for vim 45m
blah
Thing I haven't done


To this:

2011-04-17 15:58:32 update blog with more cmds 3m
2011-04-17 15:58:59 modify timestamp to include date 20m [,,T,,D wil do for now]
2011-04-17 16:57:33 Sort out markdown for vim 45m
2011-04-17 17:39:04 [email to ejc about resources for journalists


Which can be done by removing whitespace, limiting to lines containing dates, and sorting


$ cat todo/todo.otl| sed 's/^[\t ]*//' | grep 2011 | sort

Monday, May 16, 2011

mode function in python

Oddly, there seems to be no mode function in the python standard library. It feels like something that should have an optimized C version squirreled away somewhere. 'Mode' is too ambiguous to be easily searchable, alas. Anyway, here's a version that should be reasonably fast


from collections import defaultdict
def mode(iterable):
counts = defaultdict(int)
for item in iterable:
counts[item] += 1
return max(counts, key = counts.get)


Should be reasonably fast (for pure-python), though could eat up a lot of memory on an iterable contaning large items.

back to the future with ellis

Warren Ellis is on an urbanism/retrofuturism jag:
the real world was always moving faster than science fiction: it’s just that back then the real future was broadcasting at 4.20 in the bloody morning and no-one was around to see it.

[more]

Saturday, May 14, 2011

Firefox switch to tab

FF4 has a feature by which, when you try to open a second copy of a page, will flip to the existing tab rather than re-opening it.

This drives me crazy.

I usually have several dozen tabs open, across multiple screens, some not visible. When I re-open a tab I want it to appear right in front of me. Not (as happens now) to be brought to the front of a window I can't even see.

this blogpost offers some solutions, most of which don't seem to work.

What does seem to work is adding some junk to the end of the url. A hash should do it, or in extreme cases a hash followed by some random characters.

Friday, May 13, 2011

More B&T

More B&T:

BRIC - MIST - MAYHEM: "the creation of random geopolitical blocs is kind of fun. I mean, if you group Mexico with Afghanistan, Yemen, Haiti, Egypt and Moldova then you have MAYHEM; as indeed you do."

Libyan nukes:

Actually, come to think about it there seemed to be a fair amount of ritual involved in Libya giving up its nuke programme.

Step one: Libya buys a bunch of stuff from the Khan network

Step two: Libya hands it over and renounces its programme

Stepo three: Welcome to the international community! Here's a guy we jugged earlier.

I always wondered if step one was taken in anticipation of taking step two.


On Torygeddon

it's important not to get paranoid about this. Just because the management of the economy resembles something from a political science textbook about the period of destabilisation engineered to lay the groundwork for a coup doesn't mean that it's actually happening that way.


On Tunisia: "It obviously wasn’t a twitter revolution, or a wikileaks one for that matter. It was a "man burning himself alive in despair" revolution. The only thing digital about it was when he flicked his bic"

Empire numerology: "So, Britain as superpower, 1759-1945. US as superpower, 1919-2008. USSR as superpower, 1945-1989. Clearly there's a pattern here; each new power lasts approximately half the length of its predecessor. ..Unfortunately, this only gives the Chinese from 2008-2033 or thereabouts. Which sounds about right for a really serious demographic/elite incompetence crisis. India and Brazil only get 12 or 6 years, and at some point in the 2050s the world order starts to move like a singulatarian's fantasy"

Tuesday, May 10, 2011

Quickly creating a shell script

Suppose you want to create and run a short script. It's often faster not to bother opening up a text editor. Instead, use shell history to write a file, then chmod and execute it:


$ cat > /tmp/me.py
#!/usr/bin/env python
print('hello world')
$ chmod a+x !$
chmod a+x /tmp/me.py
$ !$
/tmp/me.py
hello world
$

Sunday, May 8, 2011

Qatar arms to Libya

The New York Times reports that:
for the first time, Qatar put the question of supplying arms to the rebels on the table, but no agreement was reached.


Well, not really for the first time. Qatar has been pushing for arms shipments to the rebels for a long time:
"If they will ask for weapons, we're going to provide them," the amir, who is on a visit to the United States, told CNN in an interview. [xinhua, 15 April]


And the New York Times itself has reported on the rebels receiving foreign weapons, and speculated that Qatar is one source of them.

Saturday, May 7, 2011

Kenneth Rexroth

Bruce Sterling, Kenneth Rexroth. Rexroth was columnist in the San Francisco Examiner, through the 1960s. Elegant, thoughtful, panoramic. While I don't quite share Sterling's enthusiasm ("there are no blogs this good"), there's good stuff here:
Looking back, it seems now that most of our crises have been crises of talk. We have been able to take it out by abusing each other. That is just dandy. Nobody pushed those banks of buttons over the U-2. The Chinese have not invaded Laos or Taiwan. The Marines have not landed in Cuba. The Congolese seem to be tiring. The UN proved able to cope with Khrushchev.

Who knows? We may talk ourselves out of the woods yet.

Friday, May 6, 2011

vim: firefox-like tab controls

I approve of this tip to make tab navigation in vim the same as with firefox. Life is too short to memorize multiple sets of commands.

:nmap :tabprevious
:nmap :tabnext
:map :tabprevious
:map :tabnext
:imap :tabpreviousi
:imap :tabnexti
:nmap :tabnew
:imap :tabnew

following irc with inotail

Being always in a several irc channels, it's helpful to have an overview of what's going on without tabbing through a dozen windows. Fortunately I can follow the logs using inotail:


$ find /home/dan/.purple/logs/ -name "`date +%F`*" | xargs inotail -fv


This would also work with tail -- the only problem is that _tail_ with so many files would put some strain on the filesystem.

Getting server messages via irc

irccat is a bot designed to facilitate sending server messages to an irc channel


The irccat bot joins all your channels, and waits for messages on a specified ip:port on your internal network. Anything you send to that port will be sent to IRC by the bot. IRCCat - as in, cat to IRC.

Using netcat, you can easily send events to irc from shell scripts:

echo "Something just happened" | nc -q0 somemachine 12345


That will send to the default channel only (first in the config file). You can direct messages to specific combinations of channels (#) or users (@) like so:

Wednesday, May 4, 2011

playing mp3s in orer

I often use mplayer to play all files in a directory:
mp ./*


*mp*, by the way, is simply an alias for mplayer, used to play things faster and with speed control:


$ which mp
mp: aliased to mplayer -speed 1.21 -af scaletempo=speed=tempo



But what if I want to play them in date order? (useful to replay a stream with streamripper). I need a shell loop. A for loop will choke on filenames with spaces
:

$ for i in `ls -tr`
do
mp "$i"
done


A while loop seems to give me some problem of mplayer reading too much from stdin:

$ ls -1tr | while read i
do; mp '$i'
done


So I end up using an array:

$ mp3files=( ./*mp3 )
$ for d in "${mp3files[@]}"; do
mp "$d"
done


phew! that was far too much work

urban agriculture

Via robokow, news of plant cultivation in an old IBM typewriter factory:

The location for the first commercia nursery in the world in an office is the former IBM typewriter factory on Johan Huizinga Avenue. The large factory building has already been empty for eleven years


It goes without saying that this is an area where the cannabis cultivators have a *big* headstart :)

Stuxnet under the bed

Botnets are convenient enemies, providing justification for the introduction of spyware and restrictions on computers.
Walter and Amelia have good posts on the subject, particularly in South Korea.

South Korea, it seems, is further along a path that can be expected also in Europe and elsewhere. The country's infrastructure has repeatedly been attacked by botnet-fuelled DDoS. These attacks strengthened demand for official regulation:

Popular support is rising for a helpful Zombie PC Act giving a government-controlled authority the mandate to access and scrutinize commercial, official and private datasystems. The authortity will help the government determine if the system is infected by any potential virus. Lacking appropriate anti-virus software shall, according to the bill, lead to repercussions.


That is, there would be a requirement for official intervention in every computer. With intervention comes inspection. And thus, the threat to alarm the paranoid -- a sideways approach by which governments could seize computers. Walter:

Your computer may become a target for a serach (and seizure) just because it is a computer. The cherry on the cake is of course that we also should expect governmental bodies to take enough care that backdoors installed for this very purpose will not be abused by those very nefarious people, the Zombie-operators, it aims to fight. To quote Top Gear: what could possibly go wrong?


ETA: Amelia has another post, laying all this out much more clearly.