Chalk one up for sed!

Hey, I just saw on @climagic that sed can replace the second occurrence of a regex match with a simple modifier!

$ sed s/i/u/2 <<< fizzbizz

Perl’s substitute operator comes from sed and looks pretty much the same, but it can’t do this.

$ perl -pe 's/i/u/2' <<< fizzbizz
Unknown regexp modifier "/2" at -e line 1, at end of line
Execution of -e aborted due to compilation errors.

We’d have to do some awkward counting maneuver with an eval or something.

$ perl -pe 's/i/++$n - 2 ? "i" : "u"/ge' <<< fizzbizz

I used to use awk and sed quite a bit, but since learning Perl I find I don’t have much use for them anymore. I miss sed. But here’s one more reason not to let my sed skills atrophy completely.

Chalk one up for sed!

Hello, Stretch!

This weekend I installed Debian 9 (stretch) on my little blue netbook. I love it!

pic of netbook

It has breathed new life into this tired little soldier. I bought this netbook a little over five years ago because I was sick of lugging around the 15 inch laptop (pictured with it) at conferences and whatnot. I had just gone to a conference with my friend Nate, who had a little netbook with a 10 inch screen, when I spotted this little blue guy for like 250 bones. Sold!

I currently also have a 17 inch laptop (Diana’s old one) with Debian 8 (jessie) installed on it and that’s perhaps the nicest operating system I’ve ever used. Until now. Stretch has several nice improvements over jessie.

First, wifi. Getting wifi working remains a bit of a challenge in Linux. When I installed jessie, I did the whole install from CD. Then I hooked up the ethernet cable to get internet access so that I could enable the non-free repository and install the driver I needed for wifi. Only then could I disconnect the ethernet and use the wifi. When I installed stretch, I started the install from a thumb drive (the netbook has no CD) and it stopped me and said I needed non-free driver rtlwifi/rtl8192cfw.bin for wifi and if I had the removable media with it to insert it now. So I went to another computer and grabbed that file off the internet, wrote it to another thumb drive, inserted that into the netbook, and hit “yes”. Voila! I did the rest of the install with wifi— no ethernet required! This seems like a really nice compromise between Debian not wanting to include non-free software and the rest of us wanting to use our wifi. It’s a win-win!

Second, sudo. When I installed jessie, I had a root user and made user tim a sudoer later. After that, I never really used the root account again. When I installed stretch, I made user tim a sudoer just by leaving the root password blank. There is no root account and tim has admin priviledges. Done and done.

Third, perl6. On my jessie box, I did the whole rakudobrew thing. In stretch, there’s a recent version of rakudo all packaged up!

sudo apt install rakudo

Done! Wow!

tim@zog:~$ which perl6
tim@zog:~$ perl6 -v
This is Rakudo version 2016.04 built on MoarVM version 2016.04
implementing Perl 6.c.

This is the computer I’ll be taking to YAPC::NA next month, so I had to have that installed. I’ll be taking Damian’s Perl 6 class on Sunday.

Fourth, the printer. In jessie, I had to do a little research to determine that I needed to install system-config-printer and then use it to install my printer. In stretch, this was already there and “Settings -> Print Settings -> Add -> Network Printer” was all it took to discover my wireless printer and to correctly guess and install the driver for it.

During the stretch install, the touchpad of the netbook didn’t work. I was all set to research drivers or something for it, but upon booting the system, the touchpad worked. Still not sure why it didn’t work during the install.

The command-not-found utility still doesn’t work, but just installing it and then changing admin to sudo still fixes it.

I am still tinkering, but I can already tell I’m going to love stretch! I was toying with the idea of getting a fancy new laptop, but now I think I will keep using this little blue netbook for a while longer.

Shiny new 4.5 kernel!

pic of desktop with uname

Hello, Stretch!

Google I/O Extended 2016 Baltimore

pic of screen

Today, I took the day off work and went into town to participate in Google I/O Extended Baltimore. Google I/O, of course, is a huge event out in California with about 7,000 people attending. Google I/O Extended is a series of related events all over the world. The event in Sri Lanka had over 2,000 people. Here in Baltimore, ours was held at AOL/ on Brewer’s Hill. Ossum!

pic of mr boh

We had a slate of live talks in the morning:

  • Chris Pino, “Entrepreneurial and Technical Challenges in the Personal Computer Age”
  • Will Gee, BaltiVirtual, “Beyond ‘The Year of VR'”
  • Scott Schopman, OrderUp, “Taking Mobile Testing to the Cloud with Google Cloud Test Lab”
  • Danny Blue, LiveSafe, “Intro to Angular 2”

Following a nice lunch, we watched the Keynote live from California on streaming video.

pic of Google I/O

Afterwards, there were VR demos from BaltiVirtual

pic of BaltiVirtual demo

It was a fun day! If you can’t make it to Google I/O next year, look for the Google I/O Extended event in your area!

Google I/O Extended 2016 Baltimore

Perl 5.24 on a stick

I just upgraded my Perl thumb drive to Strawberry Perl!

pic of Perl thumb drive

I simply reformatted it and unzipped the new one onto it

cd /media/tim/Strawberry
unzip ~/Downloads/

When I put the thumb drive in a Windows machine, it was mounted as the I: drive, so now I can use Strawberry Perl from cmd.exe

Microsoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Users\tim>I:\perl\bin\perl -E "say qq{Hello, Perl $]}"
Hello, Perl 5.024000

or from PowerShell

PS C:\Users\tim> I:/perl/bin/perl -E "say qq{Hello, Perl $]}"
Hello, Perl 5.024000


Perl 5.24 on a stick

VS Code

One of the things I learned at Go Maryland tonight was that VS Code is not just for Windows; they have versions for Linux and OS X too! With a name like Visual Studio Code, I just assumed it was a Windows thing. Not so!

Naturally, when I got home I had to try it! And here it is running on my Linux machine!

Screen shot of VS Code

As you can see, it understands Go code (on the left), but not Elixir (on the right). At least, not yet. I’m sure it will eventually. I also tried out Perl (yes), Python (yes), and Ruby (yes) — no surprises there — as well as Erlang (no), Pony (no), Rust (yes), and Clojure (yes) — a couple of nice surprises there!

The cursor blinks by default, so the first thing I had to do was figure out how to shut that off 1. It only took me a minute or two to find and change the configuration to a non-blinking cursor. Well done, VS Code!

I doubt I’ll be giving up Emacs any time soon (indeed, I’m typing this blog entry with org2blog), but it’s nice to see another open source editor available. Great job, Microsoft!

Update: In case you’re curious, here’s a shot of the same two files opened in Emacs, which has an Elixir mode.

Screen shot of same two files in Emacs



I can’t stand blinking. I think it’s genetic. My Mom never let us have Christmas lights that blinked either. And to be fair, my beloved Emacs has a blinking cursor by default also
VS Code

Swift 2.2

A while back, I mentioned Swift was open sourced. Today, they released version 2.2, the first release with non-Apple contributors.

There are also binary releases, so it’s even easier to install!

$ wget{,.sig}
$ gpg --verify swift-2.2-RELEASE-ubuntu15.10.tar.gz.sig
$ tar xf swift-2.2-RELEASE-ubuntu15.10.tar.gz
$ rm swift-2.2-RELEASE-ubuntu15.10.tar.gz{,.sig}
$ export PATH=$PATH:$HOME/swift-2.2-RELEASE-ubuntu15.10/usr/bin
$ cd swift
$ rm hello
$ swiftc hello.swift
$ ./hello swift 2.2
Hello, swift!
Hello, 2.2!
Swift 2.2