Env

· · learn more

◌  Shell functions for the AGL 3080 and my points database

11 September 2009


aglup () {
  for N in /Volumes/GPS\ TRACKER/GPSFILES/*.log do
    T=$(mktemp -t gpx) 
    gpsbabel -i nmea -o gpx $N $T
    B=$(mktemp -t gps) 
    python2.6 ~/Desktop/tracks/trackstuff/agl3080dump.py $T >> $B
    psql -d points -c "\copy points from '$B' with delimiter ','" \
      && rm $T $B && mv $N ~/Desktop/tracks
  done }

since () {
  psql -d points -At -F ', ' -c \
    "select $2 from points where time > now() - interval '$1' $3" }