Entries Tagged 'Linux' ↓

Listing contents of a tar.gz and extracting one specific directory

# tar -ztvf babyhuiscasita.nl.tar.gz |grep sql
# tar -xzvf babyhuiscasita.nl.tar.gz ./.backup/babyhuiscasita.nl_mysql

-t = list
-x = extract

Asus k53sv & ubuntu power management

Using my new Asus k53sv with Ubuntu 11.10 resulted in 2 hours of battery time. I know the k53 doesn’t have a fancy battery (quite the opposite) but I thought 2 hours was really bad.

With the power regression bug of the Linux kernel in my mind, I started searching. A lot of posts suggested using “pcie_aspm=force”. I tried that by editing the grub menu, but that didn’t really help (at all). dmesg kept complaining about the bios not letting it so that was a dead end.

Phoronix suggested enabling some power options for the i915 chipset (onboard videocard).

So I changed the following in /etc/default/grub:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pcie_aspm=force i915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1"

After a reboot the remaining battery time had changed from 2 hours to a little less than 3 hours. That’s an improvement of almost 50%!

The only downside was that after a suspend (to memory) the screen gets garbled. But after a ctrl+F1 and ctrl+F8 that’s fixed. So I’m actually quite happy know. Thanks Phoronix!

3 useful route commands

To route an ip address through a (vpn) connection:

sudo route add -net XX.192.85.XX netmask 255.255.255.255 gw 192.168.1.1
sudo route add -net 10.76.122.0 netmask 255.255.255.0 gw 192.168.1.1
route -n

Or maybe add a whole range / subnet:

sudo route add -net 95.170.89.0 netmask 255.255.255.224 gw 10.76.122.152

Or maybe dynamic?

route add -net 95.170.89.0 netmask 255.255.255.224 gw `ip addr show ppp0 | awk '/inet/{print$2}'`

Sublime Text 2

I installed sublime text on my Ubuntu 11.10 box but I had some troubled loading external python modules:

loaded 937 snippets
>>> import distutils
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named distutils

This is how I solved it:

Edited ~/.local/share/applications/sublime.desktop
Especially this line:

Exec="/home/leon/Software/bin/sublime" %U

/home/leon/Software/bin/sublime contains this:

#!/bin/bash
cd /usr/lib/python2.7
/home/leon/Software/SublimeText2/sublime_text

Then I installed some excellent plugins:

Chaning the glippy indicator icon

Copy the mono paste icon over to ~/.icons/Humanity/actions/22/edit-paste.svg

 

Using rsync with spaces

Something to never forget again:

rsync --recursive me@remote:'"~/Very complicated path/"' ~/Downloads/

So: single quote, double quote, path, double quote, single quote

The continuing story of Zend Studio 5.5.1

Everytime I install a new version of Ubuntu / Linux I’m hoping Zend Studio (the old/good one) will still be working. So I installed Ubuntu 11.10 and also this time I had to install some stuff to get Zend Studio working.

sudo apt-get install libc6-i386 ia32-libs
ln -s /lib32/libc.so.6 /lib/libc.so.6

And it worked! Know I’m gonna try do update the JRE of the Zend Studio 5.5

ClipIt clipboard manager trayicon under Ubuntu 11.10

In ubuntu 11.04 I had an icon at ~/.icons/Humanity/status/22/gtk-paste.svg so I would get a nice systray icon for ClipIt. But ClipIt changed something so now I had to cp the gtk-paste.svg to:

~/.icons/hicolor/scalable/apps/clipit-trayicon.svg

Then logout/login and I had a nice trayicon! Long live clipboard managers. I _really_ wouldn’t want to miss them!

Install pcntl (pcntl_fork) on Ubuntu Hardy

No apt-getting on Hardy :(

cd ~/
mkdir php
cd php
apt-get source php5
cd php5-*/ext/pcntl
phpize
./configure
make
no=`phpize | grep "Zend Module Api No" | cut -d : -f2 | awk '{gsub(/^ +| +$/,"")}1'`
cp modules/pcntl.so /usr/lib/php5/$no/
echo "extension=pcntl.so" > /etc/php5/conf.d/pcntl.ini

Lsyncd

FreeBSD rsync configI was messing around with some python script to test a spamassassin install. It checks al the mail in the spam folder an see if it is marked as spam. Then it goes through the mail in ham/ and see if it passes as not-spam.

So I’m developing it on my local computer but I wanted to test it on a remote server. Well, actually not that remote because I can touch it from where I’m sitting but that’s not the point :) The point was that I needed something to keep the remote version of the sourcecode in sync with the local source. Google to the rescue and I found lsyncd.

A nice little tool to sync two directories with rsync. Too bad it didn’t support transfers only via sftp because freebsd (the remote server) doesn’t come with rsync installed. So I had to install that also :( Yeah, tough job….

cd /usr/ports/net/rsync
make config
make install

Then on the local machine:

lsyncd --no-daemon --delay 1 ~/Workspaces/spamassassin-test/ beastie:~/spamassassin-test/

You have to specify the remote directory or else it will wipe you home folder as I discovered…

After this was done I could go on developing.