SVN: Get all added/changed files sorted and unique between a specific revision and another specific revison

svn log -v -r 500:562 | grep -E “^\s*[MA]\s” | sed -e “s/ M //” | sed -e “s/ A //” | sort | uniq

HOWTO: Install and use browscap respectively get_browser() for PHP on Ubuntu (Debian)

PHP Manual: http://php.net/manual/en/function.get-browser.php

$browser = get_browser($_SERVER[‘HTTP_USER_AGENT’], true);
print_r($browser);

Download: php_browscap.ini (http://tempdownloads.browserscap.com/)

You can put the file anywhere. I placed it here: /etc/php5/apache2/php_browscap.ini

Edit your: php.ini

[browscap]
; http://php.net/browscap
browscap = “/etc/php5/apache2/php_browscap.ini”

Debian: Change system language

# apt-get update

# apt-get install debconf

# dpkg-reconfigure locales

Replace a string in a file in CLI (Command Line), Linux

For instance, you would like to replace ‘abc’ with ‘def’ everywhere in your file, do the following:

cat file1.txt | sed -e ‘s/abc/def/’ > file2.txt

HOWTO: Install ImageMagick (IMagick) for PHP on Ubuntu

If you don’t have it installed already, install PEAR:

# sudo apt-get install php-pear

Install the Imagick packets:

# sudo apt-get install imagemagick libmagickwand-dev

If you don’t have the PHP5 development packet on your server, you maybe also need to install the following packet:

# sudo apt-get install php5-dev

Now we can install Imagick via PECL:

# sudo pecl install imagick

At this point we have to tell PHP to use Imagick. We can achieve this by putting the following line in the php.ini config file. Just put it at the end of the file. Mine is located at /etc/php5/apache2/php.ini.

extension=imagick.so

We’re nearly done. Restart your Apache2 server now:

/etc/init.d/apache2 restart

That’s it! 😉

Check CPU virtualization capability on Linux

egrep ‘(vmx|svm)’ –color=always /proc/cpuinfo

Howto deliver all messages left in your mailq.

Just type in

sendmail -q

and all your messages left in the mailq will be delivered!

HOWTO: Install the latest version of rTorrent, Ubuntu

Be sure you are root or have sudo rights. At first we try to clean the system, if there’s any older version installed from repository. You can try this:

# sudo apt-get remove rtorrent libtorrent7

On newer systems, like my Ubuntu 9.04 you could try this:

# sudo apt-get remove rtorrent libtorrent11

After this we need to install some packet dependencies and compiling tools.

libTorrent’s README says:

libsigc++ 2.0 (deb: libsigc++-2.0-dev)
g++ >= 3.3

rTorrents README says:

libcurl >= 7.12.0
ncurses

So we try to install the following packets. Maybe they differ at your system version.

# sudo apt-get install build-essential libsigc++-2.0-dev pkg-config comerr-dev libcurl4-openssl-dev libidn11-dev libkadm55 libkrb5-dev libssl-dev zlib1g-dev libncurses5 libncurses5-dev

If you got some old packets, which are useless, you can clean them up using this command:

# apt-get autoremove

Go to your home directory or another directory you like.

# cd ~

Now we download the lastest stable release of libTorrent and rTorrent. You can find them here.

# wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.12.4.tar.gz && wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.8.4.tar.gz

Now we have to extract the files.

# tar -xvvzf libtorrent-0.12.4.tar.gz && tar -xvvzf rtorrent-0.8.4.tar.gz

Configure, Compile & Install:

# cd libtorrent-0.12.4
# ./configure && make && make install
# cd ../rtorrent-0.8.4
# ./configure && make && make install

If there are no errors, we got rTorrent successfully installed. At this point we need a configuration file, a session directory and a torrent directory.

We change to a normal user.

# su your-user-name

We change to his home directory.

# cd ~

Now we create a torrent directory.

# mkdir torrent

In this directory we create a session directory. I make it invisible because we don’t have to access it in the future.

# cd torrent
# mkdir .session

Now we have to create a configuration file. Change to your home directory.

# cd ~
# touch .rtorrent.rc

You can get a default configuration file here. Copy the lines into your configuration file and edit the following two:

directory = /home/your-user-name/torrent
session = /home/your-user-name/.session

Save the file. Now we are finished. You can start rtorrent using this command:

# rtorrent

HOWTO: Install/Configure vsftpd FTP Server on Ubuntu Server

Log in as root or use ‘sudo’ to execute the command as root user.

# apt-get install vsftpd

This will install the FTP Server. Now we have to change the config file. You will find the config file in the /etc directory. Use vim or nano to open and edit this file.

# vi /etc/vsftpd.conf

If you have problems using this editors, you could read this HOWTO for vim, or this HOWTO for nano.

Change the following lines. Be sure to remove the # in front, if there is one, to uncomment the line.

anonymous_enable=NO

This will avoid anonymous FTP Login.

local_enable=YES

This will allow local unix users to use the FTP Server. All User’s can login with their unix user and password via FTP.

write_enable=YES

This will make writing possible for all users.

ftpd_banner=*****

Use any sentence you like instead of the asterisks. This welcome message will be displayed every time a user logs on the FTP Server.

chroot_local_user=YES

Lock each user in it’s home directory. This will prevent, that a user can see files, that do not belong to him.

Now save the config file.

# /etc/init.d/vsftpd restart

In the end you have to restart your new FTP Server, in order to make the config file changes take effect.

Design a site like this with WordPress.com
Get started