Los Leones Hiking Trail

Los Leones Hiking Trail

Went for a hike today in the Pacific Palisades at the Los Leones (or Los Liones) hiking trail.

It was relatively easy and definitely worth the (~1 mile) climb to the first lookout. The trail does zig-zag a lot, but there’s ample shade and rest areas along the way. The only part where it gets a little sunny and uncovered is just before you reach the 1st outlook. There isn’t really any shade or covering there (there is a lower outlook near this one with shaded area that was good for picnicking), but you wouldn’t want to miss the view. It’s a great way to see very far down the pacific coastline (Venice, Santa Monica Pier, and Manhattan Beach), out towards LA (the city skyline is smoggy, but it’s there) and of course out into the shimmering pacific ocean.

Parking: 2 lots, plenty of street parking, prepare to do some parallel parking if necessary.

Scenery: as I mentioned: worth it.

Difficulty: Medium, the path is narrow and there are inclines going up, but it isn’t too difficult.

There’s a lot more information on the Yelp page, and I won’t drag on with anymore detail except it’s a worthwhile hike with great scenery.

Dayone/Tumblr to WordPress Migration

I have used Dayone Journaling app on and off since 2012, but ever since I got my home server running, I have been trying to consolidate my data under my own control (dropbox to own cloud, iPhotos/Flickr to Plex, evernote to mediawiki, etc.).

Tumblr is another story as I created a tumblr for the JOH2013 trip to post my progress for the public, but I now realize I don’t want it out there that much anymore. Not to mention a lot links to my data are breaking as I have moved away from Flickr to iPhoto and now to Plex Photos (photo curation is just a whole other beast).

WordPress seemed like a good options for consolidating journal entries and blogs in one convenient (and actually secure) location. Not only do I control where the data is at, but how it is accessed and posted.

The failings of security behind Dayone are just too good to not mention…the whole password/passcode setup for all of their applications are just a UI facade for security. The Dayone journal files are actually just in a flat text file format. These files are then just shuffled around (depending on storage medium: iCloud, Dropbox, local) and manipulated by the application. Also, if you forget your passcode/password to that file, Dayone support (used to)¬†basically shows you how to basically wipe the password from the file by deleting the “security.plist”. Really basic and no encryption what-so-ever.

Tumblr on the other hand, I have decided to just move my personal blogging “home” and to a platform I can’t fine tune and have complete control over.

The point of this post was to¬†“admire” my nifty script that scraped the exported Dayone journal, (which was supposed to be in some markdown form, but turned out to simply be a text file with a lot spaces and returns), organized the post in sections, then utilized a WordPress command base to automatically create posts from that content.

#!/bin/bash

DATE=""
TITLE=""
LOCATION=""
WEATHER=""
TAGS=""
CONTENT=("")
TEMPFILE="TEMP.txt"
parseTags()
{
	for word in $1
	do
		TEMP="$(echo $word | sed 's/,//')"
		TAGS="$TAGS #$TEMP"
	done
}
parseDate()
{
	MONTH=""
	DAY=""
	YEAR=""
	for word in $1
	do
		case $word in
			"January")
				MONTH="01"
				;;
			"February")
				MONTH="02"
				;;
			"March")
				MONTH="03"
				;;
			"April")
				MONTH="04"
				;;
			"May")
				MONTH="05"
				;;
			"June")
				MONTH="06"
				;;
			"July")
				MONTH="07"
				;;
			"August")
				MONTH="08"
				;;
			"September")
				MONTH="09"
				;;
			"October")
				MONTH="10"
				;;
			"November")
				MONTH="11"
				;;
			"December")
				MONTH="12"
				;;
			"1,")
				DAY="01"
				;;
			"2,")
				DAY="02"
				;;
			"3,")
				DAY="03"
				;;
			"4,")
				DAY="04"
				;;
			"5,")
				DAY="05"
				;;
			"6,")
				DAY="06"
				;;
			"7,")
				DAY="07"
				;;
			"8,")
				DAY="08"
				;;
			"9,")
				DAY="09"
				;;
			*",")
				DAY="$(echo $word | sed 's/,//')"
				;;
			"20"*)
				YEAR="$word"
				;;
			*)
				;;
		esac
	done
	DATE="$YEAR-$MONTH-$DAY"
}
parseFile()
{
	CONTROL=0
	cat $1 | while read line
	do
		case $line in
			"Date:"*)
				if [ $CONTROL -eq 1 ]; then
					createPosts
				else
					CONTROL=1 #Indicate start of entry
				fi
				TEMP="$(echo $line | sed 's/Date://')"
				parseDate "$TEMP"
				;;
			"Tags:"*)
				TEMP="$(echo $line | sed 's/Tags://')"
				parseTags "$TEMP"
				;;
			"Location:"*)
				LOCATION="$line"
				;;
			"Weather:"*)
				WEATHER="$line"
				;;
			"Photo:"*)
				;;
			*)
				CONTENT=("${CONTENT[@]}" "$line")
				;;
		esac
	done
}

createPosts()
{
	touch "$TEMPFILE"
	TITLE="\"${CONTENT[2]}\""
	TITLESIZE=${#TITLE}
	if [ $TITLESIZE -gt 60 ]; then
		TITLE="\"RENAME ME - $DATE\""
	fi
	for LINE in "${CONTENT[@]}"
	do
		echo "$LINE" >> "$TEMPFILE"
	done
	if [ -n "$LOCATION" ]; then
	echo "$LOCATION" >> "$TEMPFILE"
	fi
	if [ -n "$WEATHER" ]; then
		echo "$WEATHER" >> "$TEMPFILE"
	fi
	if [ -n "$TAGS" ]; then
		echo "$TAGS" >> "$TEMPFILE"
	fi
	eval sudo -u apache /usr/local/bin/wp post create $TEMPFILE --user=cgomez --post_title="$TITLE" --post_date="$DATE" --post_category=116 --post_status=private
	eval rm -f $TEMPFILE
	DATE=""
	LOCATION=""
	WEATHER=""
	TAGS=""
	CONTENT=("")	
}

if [ -z $1 ]; then
	echo "No File Detected. Exiting."
	exit 1
fi

if [ ! -f $1 ]; then
	echo "File doesn't exist. Exiting."
	exit 1
fi

parseFile $1

exit 0