Ubuntu 16.04 on MacBook Pro 11,1 success story

Once every blue moon I try some sort of Linux as the native operating system on my laptop. As I tend to have a recent laptop, this usually ends as a short experiment where I find out one or two devices just will not work.

As my wife moved to my previous laptop when I bought my current laptop, we had her old laptop more or less as a spare / for the kids. After about half a year I noticed the laptop had rarely been touched by said kids and I figured it was too good a machine to waste. So it was either selling it off or re-purposing it.

Re-purposing as a small / lightweight spare for myself sounded great. At first I set it up using MacOS, but soon I found myself installing Windows 10 and Ubuntu 16.04 as multiboot to toy around with.

This is by far the Best Ubuntu experience I ever had on a macbook, or any other laptop. It worked so well in the first couple of days, that I wiped everything from the machine to install Ubuntu exclusively on it.

Sound, wifi, graphics, hot plugging monitors, VPN, all with zero or really minimal fuss. Nice, fast, reliably. Really, I am impressed.

And the machine is from late 2013 / early 2014. But the performance of this thing is still pretty amazing.

Apparently the camera does not work, but I did not check as I have a Bits of Freedom sticker covering it up. Also the media controls on my apple earbuds do not work in Ubuntu apparently blocked by some Apple patent.

Batterylife is supposed to be a lot worse compared to MacOS. But I haven’t been bothered by it yet.

Thank you Ubuntu devs 🙂 #donationtime

windows git pre-commit hook for puppet development

For a recent client I was asked to provide a puppet development setup on the windows platform. The toolchain included Git for windows / Git bash / Turtoise GIT / Atom and some others. It also includes the windows adaption of my git pre-commit hook.

To use this hook, you need to install the puppet v4 agent and install a couple of ruby gems within the provided ruby environment. Something like :

c:\program files\puppetlabs\puppet\sys\ruby\bin\gem.bat install r10k
c:\program files\puppetlabs\puppet\sys\ruby\bin\gem.bat install puppet-lint

(from an elevated command prompt)

The hook needs to be saved in every git repository that contains puppet code in het directory [repo]/.git/hooks/

Warning : The windows linefeed bit is really recent and might need some additional testing.

 

#!/bin/bash
# Requires bash, as it uses the [[ ]] syntax.
#
# https://puppetlabs.com/blog/using-puppet-lint-to-save-yourself-from-style-faux-pas
# https://docs.puppetlabs.com/guides/templating.html#syntax-checking
#
# If it's puppet code, lint it up.
# 20150915 syncaddict
# - Added support for erb syntax checking
#
# 20151020 syncaddict
# - Added support for YAML syntax checking
# - more verbose operation
#
# 20170615 syncaddict 
# - version that works on windows
#
# 20170809 syncaddict
# - detect / convert windows linefeeds
#
# Variables goes hither

 

PUPPETLINT="/c/Progra~1/Puppet~1/Puppet/sys/ruby/bin/puppet-lint.bat"
PUPPETAGENT="/c/Progra~1/Puppet~1/Puppet/bin/puppet.bat"
ERB="/c/Progra~1/Puppet~1/Puppet/sys/ruby/bin/erb.bat"
RUBY="/c/Progra~1/Puppet~1/Puppet/sys/ruby/bin/ruby.exe"

DOS2UNIX=/usr/bin/dos2unix
GREP=/usr/bin/grep
WC=/usr/bin/wc

declare -a FILES

IFS="
"
FILES=$(git diff --cached --name-only --diff-filter=ACM )
 

for file in ${FILES[@]}
do

   ## replace windows linefeeds on all changed files - WIP
   LFCHECK=`$GREP "\r\n$" $file | $WC -l`
   if [[ $? > 0 ]]; then echo "LF check failed"; fi

   if [[ $LFCHECK -gt 0 ]];
   then
     $DOS2UNIX $file
     echo "Converted linefeeds on $file, please re-add and retry your commit"
     exit 666
   fi

 

 

  case $file in
    *\.pp*)
      echo "Checking puppet file $file"
      $PUPPETLINT --no-puppet_url_without_modules-check --no-arrow_on_right_operand_line-check --no-140chars-check --fail-on-warnings --fix --with-filename "$file"
      RC=$?
      if [ $RC -ne 0 ]; then exit $RC;fi

      $PUPPETAGENT parser validate "$file"
      RC=$?
      if [ $RC -ne 0 ]; then exit $RC;fi
    ;;
    *\.erb*)
      echo "Checking erb template $file"
      $ERB -P -x -T '-' $file | $RUBY -c
      RC=$?
      if [ $RC -ne 0 ]; then exit $RC;fi
    ;;
    *\.yaml*)
      echo "Checking yaml file $file"
      $RUBY -e "require 'yaml'; YAML.load_file('$file')"
      RC=$?
      if [ $RC -ne 0 ]; then exit $RC;fi
    ;;
    *)
      echo "Not checking file $file"
    ;;
  esac
done

exit 0

Tor relay node back in business

When a leased server has bandwidth to spare, I try to give it to the tor network. Project servers come and go, but I am happy to report that my relay node is back in business.

Aug 5 14:45:48 droid Tor[8966]: Bootstrapped 0%: Starting
Aug 5 14:45:48 droid Tor[8966]: Starting with guard context "default"
Aug 5 14:45:48 droid Tor[8966]: Bootstrapped 80%: Connecting to the Tor network
Aug 5 14:45:48 droid systemd[1]: Started Anonymizing overlay network for TCP.
Aug 5 14:45:48 droid Tor[8966]: Signaled readiness to systemd
Aug 5 14:45:49 droid Tor[8966]: Opening Socks listener on /var/run/tor/socks
Aug 5 14:45:49 droid Tor[8966]: Opening Control listener on /var/run/tor/control
Aug 5 14:45:49 droid Tor[8966]: Bootstrapped 85%: Finishing handshake with first hop
Aug 5 14:45:49 droid Tor[8966]: Bootstrapped 90%: Establishing a Tor circuit
Aug 5 14:45:49 droid Tor[8966]: Tor has successfully opened a circuit. Looks like client functionality is working.
Aug 5 14:45:49 droid Tor[8966]: Bootstrapped 100%: Done
Aug 5 14:45:49 droid Tor[8966]: Now checking whether ORPort 94.130.31.206:443 and DirPort 94.130.31.206:80 are reachable... (this may take up to 20 minutes -- look for log messages indicating success)
Aug 5 14:45:49 droid Tor[8966]: Self-testing indicates your DirPort is reachable from the outside. Excellent.
Aug 5 14:45:50 droid Tor[8966]: Self-testing indicates your ORPort is reachable from the outside. Excellent. Publishing server descriptor.
Aug 5 14:45:51 droid Tor[8966]: Performing bandwidth self-test...done.

(And it is all the server does at this time, the project work is still on the todo list 😉

I thought fixing the tor relay today would be a good thing as I am wearing my tor shirt at #sha2017