Dec 14, 2014
ZoL 0.6.3 introduced the ZFS event daemon, zed. It can execute scripts for every event ZFS generates (see
zpool events). A basic, but pretty useful example: Get a mail including a detailed report every a pool scrub finishes. Of course, anything you can script, you can do. The (small) drawback: At least the ZoL packages for Ubuntu ship without config files, examples and an upstart script for zed.
The config file
zed.rc can be found on github, as well as examples to get you started. Both the rc as well as the scripts go in
This leaves us with a working daemon, but it won't automatically start. Here's a basic upstart file to fix that.
# zed - the ZFS event daemon
description "The ZFS event daemon"
start on local-filesystems
stop on runlevel [!2345]
Put that bit in
/etc/init/zed.conf and you've got zed up and running after reboots.
Dec 05, 2014
Lots of interesting events are being streamed live on the web these days. Unfortunately, most streaming providers use flash players with annoyingly complicated protocols to distribute the video, which makes it hard to view the stream in your favorite player. Luckily for us, there's Livestreamer. Given a URL, it extracts the video and pipes it to a player of your choice.
Livestreamer is written in Python and can be installed using
pip. To be able to access all of its features, a little additional preparation is needed.
In order to access ustream's HD streams, Livestreamer needs python-librtmp, which also is available using
pip. The library needs cffi, so we have to install its dependencies, too. They are
sudo apt-get install python2.7-dev libffi-dev librtmp-dev
After installing those development headers, we can install
sudo pip install cffi
sudo pip install python-librtmp
Once that is done, Livestreamer can be installed.
sudo pip install livestreamer
All of Livestreamer's options are available as CLI switches, but setting your preferred player and stream quality in the config file saves you from having to input them every time.
The config resides in
~/.config/livestreamer/config, a viable minimal config can be found below.
With this config, you can start Livestreamer with a URL as the only argument, and it will start playing the stream in the best available quality in mplayer.
Of course, Livestreamer offers lots of features not mentioned here, including support for sites requiring the user to login before viewing streams, and several options to tweak the streaming behaviour to fit to your hardware, connection and favorite player.
Feb 28, 2014
Since a few days, Amazon's video streaming service is available in Germany. If you're on Linux, you'll be greeted with an error message and will be unable to view videos in your browser, though. This is because Amazon uses Microsoft's Silverlight to deliver the videos. Fortunately for us, there's Pipelight, a one-stop solution for running the Silverlight plugin in Wine and piping the streamed video back to a native browser.
Since the installation, while rather easy, consists of several steps, I'll detail the installation process here.
Add the Pipelight PPA to your sources, update your package list and install pipelight. This is straight from the Pipelight readme.
sudo add-apt-repository ppa:pipelight/stable
sudo apt-get update
sudo apt-get install --install-recommends pipelight-multi
Then, get the latest Silverlight plugin and activate it. You will probably be prompted about some licences, press
Y to accept them.
sudo pipelight-plugin --update
sudo pipelight-plugin --enable silverlight
While now you've got a working Silverlight plugin, Amazon will still refuse to stream to your browser. That's because your browser's user agent betrays the fact you're running Linux.
Installing a user agent switching addon
navigator.UserAgent call. User-Agent JS Fixer takes care of that for us.
Install those two addons, then open UAControl's preferences and add
Firefox 15/Windows: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120427 Firefox/15.0a1 as your new user agent for
amazon.de. Save that and you're done. Enjoy streaming!
Feb 18, 2013
Getting awesome to use the GTK2 and cursor theme you want it to is a matter of simply creating a file named
.gtkrc-2.0 in your home and setting the theme there.
Setting the GTK3 theme is as simple, but the file is
Most GTK apps honor that setting. But X has a default cursor that is used for non-GTK apps. That, annoyingly, includes the desktop background. In order to get X to use the same cursor, you have to run one additional command:
sudo update-alternatives --config x-cursor-theme
That will present you with a list of cursor themes to choose from. Pick your favorite, restart your session and you're set.
Oct 03, 2012
Let's assume foo is a package that I want to configure differently than the package maintainer does, but I don't want to go through the hassle of creating my own build scripts. Luckily, Debian (and Ubuntu) provide a way to use the package maintainer's scripts without the need to do anything yourself but enter a few simple lines into your shell.
The following commands will
- Download the source code of the latest version available for foo into a subdirectory of the current working directory
- Install all the dependencies needed to build foo
- Configure foo more to your liking
- Create installable deb-files while skipping the signing of those files (since you probably don't have the keys to do that anyway)
Notice that you don't need root for any of those commands!
apt-get source foo
apt-get build-dep foo
dpkg-buildpackage -b -us -uc
If you want to, you can increase the version number of foo after configuring it by editing the debian/changelog file. Just copy the previous entry and adjust to reflect your changes.
Sep 11, 2012
Static blogs are all the rage now, and while setting up one of these is not as easy as registering an account on tumblr, it still isn't rocket surgery.
In addition to using the latest and greatest in publishing technology, you have the added benefit of not needing any executable code on your server. All the work — like generating the HTML files served later — is (or can be) done locally, on your own machine.
Since I like python, I decided to use pelican as generator, so the machine you want to use it on should have python installed. Their quickstart is actually pretty good, but since it doesn't cover using distribution-provided packages when available, I figured I'd document my approach here.
Let's get started. My machine runs Ubuntu 12.04, but most commands should work on any halfway recent linux installation, even though some paths might differ.
Setting up virtualenv
In order to not install any python eggs systemwide, we start by setting up a virtual environment for all of pelican's dependencies to live in.
Install the needed programs
sudo apt-get install python-virtualenv virtualenvwrapper
Add those lines to your shell's resource file (e.g.
~/.bashrc) and rehash your shell (
source ~/.bashrc should do the trick).
Create a virtual environment for pelican and associate it with the directory your blog is stored (I will use
~/blog from now on).
mkdir ~/blog && cd $_
Installing and initializing pelican
Install pelican and, optionally, Markdown. I recommend using
pip to do so.
pip install pelican Markdown
Initialize your blog by answering a few questions. Afterwards, you're done.
In order to locally test your new blog, I recommend using python's builtin web server. pelican includes a script to automatically watch your content directory, building new files and serving them using said server. Unfortunately, this script didn't work out of the box on my machine. But don't worry, it's a rather trivial fix. Replace line 4 of the script with
and line 7 with
Writing your first blog post
More, you say? Alright then. Here's how to write your first blog post: Create a text file in
~/blog/content/. The name, depending if you're using reStructuredText or Markdown, should end with
.md respectively. This small example should get you started.
Title: My first blog post
Everything but the title tag is optional, anything that's not a tag is turned into content.
Let pelican do its magic and visit http://localhost:8000 afterwards.
Upload the generated files (located in
~/blog/output) to a webserver of your choice — or let pelican handle that, too.