Donnerstag, 20. Dezember 2012

Number of pages inside a pdf

$ grep -o "'Page[0-9]*'" your.pdf | tail -1 | grep -o "[0-9]*"

Freitag, 9. November 2012

wildcard && brace expansion -eq <3

mplayer *s05e0{1,2,3}*

Queues the following files:
xyz.s05e01.someformat
abc.s05e02.someotherformat
123.s05e03.format
...

Check http://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html

Montag, 22. Oktober 2012

undefined symbol: apr_reslist_maintain after upgrading httpd on Slackware 13.37

After upgrading apache to the latest patch (ftp://ftp.slackware.com/pub/slackware/slackware-13.37/patches/packages/) you get that error: "/usr/sbin/httpd: symbol lookup error: /usr/sbin/httpd: undefined symbol: apr_reslist_maintain" when starting httpd / apache.

In order to resolve it you have to update apr (Apache Portable Runtime, makes sense, huh? ;)) and apr-util to the latest patched versions (get them here ftp://ftp.slackware.com/pub/slackware/slackware-13.37/patches/packages/).

Donnerstag, 18. Oktober 2012

Dienstag, 25. September 2012

Show single image with xlock

Took me a while to figure out how to simply show an image when locking with xlock:

$ xlock -mode image -bitmap image.xpm -count 1

-mode image: sets the mode to only display random sun images
-bitmap image.xpm: replace the random sun images with image.xpm (*)
-count 1: sets the amount of images that shall be shown at the screen at once to 1

* use ImageMagicks 'convert' method to convert to xpm: $ convert input.jpg output.xpm

Have fun!

Mittwoch, 4. Juli 2012

x121e Cardreader (rtl_pstor) - Kernel 3.4.4 menuconfig

Took me a while to figure out where the driver for my cardreader resides. In menuconfig go this path:

Device Drivers -> Staging drivers

and check this one, either as module or builtin:


RealTek PCI-E Card Reader support

Freitag, 22. Juni 2012

Easy rounding with Javascript round() wrapper

Really simple method to easily round with javascript:
function round (number, fractionalDigits) {
    "use strict";
    if (!number) {
        return; 
    }
    var multiplicator = 1;
    while (fractionalDigits--) {
        multiplicator *= 10;
    }
    return Math.round(number * multiplicator) / multiplicator;
}

Just pass in the number to round and the number of fractionalDigits you'd like to keep, like:
round(95.12345, 2); will return 95.12
round(95.54555, 4); will return 95.55

If you omit the last param, you'll get no fractionalDigit, like:
round(95.12345); will return 95
round(95.50000); will return 96

One last call: Don't use it as is, create a namespace for it to reside in! 


Or append it to Number, then you can remove the number param. ;)
Number.prototype.round = function(fractionalDigits) {
    "use strict";
    var multiplicator = 1; 
    while (fractionalDigits--) { 
        multiplicator *= 10; 
    } 
    return Math.round(this * multiplicator) / multiplicator;
}

Call it like:
var number = 8.12345;
number.round(2); will return 8.12


Have fun! 

Donnerstag, 21. Juni 2012

Aw, snap when searching with omnibox on chromium

For some days now I get that annoying "Aw, snap" window when I try to search with the omnibox in chromium. What I tried so far:
- clear /tmp
- rm ~/.config/chromium
- rm ~/.cache/chromium
- install another version (19, 20, 21..)

Nothing helped. In a fit of despair I rushed to the settings and checked "Enable Instant for faster searching" (even if I really really don't like that feature). This seems to be a good workaround because the "Aw, snap" page stays away...

Montag, 18. Juni 2012

No longer Skype beta on Linux - Skype 4.0!

Skype 4.0 has been released.
Of course, there's no Slackware-Package available from the Skype homepage. (Who knew? ;))

If you want to upgrade to Skype 4.0 today, you can use this Source-Package:
http://download.skype.com/linux/skype-4.0.0.7.tar.bz2

and build it by using this SlackBuild:
https://github.com/willysr/SlackHacks/tree/master/SlackBuild

The SlackBuild script linked above has also been submitted to slackbuilds.org, but currently it's in the pending queue (and I've seen script in the pending queue for about two months, so don't count on that :)).

NOTE: If you're on a 64 bit Slackware you need to add 32 bit librarys. See this page for further information: http://www.linuxquestions.org/questions/slackware-14/skype-4-0-on-slackware-13-37-64bit-4175411533/

Have fun... well, you have fun, I mean, you're using Slackware. :)

Edit: Ahh, finally there's a fresh, warm, approved Slackbuild available.

Sonntag, 10. Juni 2012

Beat me! (laptop power consumption)


Settings:
- Display off (don't know why backlight still consumes power, any suggestions?)
- wifi blocked via rfkill
- powersave governor
- disabled cpu 123, only 0 active (on the fly)
- hdparm -B 1 -S 1
- vm writeback (60 seconds, stock Slackware)
- disabled fan (loading thinkpad_acpi module via options thinkpad_acpi fan_control=1 (yeah, I cheated :)))
- mounted root with 'relatime' param to reduce disk spin-up
- enabled GPU RC6 mode via kernel params (pcie_aspm=force acpi=noirq i915.i915_enable_rc6=1)

Look at the right to see what laptop I use!

Freitag, 17. Februar 2012

No need for temporary variable (Javascript)

Assume you have a function, and that function has a param (called 'config' herein) which may be a string or an object. Inside your function, you check for the type and if it's a string, you want to make this strings value a property of your object.

My first, fast approach was this one:
var url = config;
config  = {};
config.videoLink = url;

My second approach looked like this:
var url = config;
config  = {videoLink: url};

I thought about what's happening in those statements and realized that the temporary variable 'url' is not needed, because javascript is executing the assignement from right to left, means I can override 'config' with an object that keeps the original value of config as a property. See this third & final approach:
config = {videoHash: config};

So Javascript builds the object, assigns the value of config (string) to videoHash and assigns this object to config, which now is a object as desired.

Mittwoch, 1. Februar 2012

xfce4-screenshooter 1.7.9 - Segmentation Fault on startup

When starting xfce4-screenshooter, there's an segmentation fault message and it (of course) doesn't start up. The solution is pretty simple:

touch ~/.config/xfce4/xfce4-screenshooter

Source: http://www.linuxquestions.org/questions/slackware-14/where-to-get-xfce4-8-goodies-etc-885538/#post4382696

Samstag, 21. Januar 2012

wicd-gtk / wicd-client (tray) not starting, glib.GError: Unable to connect to server

Start wicd-client with '-n' - disable notifications and everything is fine. See source below if you want to use notifiations:

Source: https://bbs.archlinux.org/viewtopic.php?id=108666

Freitag, 13. Januar 2012

Headphonejack not working on x121 w. Slackware 13.37 - Kernel 2.6.37-6

Use alsaconf to create config file. Edit the created config file /etc/modprobe.d/sound.conf , add the following line:


options snd-hda-intel model=thinkpad

Save and either reload modules or reboot.

Montag, 9. Januar 2012

Montag, 2. Januar 2012

Building latest Chromium on Slackware

Nice Slackbuild on Github, frequently updated:
https://github.com/yucatan/chromium

Edit: Don't forget to replace make with make -j2 in file chromium.SlackBuild on a dualcore system to use both cores. :)

Sonntag, 1. Januar 2012