Right to be forgotten – my personal calendar edition

As I was planning a new item in my schedule last week, my OS X calendar was trying to be helpful by suggesting entries based on previous events in my schedule. This is great on many occasions, but this time it suggested an entry from long ago. Think ten years ago.

In itself this is excellent indexing and good working functionality, but why do I have appointments from more than a decade ago hanging around in me schedule?

When I tried to clean up my history to say this decade, there seem to be no controls to do that. No option to remove / clean up / filter events from a specific time frame in OS X Calendar.

I ended up installing a third party tool that at least could filter based on DECADE to remove everything from the previous decade. Although some events might have been interesting, nobody cares about my dentist appointment and that sort of stuff from ten years ago, right?

Just as memories fade to the more abstract notions of said events, maybe my data should do this too. Or at least give me some options to manage it.

git pre-commit hook for puppet, erb and yaml files

A pre-commit hook is a great way to run custom actions before handing over your work to GIT (and thus your CI tool chain). For puppet related GIT repositories I’ve assembled a pre-commit hook that checks the puppet code, changed ERB templates and any changed YAML files  for formatting errors.

All not rocket science when put together, but a great time saver none the less. I never fly without it these days. Just paste the code block below in your [GITREPO]/.git/hooks/pre-commit and make sure the result is executable for your own account. The code is just bits that I pieced together.

There are a few dependencies that you might have to install depending on your platform.

# 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.

# If we don't have puppet-lint, so just exit and leave them be.
which puppet-lint >/dev/null 2>&1 || exit

# 20150915 syncaddict
# - Added support for erb syntax checking
# 20151020 syncaddict
# - Added support for YAML syntax checking
# - more verbose operation
# Variables goes hither

declare -a FILES
FILES=$(git diff --cached --name-only --diff-filter=ACM )

for file in ${FILES[@]}
  case $file in
      echo "Checking puppet file $file"
      puppet-lint --no-puppet_url_without_modules-check --no-80chars-check --fix --with-filename "$file"
      if [ $RC -ne 0 ]; then exit $RC;fi

      puppet parser validate "$file"
      if [ $RC -ne 0 ]; then exit $RC;fi
      echo "Checking erb template $file"
      erb -P -x -T '-' $file | ruby -c
      if [ $RC -ne 0 ]; then exit $RC;fi
      echo "Checking yaml file $file"
      ruby -e "require 'yaml'; YAML.load_file('$file')"
      if [ $RC -ne 0 ]; then exit $RC;fi
      echo "Not checking file $file"

exit 0