Tuesday, January 15, 2013

The Five Stages of IPv6

I had a note to myself to write The Five Stages of IPv6 but The Networking Nerd beat me to it. Since everyone I've encountered first approaches IPv6 with a serious case of denial, it's an obvious lead-in to find the parallels to the Kübler-Ross model.
  1. Denial: no, I don't need IPv6. Sorry, but yes, yes you do.
  2. Anger: NO, I DON'T NEED IPv6!!! Sorry, but yes, yes you do.
  3. Bargaining: can some other software or hardware do IPv6 translation for me? Load balancers like our F5 units can do it for you, but native is faster and you control it. And NAT is just plain bad, bad, bad. example
  4. Depression: there's too much to do! Start somewhere. Personally, I discovered that it was much easier than I thought. example
  5. Acceptance: now what? Start somewhere!

Friday, January 4, 2013

Clipboard to Google Calendar

I enjoy a good shell script, so here's what I cobbled together. This script requires Mac OS X (every version so far has pbpaste) with the Google CLI (gdata-python-client, I used version 2.0.17) installed. The basic command is google calendar add --cal Calendar "Event 1/4/2013 at 3:00 PM in Location" but I used a script for error checking, and I only have to scroll back to the last error to see all of the problematic entries.

#! /bin/bash

## This script sends the clipboard to Google Calendar one line at a time.
## REQUIRES: Google cli from http://code.google.com/p/gdata-python-client/
##
## Version 1.0  2013-01-04  nethope
##
## 1.0  2013-01-04  initial
VERSION="1.0"
NAME=${0##*/}

###
## Variables
#
# 0 for no DEBUG
typeset -i DEBUG=1
if (( $DEBUG )); then /bin/echo Debugging on...; fi

###
## Parameters
#

## Paths
ECHO=/bin/echo
GOOGLE=/usr/local/bin/google
PBPASTE=/usr/bin/pbpaste

###
## main()
#
if (( $DEBUG )); then $ECHO Script ${NAME} running; fi

FAILURES="" NEWLINE=\\n
typeset -i TALLY=0
$PBPASTE | while read -r LINE
do
  $GOOGLE calendar add --cal Calendar "${LINE}"
  EXIT_STATE=$?
  if (( $EXIT_STATE )); then
    TALLY+=1
    FAILURES+=${LINE}${NEWLINE}
    echo -e "${NEWLINE}!!! Failed on line"
    echo -e "      ${LINE}${NEWLINE}"
    if (( $DEBUG )); then
      echo -e "  Errors add up to ${TALLY}"
      echo -e "  Failed lines are"
      echo -e "${FAILURES}${NEWLINE}"
    fi
  fi
done

# use exit code values of 0 (success) and 64 through 113 (or 125)
exit 0

Wunderlist

So I have been experiencing the Wunderlist "Synchronizing failed" error, and finally decided it wasn't going away on its own so I should do something about it. Since I'm still using WL1, I wanted NOT to logout. Luckily, I can extract my data, using Wunderlist-Helpers, or even simpler using the command line.

Mac OS X has come with sqlite3 for a while now, so no installation needed.

$ find ~ -name "wunderlist.db" -print 2>/dev/null
~/Library/Application Support/Titanium/appdata/com.wunderkinder.wunderlist/wunderlist.db
(be sure to escape the space with a backslash!!!)
$ cd ~/Library/Application\ Support/Titanium/appdata/com.wunderkinder.wunderlist/
$ sqlite3 -csv -header wunderlist.db "select * from tasks left join lists on tasks.list_id=lists.id;" > ~/Desktop/wunderlist_export.csv
$ open ~/Desktop
$ open ~/Desktop/wunderlist_export.csv
Now you should see your desktop folder with the newly created export file, and it should be open in your default CSV viewer!

I think I'm going to go from Wunderlist back to Google Tasks.