# Making Fish Shell Smile

When working in a shell, from time to time, I need to know if a command succeeded or failed. Sometimes, it’s easy:

$make noise make: *** No rule to make target noise'. Stop. Sometimes, less so: $ grep frog podcasts.json > podcasts-about-frogs.txt

Since, alas, I don’t have any podcasts about frogs, that command would fail silently. But that’s fixable!

$grep frog podcasts.json > podcasts-about-frogs.txt$ # Bash/Zsh
$echo$?
1

$# Fish$ echo \$status
1

As I did with last year / yesterday, I’ve written up a series of posts for the Advent of Code 2017 problems. Again, I didn’t manage to write them up as I did them, but this time around I least I finished mostly on time.

As I did last year, I’m going to solve the Advent of Code problems again this year.

Or that was the plan. It turns out that instead I put down my blog for almost a year and a half and never quite got around to doing these problems. So I’m actually backdating these posts from the early days of 2018 to where they would have been had I solved them on time. They’re still interesting problems, so give them a read.

Four years. Starting to feel like a habit.

This time around, I’m aiming for 72 books (6 per month) rather than the 50 of my previous two years. Since I’ve read well over that both years, I’m not overly worried. Perhaps this will convince me hit 100 again? We’ll see.

Another year of reading. I easily beat my official goal of 50 with 84 books (finished the last one a few hours before the end of the year). Unfortunately, it still feels like something of a failure, down from my original 100 book year and last year’s 91. Yes, I’m just crazy enough that 84 books in a year feels like a failure. 😄

A few stats:

• The shortest book I read this year was The Eleventh Metal at 14 pages
• The longest was Beyond the Shadows at 689 pages
• My overall average was 338 pages per book and 77 per day
• My average rating was 4.5 with 14 three stars and 18 four stars (the rest were fives)1
• I listened to 21 books on audiobook (all Discworld novels, so that’s almost my most by a single author or in a single series)
• I borrowed a good number of them from our local library system; Overdrive is wonderful

# Boundary Born

And now that you know this, are you any different than you were yesterday?” he asked. Pragmatic, as usual. “Nothing has changed, Lex. You haven’t changed. You just know something that you didn’t know before, that’s all.

The third time around, we have two new plot threads: someone has poisoned Maven and tehre is a new evil on the hunt.

# Jingo

Always be wary of any helpful item that weighs less than its operating manual.

Such is modern life.

# AoC 2017 Day 25: Turing

### Source: The Halting Problem

Part 1: Implement a Turing machine defined as such:

Begin in state A.
Perform a diagnostic checksum after 6 steps.

In state A:
If the current value is 0:
- Write the value 1.
- Move one slot to the right.
- Continue with state B.
If the current value is 1:
- Write the value 0.
- Move one slot to the left.
- Continue with state B.

...

What is the final number of 1s on the tape?

# AoC 2017 Day 24: Maker Of Bridges

### Source: Electromagnetic Moat

Part 1: Given a series of reversible components of the form 3/4 (can connect a 3 on one end to a 4 on the other), form a bridge of components. The bridge’s strength is equal to the sum of component values. So 0/3, 3/7, and 7/4 has a strength of 0+3 + 3+7 + 7+4 = 24.

What is the strongest possible bridge?

# AoC 2017 Day 23: Duetvmc

### Source: Coprocessor Conflagration

Part 1: Create a variation of the previous DuetVM with only the following four instructions:

• set X Y sets register X to Y
• sub X Y set register X to X - Y
• mul X Y sets register X to X * Y
• jnz X Y jumps with an offset of the value of Y, iff X is not equal to zero

If you run the given program, how many times is mul` invoked?