The Shining Path of Least Resistance

LeastResistance.Net

Archive for the ‘Uncategorized’ Category

New Year: New Site

Posted by mattray on February 6, 2019

I’ve decided to move my content over to https://mattray.github.io since I’m primarily writing about technical topics and the Markdown-based Jekyll workflow is pretty simple. I’ll leave this site up for awhile, but please follow the link.

Posted in Uncategorized | Leave a Comment »

Chef 13 on the BeagleBone Black UPDATED X4

Posted by mattray on May 12, 2017

chef-logo
Now that the Chef client 13 is available, I decided to upgrade my ARM build to the latest release. ARM is still not officially supported, but building was fairly straightforward. I had Chef 12.17.1 on the box already, but I needed to upgrade the build tooling first.

Ruby 2.4.1

Chef 13 is now using Ruby 2.4.1 in their build pipeline, so the first step was to build the latest. I already had an omnibus user and rbenv installed, so it was pretty simple:

  sudo su - omnibus
  export PATH="$HOME/.rbenv/bin:$PATH"
  eval "$(rbenv init -)"
  rbenv install 2.4.1
  rbenv global 2.4.1
  gem install bundler

omnibus-toolchain

Once Ruby 2.4.1 was installed, I decided to upgrade the omnibus-toolchain to the current release. I had to make a small patch (upstreamed), and build the latest:

  git clone https://github.com/chef/omnibus-toolchain.git
  cd omnibus-toolchain
  bundle install --without development
  bundle exec omnibus build omnibus-toolchain
  cd

Chef 13.1.12

Now I could finally get to installing Chef 13.1.12.

  export PATH="$HOME/.rbenv/bin:/opt/omnibus-toolchain/bin:$PATH"
  unzip v13.1.12.zip
  cd chef-13.1.12/omnibus/
  bundle install --without development
  bundle exec omnibus build chef -l debug

About 2 hours later I had my ARM Chef client .deb built. As the root user I installed it and ran it.

  root@beaglebone:/home/omnibus/chef-13.1.12/omnibus/pkg# dpkg -i chef_13.1.12+20170511092809-1_armhf.deb
  (Reading database ... 88226 files and directories currently installed.)
  Preparing to unpack chef_13.1.12+20170511092809-1_armhf.deb ...
  Unpacking chef (13.1.12+20170511092809-1) over (12.17.1+20161110041345-1) ...
  Setting up chef (13.1.12+20170511092809-1) ...
  Thank you for installing Chef!

UPDATED FOR CHEF 13.1.31

With the “official” release of Chef 13, I’ve updated the build and produced the Chef 13.1.31 build on ARM. Feel free to download the Chef 13.1.31 ARM client for the BeagleBone Black here: chef_13.1.31%2B20170605012947-1_armhf.deb

UPDATED FOR CHEF 13.2.20

Chef 13.2.20 is the newest stable build, download it here: chef_13.2.20%2B20170712062554-1_armhf.deb

UPDATED FOR CHEF 13.6.0

Chef 13.6.0 is the latest build, I updated rbenv to use Ruby 2.4.2 and then rebuilt the latest omnibus-toolchain. Download it here: chef_13.6.0%2B20171031060217-1_armhf.deb

UPDATED FOR CHEF 13.7.16

Chef 13.7.16 is the latest build, I updated rbenv to use Ruby 2.4.3 and then rebuilt the latest omnibus-toolchain. Download it here: chef_13.7.16%2B20180130212049-1_armhf.deb

Posted in Uncategorized | 1 Comment »

Chef 12.17.1 on BeagleBone Black UPDATE

Posted by mattray on November 10, 2016

chef-logoNow that I have Chef installed, I wanted to make a new build for Chef 12.17.1. The build version of Ruby used by omnibus-toolchain has upgraded to 2.3.1, so I had to add the following steps to clean up the previous Ruby and Chef installation:

sudo apt-get remove ruby ruby-dev ruby2.1 rubygems-integration libruby2.1 ruby2.1-dev
sudo rm -rf /opt/chef/*
sudo chown omnibus:omnibus /opt/chef

And then build Ruby 2.3.1:

sudo su - omnibus
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
rbenv install 2.3.1
rbenv global 2.3.1
gem install bundler

Once that was in place I could go build the new Chef:

. load-omnibus-toolchain.sh
wget https://github.com/chef/chef/archive/v12.17.1.tar.gz
tar -xzf v12.17.1.tar.gz
cd chef-12.17.1/omnibus
bundle install --without development
bundle exec omnibus build chef -l debug

And approximately 2.5 hours later I had a new chef_12.17.1%2B20161110041345-1_armhf.deb which worked great once installed.

debian@beaglebone:~$ sudo dpkg -i /home/omnibus/chef-12.17.1/omnibus/pkg/chef_12.17.1+20161110041345-1_armhf.deb
(Reading database ... 96808 files and directories currently installed.)
Preparing to unpack .../chef_12.17.1+20161110041345-1_armhf.deb ...
Unpacking chef (12.17.1+20161110041345-1) over (12.15.27+20161013214455-1) ...
Setting up chef (12.17.1+20161110041345-1) ...
Thank you for installing Chef!

Feel free to download it: chef_12.17.1%2B20161110041345-1_armhf.deb

Posted in Uncategorized | 1 Comment »

Installing Debian 8.6 on a BeagleBone Black

Posted by mattray on October 14, 2016

1996-01I’ve finally had practical reason to get the BeagleBone Black out of the drawer and start using it as an home server (more later). It’s a nice, quiet little machine with 512 megs of RAM and a 1ghz ARM CPU. I followed the instructions from https://beagleboard.org/getting-started to connect to it via the serial port over USB, which allowed me to connect to the web server on the included OS. Turns out I didn’t really need to do this, all I needed to do was flash my microSD card and install Debian on it.

For more in-depth Linux notes, I referred to http://elinux.org/Beagleboard:BeagleBoneBlack

I downloaded the latest Debian stable “Jessie” build for ARMHF from here. That image turned out to be a bit bloated with X and desktop tools, so I switched to the “IOT” image. I flashed the image onto a 32 gig microSD card with Etcher for OSX, which was quite painless.

Debian on the BeagleBone Black

Next I popped the microSD card into the BeagleBone and rebooted into Debian. I was able to connect to the serial console over USB with instructions from here. For my instance, the command was

screen /dev/tty.usbmodem1413

I changed the debian user password away from the default and plugged in a network cable.
Once it was on the network I could SSH to it, I probably didn’t need to use the serial console at all if I’d just looked for the IP address off the router.

I copied over my SSH key so I wouldn’t need to use my password when logging in.

scp ~/.ssh/id_rsa.pub debian@192.168.0.11:~/.ssh/authorized_keys

Next I did an apt-get update; apt-get upgrade to get the latest bits and then shut it down.

I plugged directly into the router and powered via the USB port, since it’s meant to be an externally-accessible bastion box.

Final touches

I also needed to make sure we used the whole microSD, so I followed these instructions:

cd /opt/scripts/tools/
git pull
sudo ./grow_partition.sh
sudo reboot

I checked the list of timezones and set mine to Sydney.

timedatectl list-timezones
sudo timedatectl set-timezone Australia/Sydney

and finally

apt-get install emacs-nox

Now it was ready to use.

Posted in geekery, linux, Uncategorized | Tagged: , | 1 Comment »

Automatic Wi-Fi Switching Based on Running Applications in OSX

Posted by mattray on August 11, 2015

I’ve been a longterm user and big fan of the program ControlPlane, which uses information from the environment around you (attached devices, location, networks, etc.) to change configurations in response. In my own usage, I change Time Machine backup drives based on which networks I’m on and use it to automatically start a handful of applications when I get to work (Emacs, Slack, etc.).

Speedtest

At my current office I have a pretty poor Internet setup because we’re subleasing and don’t have a permanent connection. I’m using a Clear Wireless modem that gets about 10/1Mb/s down/up which is usually fine except for the fact that I’m now sharing the bandwidth with coworkers and Sprint is actively taking down the WIMAX network as they phase out this service. Luckily one of my coworkers has a MIFI puck that does a speedy 20/4Mb/s, but it’s not an unlimited data plan like the Clear modem.

The Problem

I do a lot of video conferencing and our current tool of choice is Zoom. Compared to the other tools we’ve used over the years, it’s really great but with the strain on our network I’ve been having a lot of pauses and stutters on the slower network.

The Solution

Unfortunately there’s not a built-in “Wi-Fi Network” option in ControlPlane, only Network Locations. Network Locations under the Network preference pane don’t allow you to have a single Wi-Fi network choice, so I looked elsewhere. It turns out you can change networks from the CLI, the actual command you use (originally found here) is:

networksetup -setairportnetwork en0 WIFI_SSID_I_WANT_TO_JOIN WIFI_PASSWORD

With that bit of knowledge I created a pair of shell scripts to switch between the two Wi-Fi options.

  • In the ControlPlane Preferences I added a new “Zoom” choice under Contexts.
  • Next I added “Running Application” as an Evidence Source.
  • Next I started up Zoom and under Rules selected “Add ‘Running Application Rule'” and choose “zoom.us (us.zoom.xos)” with the Context of “Zoom”.
  • Finally under Actions I added a pair of ShellScripts to be executed immediately when entering the “Office” and “Zoom” contexts when triggered.
zoom
actions

The Result
The Internet is still pretty poor in my office, but now when I start up Zoom there’s a brief hiccup as the Wi-Fi switches over to the faster wireless provider. When I shut down Zoom I automatically switch back to the slower, unlimited bandwidth Clear network. Hopefully we’ll be getting a new office soon with a dedicated Internet connection with a lot more bandwidth, but this is a decent work-around in the meantime.

Posted in Uncategorized | Leave a Comment »

links for 2010-12-16

Posted by mattray on December 16, 2010

Posted in Uncategorized | Leave a Comment »

links for 2010-12-15

Posted by mattray on December 15, 2010

Posted in Uncategorized | Leave a Comment »

links for 2010-12-10

Posted by mattray on December 10, 2010

  • Regular Expression testing tool.
    (tags: regex)

Posted in Uncategorized | Leave a Comment »

links for 2010-12-09

Posted by mattray on December 9, 2010

Posted in Uncategorized | Leave a Comment »

New Frontiers (for me) in Ruby

Posted by mattray on December 7, 2010

As part of my new job I’m picking up Ruby 3 years after the last time I used it. Not surprisingly, it’s really nice now. I wanted to start a reminder blog post of all the useful tools I’ve installed on the way:

  • RVM: manages multiple installed versions of Ruby. My PS1 is automatically configured now to show the output of rvm-prompt with the use of a after-use hook.
  • Git-Up: automatically fast-forwards a git rebase.
  • gem-open: opens up the Gem’s source in your $EDITOR (which should be emacs).
  • gem-man: opens man pages for Ruby gems.
  • rvm.el: RVM integration for Emacs.

I also recently put my .emacs and .bash_profile into my GitHub account, to track changes as I make them. Feel free to send me any other suggestions or pointers, I’m always happy to learn more.

Posted in Uncategorized | Leave a Comment »