Circumvent Wikipedia’s Blackout with Firefox and NoScript
Today the English version of Wikipedia is blacked out to protest the SOPA legislation that is on the books in the United States. Sources say that people wishing to access Wikipedia can still do so using the mobile version of the site; however, this is unnecessary as they are using simple Javascript to overlay the site content with the “Blacked Out” message.
To access Wikipedia from your computer today:
- Install the most recent version of firefox
- Install the NoScript addon
By default, NoScript blocks all javascript, the code used to blackout Wikipedia is prevented from running.
Read more about NoScript at Lifehacker.
Parse HTML with ActionScript’s EX4
ActionScript includes an EX4 implementation that allows easy parsing of XML in code. I wanted to parse HTML for screen scraping purposes and found that EX4 allows for a syntax that loosely resembles a combination of XPATH and css3 selectors.
Josh’s tutorial provided a very good foundation; however, I was finding that I was having problems doing attribute-based filtering in the case where the attribute name is the same as an ActionScript keyword. This was especially problematic as I needed to filter based on the contents of the HTML element’s class attribute.
After much investigation I found that while the HTML tag names were in the default namespace, the attribute names were not. As a result, If i set a default namespace for the XML parsing, I could not access the attribute values if I listed their names as strings. However, I found if I created a new QName object with a blank namespace, the attributes would be returned as expected.
default xml namespace = new Namespace("http://www.w3.org/1999/xhtml"); var xml:XML = XML(htmlString); var results:XMLList = xml..span.(attribute(new QName(new Namespace(""), "class")) == "foo")
The above will return a list of all span objects with a class attribute of “foo”
Pre-Eden XBMC-live on Ubuntu 10.04 Lucid
I wanted to try out some of the new features in the upcoming XBMC Eden release.
The problem is that I am running XMBC-live on Ubuntu 10.04 Lucid and the Eden xbmc-live package requires the uxlaunch package which is only available in newer versions of Ubuntu. However, it is still possible to get a working xbmc-live setup by manually configuring the system startup.
NOTICE: This guide describes how I was able to upgrade my existing Ubuntu 10.04 XMBC-live system to work with Eden nightlies. I have no idea if this process works on fresh installs or different versions of Ubuntu. If you are running Ubuntu 10.04, I would recommend installing the stable version of XBMC-live prior to attempting this guide.
First, add the XBMC nightly PPA. The official PPA is provided by Team-XBMC and can be found here: ppa:team-xbmc/unstable.
However, at time of writing, the official PPA was having some problems with the build servers, so I ended up using a ppa recommended on XBMCFreak located here: ppa:nathan-renniewaldock/xbmc-nightly.
The first step is to install the new PPA and update your sources.
sudo add-apt-repository ppa:nathan-renniewaldock/xbmc-nightly sudo apt-get update
Next, upgrade the xbmc packages:
apt-get upgrade xbmc xbmc-binDuring this process, some of the old xbmc packages will be removed, including xbmc-data and xbmc-standalone.
Now we should have the new version of xbmc installed, however, when we boot the system, X will not start automatically and we will be left with a login prompt.
The final step is to edit the startup script. This script is located at /etc/init/xbmc-live.conf and probably already exists if you already had a previous version of XMBC-live installed. There is a simple change to make to the script to point it at the new executable.
Open the script:
sudo nano /etc/init/xbmc-live.conf
Scroll down to the script section and change the exec from /usr/bin/runXBMC to /usr/bin/xbmc-standalone:
script
if ! grep -i -q autostart /tmp/xbmcliveParams ; then
exit
fi
exec /bin/su xbmc -c "/usr/bin/startx /etc/X11/Xsession /usr/bin/xbmc-standalone"
end scriptRestart your system and XMBC should come up. Switch to the confluence skin to see the new features.
Here is the full script for completeness:
# xbmc-live # # init XBMC environment and starts XBMC in fullscreen (if asked to do so) # Copyright (C) 2005-2008 Team XBMC # http://www.xbmc.org # # This Program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This Program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with XBMC; see the file COPYING. If not, write to # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. # http://www.gnu.org/copyleft/gpl.html description "XBMCLive" author "Luigi Capriotti" start on (filesystem and stopped udevtrigger) stop on runlevel [06] emits starting-x pre-start script get_opt() { echo "$@" | cut -d "=" -f 2 } clear >/dev/tty7 || true CMDLINE=$(cat /proc/cmdline) #Process command line options XBMC_PARAMS="" for i in ${CMDLINE}; do case "${i}" in xbmc\=*) XBMC_PARAMS=$(get_opt $i) ;; esac done echo $XBMC_PARAMS > /tmp/xbmcliveParams if grep "boot=live" /proc/cmdline ; then # Relies on init scripts to mount boot device on a specified directory BOOTMEDIAMOUNTPOINT="/live/image" fi BOOTHOOKSDIRECTORY="/etc/xbmc" xbmcUser=xbmc # Read configuration variable file if it is present [ -r /etc/default/xbmc-live ] && . /etc/default/xbmc-live if ! getent passwd $xbmcUser >/dev/null; then xbmcUser=$(getent passwd 1000 | sed -e 's/\:.*//') fi # Executes pre-hooks (if any) in the System "Hooks" directory if [ -d $BOOTHOOKSDIRECTORY/live.d ]; then for hook in $(find $BOOTHOOKSDIRECTORY/live.d -type f -perm /u=x,g=x,o=x | sort) do $hook $BOOTMEDIAMOUNTPOINT $XBMC_PARAMS || true done fi # Executes pre-hooks (if any) in the user "Hooks" directory if [ -d /home/$xbmcUser/.xbmc/live.d ]; then for hook in $(find /home/$xbmcUser/.xbmc/live.d -type f -perm /u=x,g=x,o=x | sort) do $hook $BOOTMEDIAMOUNTPOINT $XBMC_PARAMS || true done fi if [ -f /home/$xbmcUser/.xsession ] ; then rm /home/$xbmcUser/.xsession fi if [ -f /tmp/noRestartXBMC ] ; then rm /tmp/noRestartXBMC fi end script script if ! grep -i -q autostart /tmp/xbmcliveParams ; then exit fi exec /bin/su xbmc -c "/usr/bin/startx /etc/X11/Xsession /usr/bin/xbmc-standalone" end script pre-stop script touch /tmp/noRestartXBMC rm /tmp/xbmcliveParams # Clean up the console before we switch to it, to avoid text flicker if [ -x /usr/bin/tput ] ; then tput -Tlinux reset > /dev/tty1 || true tput -Tlinux reset > /dev/tty8 || true fi # Clear VT 1 & 8 of any console messages clear >/dev/tty1 || true clear >/dev/tty8 || true end script
XBMCbuntu ATI Remote Wonder Howto
I recently re-discovered my ATI Remote Wonder and decided to get it working under my Ubuntu Linux XBMC install.
First, install lirc. I selected the option to use the “ATI/NVidia/X10 I II RF Remote” with the kernel (Not userspace) driver, with no transmitter.
sudo apt-get install lirc
My /etc/lirc/lirc.conf file looks like:
include "/usr/share/lirc/extras/more_remotes/atiusb/lircd.conf.atiusb"My /etc/lirc/hardware.conf was generated automatically by debconf during the lirc install. However, for reference it is:
# /etc/lirc/hardware.conf # #Chosen Remote Control REMOTE="ATI/NVidia/X10 I REMOTE="None" II RF Remote" REMOTE_MODULES="lirc_dev lirc_atiusb" REMOTE_DRIVER="" REMOTE_DEVICE="/dev/lirc0" REMOTE_SOCKET="" REMOTE_LIRCD_CONF="atiusb/lircd.conf.atiusb" REMOTE_LIRCD_ARGS="" #Chosen IR Transmitter TRANSMITTER="None" TRANSMITTER_MODULES="" TRANSMITTER_DRIVER="" TRANSMITTER_DEVICE="" TRANSMITTER_SOCKET="" TRANSMITTER_LIRCD_CONF="" TRANSMITTER_LIRCD_ARGS="" #Enable lircd START_LIRCD="true" #Don't start lircmd even if there seems to be a good config file START_LIRCMD="false" #Try to load appropriate kernel modules LOAD_MODULES="true" # Default configuration files for your hardware if any LIRCMD_CONF="" #Forcing noninteractive reconfiguration #If lirc is to be reconfigured by an external application #that doesn't have a debconf frontend available, the noninteractive #frontend can be invoked and set to parse REMOTE and TRANSMITTER #It will then populate all other variables without any user input #If you would like to configure lirc via standard methods, be sure #to leave this set to "false" FORCE_NONINTERACTIVE_RECONFIGURATION="false"
Restart the lirc daemon and run irw and ensure there is output produced:
sudo /etc/init.d/lirc restart # * Starting remote control daemon(s) : LIRC irw # 000000144b760000 00 mouse-right_down SAPPHIRE_ATIUSB_5000023600 # 0000001446710000 00 mouse-right SAPPHIRE_ATIUSB_5000023600
Copy lirc & keymap configuration files into the user XBMC folder (If they do not exist).
#copy Lirc configuration file cd ~/.xbmc/userdata cp cp /usr/share/xbmc/system/Lircmap.xml . #copy remote.xml keymap cd ~/.xbmc/userdata/keymaps/ cp /usr/share/xbmc/system/keymaps/remote.xml .
Edit the XBMC LIRC Configuration File (Lircmap.xml) to contain the following key mappings, ensuring that the device matches the device output by irw.
<lircmap> <remote device="SAPPHIRE_ATIUSB_5000023600"> <play>play</play> <pause>pause</pause> <stop>stop</stop> <forward>forward</forward> <reverse>rewind</reverse> <left>left</left> <left>mouse-left</left> <right>right</right> <right>mouse-right</right> <up>up</up> <up>mouse-up</up> <down>down</down> <down>mouse-down</down> <select>ok</select> <select>mouse_button_left</select> <pageplus>chan-up</pageplus> <pageminus>chan-down</pageminus> <back>mouse_button_right</back> <menu>dvd-root_menu</menu> <title>a</title> <info>launch_setup</info> <skipplus>Skip</skipplus> <skipminus>Replay</skipminus> <display>max-window</display> <start>Start</start> <record>record</record> <volumeplus>vol-up</volumeplus> <volumeminus>vol-down</volumeminus> <mute>mute</mute> <power>power</power> <myvideo>dvd</myvideo> <mymusic>media_library</mymusic> <mypictures>Pictures</mypictures> <mytv>tv</mytv> <one>1</one> <two>2</two> <three>3</three> <four>4</four> <five>5</five> <six>6</six> <seven>7</seven> <eight>8</eight> <nine>9</nine> <zero>0</zero> <star>Star</star> <hash>Hash</hash> <clear>Clear</clear> <enter>Enter</enter> <red>Red</red> <green>Green</green> <yellow>Yellow</yellow> <blue>Blue</blue> <teletext>c</teletext> </remote> </lircmap>
Restart XBMC and you should now have ATI Remote support.
I spent considerable effort attempting to get The Lirc Mouse support working. However, I had no success. I found that X would recognize the LIRC mouse, but wouldn’t find an appropriate driver for it. In the end, I assigned the mouse buttons to the navigation keys via Lircmap.xml.
For the curious I will post the process that I used to get X to the point where it would detect the remote (according to the Xorg log).
The default settings for the lircm daemon wern’t creating the appropriate /dev/lircm which, I believe, prevents X from locating the mouse, so I had to take an alternative approach using the uinput module. It seems that this method has had limited success with others so perhaps it is a system configuration issue with me.
First I configured my /etc/lirc/lircm.conf file with the following contents (the button presses determined from examining the output of irw):
# To find out how to get a proper configuration file please read: # # /usr/share/doc/lirc/README.Debian PROTOCOL IntelliMouse ACCELERATOR 2 30 5 ACTIVATE * ATI MOVE_N * mouse-up MOVE_S * mouse-down MOVE_W * mouse-left MOVE_E * mouse-right MOVE_NW * mouse-up-left MOVE_NE * mouse-up-right MOVE_SW * mouse-down-left MOVE_SE * mouse-down-right
Next I ensured that the START_LIRCMD value is FALSE in /etc/lirc/hardware.conf:
START_LIRCMD="false" #Make sure there isn't a trailing START_LIRCMD in your hardware.conf as there was in mine.
While experimenting I would load the uinput module manually, then start lircmd by hand – however, a working implementation would have uinput in /etc/modprobe.d so it loads automatically, and lircmd in something like rc.conf so it runs automatically.
#Make sure lircd is already running (see above) #load the module and start lircmd for testing: sudo modprobe uinput sudo lircmd --uinput
At this point you’re able to restart X and have it detect the lircm mouse. However, I never got it to properly load the drivers. If anyone knows what I’m missing it would be great if you could post in the comments.
Enable OpenVPN Management Interface on ClearOS
The OpenVPN config file structure on ClearOS is non-standard (For example there is no server.conf), so I was unsure where to put the directive. However, as it turns out enabling the Management console is as simple as adding the following to /etc/openvpn/clients.conf:
management localhost 7505The port is arbitrary: any unused port will do. Localhost restricts connections to the local machine, which is smart if you do not have a password to secure the connection.
To access the management interface using telenet, issue the following from the clearOS box:
telnet localhost 7505 #When the prompt comes up, issue a command such as "status"