Skip to content

Entries from October 2012.

EL6 power usage optimisation on Intel Sandy & Ivy Bridge

So you finally bought that fancy new laptop with a SandyBridge or IvyBridge chip, but the power usage goes through the roof when you use it on Linux? Well, there are a couple of things you could do:

1. Enable some nice features such as a lower power usage state capability of the Intel GPU (if you use the integrated Intel 3000/4000), frame buffer compression and optionally down-clock the LVDS refresh rate. Also, you can force PCI-Express to enable "ActiveState Power Management" which can save further power - just append the following to the kernel command line (in /boot/grub/grub.conf):
i915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1 pcie_aspm=force


2. Install and tweak tuned. Tuned is a Fedora utility responsible for tuning your system's power settings.
yum install tuned
service tuned start
service ktune start
tuned-adm profile laptop-battery-powersave


If you want to get even more serious about power saving, then the powertop program is very useful, too. For a graphical tool focused on power management have a look at Jupiter.
Feel free to play around with the settings and read the man pages for more information.
Be careful as some of these settings may cause some issues or instabilities. Use at your own risk.

Instant image gallery with Apache's mod_autoindex and fancybox

For some time now I've been using Google's Picasaweb for sharing some photos with friends and relatives, however in the recent years I've been trying to distance myself from Google's services and run my own since I have the know-how and the resources, plus Picasaweb has a ridiculously small quota - 1 GB.
As such I've decided to just put the images in some directory online and let mod_autoindex list them, but this kind of listings can be hard to browse since you have to go back all the time for a new image's link - and here's where fancybox is useful.
fancyBox is a tool that offers a nice and elegant way to add zooming
functionality for images, html content and multi-media on your webpages.
It is built at the top of the popular JavaScript framework 
jQuery and is both easy to implement and a snap to customize.


And here's what needs to be done:
1. Create a directory called fancybox in the root directory of your web site
2. Download https://github.com/fancyapps/fancyBox/zipball/v2.1.3 and upload the source and lib directories from it to the directory we created at step 1
3. In the same fancybox directory create a HTML file called fancybox.html with the following contents: http://img.nux.ro/fancybox/fancybox.txt
4. Upload your directory containing the pictures to the web site
5. Create in the said directory an .htaccess file with the following contents:
Options +Indexes
ReadmeName /fancybox/fancybox.html
6. You're done, you can now browse to www.yourwebsite.tld/imagedirectory and enjoy the experience

Here's a demo: http://img.nux.ro/tuxwallpapers/

Voila! A nice, simple gallery involving no server-side scripting languages, just using the powerful Apache server and Javascript.
Credits go to Matt who's blog post gave me the idea and my friend Adrian who suggested fancybox and helped adjusting the Javascript code to my needs (since I have zero js skills). Thanks!