XBMC's home screenThis is an update to an older post: My perfect TV setup

I recently upgraded the whole media consumption set-up in my apartment. This post describes all of the different aspects, hardware and software components in use.

Hardware

  • Mac Mini – this is the main hub of the whole operation. It sits in my living room, connected to sound system and projector.
    Specs: 2.3GHz i5, 2GB RAM, 500GB HD, Intel HD 3000 Graphics.
  • Apple TV – the new 1080p one. Connected to the LCD TV in my room.
  • iPad – also the new one.
  • Projector – still the same old one that won’t die. Only 720p, but I refuse to replace it before it has reached the end of it’s lifetime.
  • Logitech Harmony – universal remote to control the cable box, sound system, projector and XBMC (via Mac Mini’s infra red port) in the living room.
  • 2TB harddisk – connected to Mac Mini via USB.
  • 2x AirPort Express – connected to speakers in the kitchen and bathroom.

Software on Mac Mini

  • XBMC – with it’s recent Eden release and a few configuration tweaks the perfect, easy to use frontend for all my movies & TV shows.
  • Transmission – Torrent client with a nice web based remote frontend.
  • Catch – to automatically download new TV show episodes.
  • Air Media Server – serves media to iOS devices.
  • AirServer – receives AirPlay streams from iOS devices.

Software on iOS

Continue reading

If an object is converted to an array, the result is an array whose elements are the object‘s properties. The keys are the member variable names, with a few notable exceptions: private variables have the class name prepended to the variable name; protected variables have a ‘*’ prepended to the variable name. These prepended values have null bytes on either side. This can result in some unexpected behaviour.

Source: http://www.php.net/manual/de/language.types.array.php#language.types.array.casting

No kidding? This must be one of the most stupid decisions ever in the whole language of PHP. Why pad some array keys with NULL BYTES? I mean, how can anyone ever be expected to find that out, by looking at the data the script writes out? This makes absolutely no sense whatsoever.

Just spent around an hour hunting this down!

I hope this post will save someone else the amount of hassle this has caused me.

Klout logoI’ve recently succumbed to peer pressure and registered myself in the vanity game called Klout.
What it does is basically tell you how “influential” you are across several different social networking channels (mainly Twitter and Facebook) and how far your “reach” is.

I have to admit, it is kind of fun to see your own scores progress over the weeks. I couldn’t say if this is actually a deterministic way to tell if somebody is a person you should listen to (at least for the topics he’s listed as influencer on Klout), or if this is just another way beyond follower-/friends-counts to stroke ones ego, but it provides some nice insights about the topics you converse about online.

Klout features two more interesting things I’d like to point out:

  • Topics: Pages about different topics, who talks about them and who are the top influencers in that field.
  • Perks: Depending on your score, you can get gifts or discounts from numerous companies around the world. Now that’s what I call motivation to communicate online 🙂

Bash

Update: You can now find all of my .dotfiles on GitHub.


 

Find below my “.bash_profile" file in OS X Lion and the referenced “.bash_ps1" (slightly modified from lifehacker).

Detailed walkthrough

  • add some additional directories to PATH
  • reference .bash_ps1 (see the file below)
  • set grep and ls to display some fancy colors
  • two aliases to often used commands
    • order top by CPU usage
    • display more human readable directory listing output
  • Set Textmate’s “mate” command as the default editor
  • Ignore duplicates in history. E. g. if I issue “ls” multiple times, it only occurs once when I press the cursor up key, to cycle through my last commands.
  • Export DISPLAY environment variable if it’s not already set. This helps with X-forwarding from remote systems.
  • SSH host completion lets me type the first few characters of any host I already connected to successfully and completes it just like normal shell commands or files after pressing TAB.
  • The “myip” function lets me look up my external IP.
  • “git_stats” spits out detailed infos about any git repository you issue this command in.

.bash_profile

export PATH=$PATH:~/bin:/usr/local/bin:/usr/local/sbin:/usr/local/git/bin

# set fancy prompt
if [ -f "$HOME/.bash_ps1" ]; then
    . "$HOME/.bash_ps1"
fi

# some settings to be more colorful
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
export CLICOLOR=true
export LSCOLORS=ExGxFxdxCxDxDxBxBxExEx

# handy aliases
alias top='top -o cpu'
alias ll='ls -lh'

# use Textmate as default editor
export EDITOR="mate"

# no duplicates in bash history
export HISTCONTROL=ignoredups

# export DISPLAY if it's not set yet
[[ -z $DISPLAY ]] && export DISPLAY=":0.0"

# ssh host tab completion
complete -W "$(echo `cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e s/,.*//g | uniq | grep -v "\["`;)" ssh

################################################
# bash functions
################################################
function myip {
  res=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+')
  echo "$res"
}

function git_stats {
# awesome work from https://github.com/esc/git-stats
# including some modifications
if [ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]; then
    echo "Number of commits per author:"
    git --no-pager shortlog -sn --all
    AUTHORS=$( git shortlog -sn --all | cut -f2 | cut -f1 -d' ')
    LOGOPTS=""
    if [ "$1" == '-w' ]; then
        LOGOPTS="$LOGOPTS -w"
        shift
    fi
    if [ "$1" == '-M' ]; then
        LOGOPTS="$LOGOPTS -M"
        shift
    fi
    if [ "$1" == '-C' ]; then
        LOGOPTS="$LOGOPTS -C --find-copies-harder"
        shift
    fi
    for a in $AUTHORS
    do
        echo '-------------------'
        echo "Statistics for: $a"
        echo -n "Number of files changed: "
        git log $LOGOPTS --all --numstat --format="%n" --author=$a | cut -f3 | sort -iu | wc -l
        echo -n "Number of lines added: "
        git log $LOGOPTS --all --numstat --format="%n" --author=$a | cut -f1 | awk '{s+=$1} END {print s}'
        echo -n "Number of lines deleted: "
        git log $LOGOPTS --all --numstat --format="%n" --author=$a | cut -f2 | awk '{s+=$1} END {print s}'
        echo -n "Number of merges: "
        git log $LOGOPTS --all --merges --author=$a | grep -c '^commit'
    done
else
    echo "you're currently not in a git repository"
fi
}

.bash_ps

############################################
# Modified from emilis bash prompt script
# from https://github.com/emilis/emilis-config/blob/master/.bash_ps1
###########################################
fill="--- "
reset_style='\[\033[00m\]'
status_style=$reset_style'\[\033[0;90m\]' # gray color; use 0;37m for lighter color
prompt_style=$reset_style
command_style=$reset_style'\[\033[1;29m\]' # bold black
PS1="$status_style"'$fill \t\n'"$prompt_style"'${debian_chroot:+($debian_chroot)}\[\033[0;32m\]::>'"$command_style "
# this is invoked every time before a command is executed
trap 'echo -ne "\033[00m"' DEBUG

function prompt_command {
    let fillsize=${COLUMNS}-9
    fill=""
    while [ "$fillsize" -gt "0" ]
        do
            fill="-${fill}" # fill with underscores to work on
            let fillsize=${fillsize}-1
        done
}
export PROMPT_COMMAND=prompt_command

Click here to see the ifttt tasks

Click here to see the Mail Rule

This is kind of a stripped down version of Read It Later or Instapaper, but functions perfectly for my workflow.

Requirements

  • Apple Mail
  • Apple Safari (with Reading List Support)
  • ifttt Account

First I’ve set up actions in ifttt that forward Links I favorite in Twitter or Google Reader, to my personal Email and prepend the subject with “#ReadLater”. Next I constructed a Mail Rule that acts on all messages who’s subjects begin with said keyword. The Mail Rule will invoke the following Applescript, mark the message as read and move it to the trash.

using terms from application "Mail"
	on perform mail action with messages theSelectedMessages
		tell application "Mail"
			repeat with eachMessage in theSelectedMessages
				set mailbody to content of eachMessage
				set theUrl to paragraph 1 of mailbody
				tell application "Safari"
					add reading list item theUrl
				end tell
			end repeat
		end tell
	end perform mail action with messages
end using terms from

Use cases

  • Read newsfeeds on iPhone. Save longer or interesting articles for later by clicking the favorite star.
  • Interesting item pops up on twitter, but you don’t have time now to read the containing link right now.
  •  While walking in the street you see a URL you want to remember, just mail it to yourself with the appropriate keyword in the subject.