George V. Reilly

JSON data from Docker Images

I was trying to get some structured in­for­ma­tion from docker images, hoping to replace some ugly Sed and AWK trickery. I could have used the docker-py library. Instead I chose to use the poorly documented --format option to docker images (and some other Docker CLI commands). Adrian Mouat gives some useful starting points at Docker Inspect Template Magic and notes that formatting is built around Go templates.

I quickly figured out that this format would meet my immediate need.

sudo docker images --format '{{.Repository}}:{{.Tag}}' \
    | grep $IMAGE_NAME \
    | grep -v latest \
    | head -1

That’s fine, but I continue.

Review: The Apocalypse Codex

Title: The Apocalypse Codex
Author: Charles Stross
Rating: ★ ★ ★ ★ ½
Publisher: Ace
Copyright: 2012
Pages: 336
Keywords: Love­craft­ian spy thriller
Series: Laundry Files, vol. 4
Reading period: 22–26 January, 2017

A major American fun­da­men­tal­ist preacher has drawn dis­turbing­ly close to the British Prime Minister, and the more the Laundry looks, they more alarmed they become. Hacker/com­pu­ta­tion­al de­mo­nolo­gist/Laundry agent Bob Howard is leveling up with the Laundry and he has been assigned to “External Assets”, the wing that deals with deniable freelance agents. Bob, Persephone Hazard, and Johnny McTavish are sent to Colorado to in­ves­ti­gate Golden Promise Ministries. There they find a hidden cult within the church where the members are possessed by alien parasites that continue.

Review: The Jennifer Morgue

Title: The Jennifer Morgue
Author: Charles Stross
Rating: ★ ★ ★ ★ ½
Publisher: Ace
Copyright: 2006
Pages: 401
Keywords: Love­craft­ian spy thriller
Series: Laundry Files, vol. 2
Reading period: 13–20 January, 2017

Bob Howard is a com­pu­ta­tion­al de­mo­nolo­gist who works for the occult British spy agency informally known as the Laundry. He’s a computer hacker who’s starting to get some field experience, but nobody would confuse him with a suave la­dykilling man of action. A bil­lion­aire is intent upon raising an eldritch horror from the depths of the sea. Only Bob, who has been “destiny entangled” with a sultry American operative, can stop him. Bob is the last to realize that Ellis Billington continue.

Seattle Womxn's March

Trump was in­au­gu­rat­ed as 45th President on Friday, drawing smaller crowds than either of Obama’s in­au­gu­ra­tions. There were prompt, easily disproved lies from Trump and his press secretary that Trump had drawn record crowds.

On Saturday, huge crowds all over the US and elsewhere marched in opposition to Trump and his agenda. 500,000 marched in Washington DC—far more than attended the Trump In­au­gu­ra­tion. That crowd included my 4-year-old niece, her mother, her aunt, and her cousin, as well as other friends from all over the country. 170,000 marched in Seattle. It’s estimated that more than 3,000,000 people marched in total, making it the largest protest ever. Trump can pull yuge crowds after all.

Emma and continue.

Trump Inauguration

Twenty-eight years ago today, I attended George H.W Bush’s in­au­gu­ra­tion. By accident. Read that post for the rest of the story.

I didn’t especially care for Bush Senior. I certainly didn’t care for George W. Bush, who was the worst U.S. president in my memory.

We’ve just had one of the best. Obama was a president of high personal character and competence. His ad­min­is­tra­tion had integrity and remained free of scandals. He inherited an enormous economic mess and cleaned it up. He introduced the Affordable Care Act, something no other Democratic president managed. He faced wholly un­prece­dent­ed opposition and in­tran­si­gence from the Re­pub­li­cans, who vowed early on to make him a one-term president.

In mid-2011, two young continue.

Bash: echo success of previous command

C-like languages have a ternary operator, cond ? true_re­sult : false_re­sult. Python has true_re­sult if cond else false_re­sult. Bash doesn’t have a ternary operator, but there are various workarounds.

I wanted to print succeeded or failed based on the exit code of the previous command in a shell script. In Unix, all programs exit with an integer status code. Successful programs exit with 0; all other values, positive or negative, indicate failure. In Bash, the status code of the previous program is held in $?.

some/command or-other fer example

STATUS="$([ "$?" == 0 ] && echo 'succeeded' || echo 'failed')"
echo "Results: $STATUS"

There are other ways to handle this.

Movember 2016

I’ve worn a beard since 1986, when I was 21. Only rarely have I been clean­shaven since then. Emma, who met me in 1997, has only seen me clean­shaven once before, about 15 years ago. I promptly regrew the beard that time.

I decided in October to fundraise for Movember. In truth, I was also curious to see what I looked like without my trademark beard. On Halloween night, I shaved everything off. Interim photos as I whittled down the beard can be seen below, as can some progress photos taken since then as I grew an over-the-top handlebar mustache.

I’ve let the rest of the beard start growing in after my heel operation a week and continue.

Knee Walker

I had heel surgery last week to remove a heel spur which was causing tendonitis and to repair the Achilles tendon. More on that some other time.

I rented a knee walker this morning from Eastside Leg Up. I love it! After barely getting around with crutches for a week, the scooter makes a huge difference. I can move around at normal walking pace now, instead of wearing myself out with the crutches.

In­ci­den­tal­ly, I found my first WebP image in the wild: the original of the image that’s shown here. I used Im­ageMag­ick convert to make it into a JPEG.

Review: The Atrocity Archives

Title: The Atrocity Archives
Author: Charles Stross
Rating: ★ ★ ★ ★
Publisher: Ace
Copyright: 2004
Pages: 345
Keywords: Love­craft­ian spy thriller
Series: Laundry Files, vol. 1
Reading period: 10–12 January, 2017

Bob Howard, Laundry hacker newly promoted to field agent, finds himself protecting a logic professor from rogue SS-Ahnenerbe agents who’ve been hiding in another dimension since the end of the War. But their biggest problem is the frost giant that was summoned. And later there’s the subverted CCTV cameras with the basilisk stare.

To borrow Charlie Stross’s own words from his Crib Sheet:

So there you’ve got the in­gre­di­ents. Love­craft­ian horror; the secret agency [the Laundry] dedicated to protecting us from the scum of the continue.

Git File Modes

Ever wonder what the six-digit file modes are in a Git commit? The mysterious 100644 and 100755 modes?

diff --git a/foo/bar.py b/foo/bar.py
old mode 100644
new mode 100755
index b829edea4..ee6bda024
--- a/foo/bar.py
+++ b/foo/bar.py
@@ -1,3 +1,4 @@
...

I had made foo/bar.py executable by using chmod +x and adding a #!/usr/bin/env python shebang. The last three digits are obviously the same octal digits that you can use with chmod. But what’s that 100 prefix?

The ex­pla­na­tion can be found in a Stack­Over­flow answer:

100644₈  regular file (non-executable)  S_IFREG | S_IRUSR | S_IWUSR
                     
continue.
Previous » « Next