Archive for December, 2015

J.R.R. Tolkien: The Silmarillion

Thursday, December 24th, 2015

Around christmas, every year, I read Tolkien’s “canon”, that is, The Hobbit, The Lord of the Rings, and The Silmarillion. So also this year. And this year’s theme from the Silmarillion is … death. How depressing! Or is it?

Several times after his books took off into a success, Tolkien was asked what they were really about. What was the main theme in The Lord of the Rings, and his other texts? One of the answers he gave, perhaps with the tongue in his cheek, was that ultimately, they were about Death. Reading the Silmarillion, this is more visible than in most of the rest of the legendarium. There is death, sure there is, in The Hobbit and The Lord of the Rings, but death, and the fear of it, not as present as in the Silmarillion.

Before some unknown happening in man’s existence (hints of a fall to sin exists in Letters and The History of Middle-earth, but this was dropped in the later Silmarillion), death was the gift of God (Eru Ilúvatar) to man. What happens after death, the Elves (that has the point of view in the Silmarillion), do not know, and to them, death by age is a strange thing. As they say in Of the beginning of days: whereas to men, he gave strange gifts. But men should trust Eru, and receive death without fearing the unknown. But Morgoth, the Enemy, brings fright of the everlasting darkness to them, and they tend to envy the elves for their immortality within this world. Accepting death as it comes, and not strive for longer life, is presented by Tolkien as a purity. And it is a common mark of a corrupted society when this does not happen. So when Theoden dies in battle, or Aragorn lies down to rest after all his deeds, this is a Good Thing. But as heraldry and strong elixirs becomes more important than faithfully giving power over to your heir, Gondor wanes.

Most visible in the legendarium is this in Númenor. The first kings of the Land of the Star lives to a very old age, and when their time comes, they give their crown to their heir when he or she comes to age and hood, and then go to rest. And the people followed their king. But as we read in the Akallabêth, when Sauron gets power over the king, the fear of the darkness comes, and the strive to longer life reappears, as their actual life grows shorter. Parallely, we get the kings’ hunger for power, strife between the Númenoreans and enslavement of the people of the coasts. The unwillingness to accept death as a part of life, and a hope, makes the societies of Middle-Earth suffer.

This reappearing mode must have been important for Tolkien, and his catholic christian view shines through: Death is not to be feared. As Aragorn says to Arwen at his deathbed: Behold, we are not bound for ever to the circles of the world, and beyond them is more than memory.

J.R.R. Tolkien: The Hobbit, TBOFA extended ed.

Wednesday, December 23rd, 2015

I read J.R.R. Tolkien’s “canon”, that is, The Hobbit, The Lord of the Rings, and the Silmarillion, every Christmas. So also this year.

Not much to post about The Hobbit this year, except that I also watched the extended edition of The Battle of the Five Armies some time ago. And I enjoyed it.

There are things to say about Peter Jackson’s Hobbit project, and I’ve actually already said a bit about the theater version. The extended edition, in plain 2D on a decent TV screen is a better film. There are things to dislike. How come Galadriel is the most powerful of the White Counsil? (Or is she?) The bunny sleigh is always annoying, and Legolas running up falling rocks is still a bit too disneyish for my taste. But hey, we also got more Beorn, more Esgaroth, and more Dale. That counterweights a lot. But what gave me most in this version, compared to the theater one, is the feeling of closure. We get Thorin, Fili and Kili’s funeral. Thorin has the Arkenstone on his breast, and Daín is crowned king. This is very satisfactory, and was reason enough for me to watch the movie.

Of Balin and Thrór’s Ring (J.R.R Tolkien: The Lord of the Rings)

Wednesday, December 23rd, 2015

I read Tolkien’s canon (The Silmarillion, The Hobbit, The Lord of the Rings) every year about christmas. This year’s pondering is over Balin and Gandalf and Thrór’s ring.

Thrór possessed one of the seven rings that the dwarves got from Sauron of old. Inherited from father to son through generations, it was an heirloom of immense value for the Durin line. It passed to Thrain, who was Thrór’s son, and Thorin Oakenshield’s father. When Sauron woke again during the Third Age, Thrain was taken captive in Dol Guldur, and the ring taken from him. He perished there before Gandalf could resuce him. All this Gandalf told in the council of Elrond.

Now, by the same council, Glóin reveals that one of Balin’s main reasons for attempting to recolonize Moria, was to find Thrór’s ring. But Gandalf knew that it was not in Moria, as it was taken from Thrain in Dol Guldur. When Gandalf knew this, it is quite obvious that Thorin knew too. Gandalf would not keep information hidden about Thrain’s condition and death from his only son. So both Gandalf and Thorin must have known that Thrór’s ring was taken. Still, Balin, did not know, even though he was a close friend and companion of both Thorin and Gandalf. Consider the last scene in the Hobbit, where Gandalf and Balin, on a journey all the way from The Lonely Mountain, visit Bilbo. It is a meeting between close friends. Yet, Balin knew not. So he went with his followers to seek for the ring, and the whole colony was killed cruelly, fighting a last stand against the orcs of Moria.

In retrospect, a bit more openess about the ring would perhaps have been advisable. But the keeping and the keeper of the ring was constantly kept a tight secret in the Durin line. No one knew for sure who had the ring, until it was given to its next keeper. The appendices tell us that the dwarven rings were treacherous. Though not making the dwarves into shadows and slaves of Sauron, the ring keepers of the dwarves became jealous, and a constant hunger for more gold was set in them. Thus, the ring was often the base for a large hoard of treasure, which in turn could cause grieves like wars and dragon plunder.

Perhaps Gandalf considered this, when he kept his knowledge about Thrór’s ring hidden. It is still a bit of a mystery to me though.

Poor man’s VPN via ssh socks proxy

Sunday, December 13th, 2015

This was also posted on Redpill Linpro’s Sysadvent blog

It is late night. You have just arrived at your Grandparents, when the SMS beeper goes off. There is a problem with a SAN controller, and the on-call person know you fixed it the last time. Now, if you only had documented it.

You know you have to fix this yourself, but you have no VPN access. You don’t even have an Internet connection, except your 3G mobile phone, and you really need access to that admin web gui. There is an emergency ssh port available, but no other port is open. X-forwarding over 3G? Not an option. ssh port-forwarding and fix /etc/hosts. Doable perhaps? VNC over ssh? Awkward. Enter the ssh socks proxy!

Emergency web access

Simply run:

$ ssh -D 1080 login.example.com

Now, you have a local port 1080 that creates a SOCKS proxy to the server side. Firefox has support for that proxy.

Settings -> Advanced -> Network -> Configure how Firefox connects to the Internet -> Manual settings, Socks: localhost, Port: 1080

If you need to resolve addresses from the server side, add that to the config. In the URL field, type about:config , then search for key

network.proxy.socks_remote_dns

Set it to true. That is all. You are now surfing as if Firefox was running locally on the login server. Remember to reset your settings after you have finished your session, or Firefox will not work properly when you close your SOCKS proxy ssh shell.

Not just surfing

But wait, there’s more. With a local SOCKS proxy, you may also use other programs, and they don’t even have to support SOCKS themselves. Install tsocks, and set localhost as the socks proxy host:

$ sudo yum install tsocks || sudo apt-get install tsocks
$ echo "server = 127.0.0.1" | sudo tee /etc/tsocks.conf

tsocks is a little gem of a program. It hooks into other programs, and redirects network traffic to the local SOCKS proxy. Now, while the ssh SOCKS proxy is still running (the ssh -D1080 command), just use tsocks to run your favourite program through the proxy:

# Log into a server on a closed network behind the firewall
$ tsocks ssh server.behind.firewall.example.com
# Run a local psql shell against a remote server through the SOCKS proxy
$ tsocks psql -U pg_admin_user -W -h database.behind.firewall.example.com -W template1

or to run a whole session of commands through the socks proxy, start with “. tsocks on” (note the leading dot), and stop it with “. tsocks off”

$. tsocks on
$ command
$ command
$ command 
$. tsocks off

To run Firefox through the SOCKS proxy, but without changing its configuration:

$ tsocks firefox http://ripe.net   # Stop firefox first

To check tsocks status, run

$ tsocks show

If the LD_PRELOAD variable is empty, tsocks is disabled for this shell.

Note that all Internet traffic is not routed via tsocks. For example, ICMP is not.

Bash process substitution

Saturday, December 12th, 2015

Also posted on Redpill Linpro’s sysadvent blog

In bash, we often use redirects (that is < and > ) to get output from a command to a file, or input from a file to a command. But sometimes, commands takes two or more files as input. Then our ordinary scheme does not work anymore.

Let’s say you want to diff(1) the output of two commands. For example, compare the contents of two directories. You may run the two commands, and redirect the output to files, then diff the files, and finally remove the files. Awkward.

 $ ls dir1 | sort > file1
 $ ls dir2 | sort > file2
 $ diff -u file1 file2
 $ rm file1 file2

Since diff can take stdin as one input via the special filename ‘-‘, we might cut down to one file, but this is still awkward.

 $ ls dir1 | sort > file1
 $ ls dir2 | sort | diff -u file1 -
 $ rm file1

Bash has (of course) a better solution: Process Substition, that is, treat the output (or input) of commands as files. Enter the process substitution operators:

 >(command list) # Input
 <(command list) # Output

Now, let us solve our diff challenge with a simple oneliner:

 $ diff -u <( ls dir1 | sort)  <( ls dir2 | sort )

Neat, isn’t it? I use this all the time!

Bonus: Avoid subshell scripting

The following bash shell loop is a pitfall often missed, leading to subtle bugs that are hard to spot. Pipe to a while loop runs in a subshell, so global variables goes out of scope when they are changed inside the loop.

 #!/bin/bash
 global=0

echo "Outside loop, global=$global"

 for n in 1 2 3; do echo $n; done | \
 while read i; do
     global=$i
     echo "Inside loop: global=$global"
 done
 
 echo "Outside loop, global=$global again :-("

Using command substitution, we avoid this elegantly:

 #!/bin/bash
 global=0
 
 echo "Outside loop, global=$global"
 
 while read i; do
     global=$i
     echo "Inside loop: global=$global"
 done < <( for n in 1 2 3; do echo $n; done )
 
 echo "Outside loop, global=$global still :-)"

Arto Paasilinna: Volomari Volotinens første kone og andre gamle ting

Tuesday, December 8th, 2015

Den sparsommelige juriststudenten Volomari Volotinen gifter seg med feltlotten Laura Loponen. Hun er 20 år eldre enn ham, og det er jammen bra for Volotinen, for han kan trenge både ballast i livet, moderlig omsorg, og øm kjærlighet. Sammen med henne, og alene på oppdrag som jurist for forsikringsselskaper, opplever han mange rare eventyr. For Volotinen har alltid samlet på rare gamle ting, og har et privat museum med alt fra Tarzans underbukser til Lenins skinnlue, og for hver underlige gjenstand han klarer å skaffe seg, får vi historien om hvordan han fikk tak i den.

Dette er mest blott til lyst. Lite alvor, men tant og fjas, og en og annen eksplosjon. Men kjempegøy.

J.K. Rowling: Den tomme stolen

Wednesday, December 2nd, 2015

Barry Fairbrother er død. Barry som ledet sognerådet. Barry, som kom fra små kår i fattigstrøket Fields, og som arbeidet seg til toppen av landsbysamfunnet. Barry, som kjempet for rusklinikken, som trente rolaget, venn, oppmuntrer, problemløser, konfliktdemper. Barry dør, og når hans stol står tom, starter kampen, ikke bare om ledelsen i sognerådet, og om framtiden til Fields, men også mellom alle som han meglet mellom. Lokalmiljøet eksploderer i intriger og lenge undertrykket hat. Dette er historien om Barrys sørgelige arv. Men det er også den fascinerende historien om tenåringene Fats, Andy, Sukhvinder, Gaia, og Krystal. Og først og fremst om Krystal, den eneste utelukkende positive personen Rowling har med i historien, bortsett fra Barry.

Det blir litt massivt. Det er mange navn. Flyten halter litt, med Rowlings omfangsrike språk, litt hoppende mellom nåtid, og korte og lange innskudd av fortid og sidehandling. Den første delen blir litt tung, men så løsner det. Hvem er det som sender falske meldinger til Sognerådets nettsider? Det tar av, og mot slutten er det en orgie i hat, selvopptatthet, egoisme, og knuste håp. Hvem kan motstå noe slikt? En del figurer er ren bonus. Samantha for eksempel, forelsker seg i datterens pop-idol, forsøker å forføre naboens tenåringsgutt i fylla. Helt enestående. Ellers er lyspunktene få. Ikke fordi boka skulle være dårlig. Det er den aldeles ikke. J.K. Rowling slipper alle bånd, og er det humor her, så er den i svarteste laget for min smak. Dette er ikke en småmunter eventyrbok for barn. Dette stoff for voksne. Men er det bra? Det er det. Boka sitter i magen i dagesvis etter at du har lest den, og det sier vel sitt.

Robert Wilson: De skjulte morderne

Tuesday, December 1st, 2015

Inspektør Javier Falcón ved mordavsnittet i Sevilla får en vrien sak. Det blir gjort et makabert likfunn på søppelhaugen. Morderne har vært påpasselige med å fjerne all identitet, inklusive ansikt og fingertupper. Men idét etterforskningen skal til å begynne, får politiet annet å gjøre. En gigantisk bombe går av i kjelleren i en boligblokk. Hele blokka går med, inklusive en barnehage og en moské. Byen er i unntakstilstand med umiddelbar massiv terroretterforskning.

Her er det mange historielinjer, og mye å holde greie på. Falcón og etterforskerne hans, som roter rundt i ruinene etter bomben, samtidig som de prøver å ikke glemme det ukjente liket fra søppelhaugen. Falcóns gamle flamme Consuelo Jiménez går til psykolog, og må rote i fortiden sin, og Falcóns ekshustru sliter med med forholdet til sin nye mann, rundbrenneren som tilfeldigvis er statsadvokat, og formelt sett Falcóns overordnede. Politikerne driver sitt spill i massemedia, og surfer på hatet som arves av bomben. Og på toppen av det hele blir Falcón oppsøkt av de hemmelige tjenster. Mange tråder som må bindes sammen altså, og alt i Sevillas brennende hete, men glitrende fortalt. Vi lever denne boka. Vi triller langsomt gjennom byen. Vi knatrer over brosteinene. Vi puster het eksos. Vi roter i ruinene. Vi kjører en støvete vei med en sliten firehjulstrekker. Vi tar en tapa og et glass i kveldingen. Før eller senere kommer Robert Wilson til å føre til at jeg besøker Sevilla.

Dette er strålende krim. Anbefales varmt.

Hans Olav Lahlum: De fem fyrstikkene

Tuesday, December 1st, 2015

I klassisk Agatha Christie- og Arthur Conan Doyle-stil bør jo enhver krimserie brekkes opp med en novellesamling med samme hovedpersoner, i ny og ne. Så også med Førstebetjent Kolbjørn Kristiansen alias K2, og geniet på Frogner, Patricia Borchmann i rullestolen sin. Dette er imidlertid ikke helt vanlige noveller, snarere er de kort-romaner, eller langnoveller, om du vil. Tre historier: En “lukkede roms mysterium”-variant i “Pistolen”. I “De fire vinglassene” får vi et giftmord der en selvopptatt forfatter er drept, og tre av hans kvinner ligger forgiftet, men overlevende tilbake. Hvem er bokstavelig talt femme fatale i forsamlingen? Og til sist, “De fem fyrstikkene”, i en variant over et tema jeg mener å ha sett før, minst én gang tidligere. Fem motstandsfolk under krigen, i ei hytte i skogen, mens fienden nærmer seg. Hvem er forræderen?

Hans Olav Lahlum mestrer langnovellens – eller kortromanens kunst, og briljerer i sin parafrase over kjente krimsjangre, uten at det blir parodisk. Og selv om oppskriften er velkjent ble jeg lurt underveis. Anbefales til påskekrim – det er ikke så lenge til påske, er det vel?