Skip to content

Instantly share code, notes, and snippets.

View tchen's full-sized avatar
:shipit:

Tom Chen tchen

:shipit:
  • Dallas, TX
View GitHub Profile
@tchen
tchen / gist:ed9f319c2c5736a8e985
Created June 18, 2015 16:10
Helpful functions
# Tuple abs val
def tup_abs(t):
return math.sqrt(t[0]*t[0] + t[1]*t[1] + t[2]*t[2])
# Look for attributes of an object
# Find s in attributes of o
def find_attr(o, s):
import re
regex = re.compile(r'.*'+s+'.*')
return [ at for at in dir(o) if regex.match(at) is not None ]
@tchen
tchen / gist:3eb9f58041d3765cb9df
Last active August 29, 2015 14:12
XBMC autostart.sh
To automatically do something at start up of OpenElec, place a shell script at /storage/.config/autostart.sh.
For example, to start playing a playlist at start up, you can place the following in autostart.sh, which will launch a different script in the background (and release, so XBMC will start):
#!/bin/sh
play_videos.sh
This is the content of play_videos.sh, which checks to see if xbmc is running first, and then release. Waits about 20 seconds to ensure XBMC started up completely, then play the video playlist:

Forward X11

vagrant ssh -- -Y

Installing Pillow

Installing Pillow under Ubuntu & virtualenv is pretty simple. It's just:

pip install Pillow

However, getting the support for the image formats might take some guess work. The following takes that guess work out for you. Install the library listed with apt-get install to get the needed support for the image format.

  • TKINTER - tk8.6-dev tcl8.6-dev python-tk