Tuesday, April 10, 2012

ATI Mobility Radeon HD 5xxx Series in Linux (kernel 3.2.14)

I will try to explain how I got to install the AMD Catalyst™ 12.3 Proprietary Linux x86 Display Driver and avoid all the installation problems with the Kernel 3.2.14.

In the beggining I was getting this error:

# vim /usr/share/ati/fglrx-install.log
1
2 Creating symlink /var/lib/dkms/fglrx/8.85/source ->
3 /usr/src/fglrx-8.85
4
5 DKMS: add Completed.
6
7 Kernel preparation unnecessary for this kernel. Skipping...
8
9 Building module:
10 cleaning build area....
11 cd /var/lib/dkms/fglrx/8.85/build; sh make.sh --nohints --uname_r=2.6.38-2-6 86 --norootcheck.....(bad exit status: 1)
12 0
13 0
14 [Error] Kernel Module : Failed to build fglrx-8.85 with DKMS
15 [Error] Kernel Module : Removing fglrx-8.85 from DKMS
16
17 ------------------------------
18 Deleting module version: 8.85
19 completely from the DKMS tree.
20 ------------------------------
21 Done.
22 [Reboot] Kernel Module : update-initramfs

To avoid this problem I uninstalled the program dkms. I have to say that I don't know what is for this program and if you need it you can try to reinstall it after finishing the installation of the ATI driver.

Saturday, January 21, 2012

Caps lock indicator in Linux / Gnome2

If we want to add a caps lock indicator in the Gnome2 panel (that one that shows the clock) there is one easy alternative. We can install the package lock-keys-applet.

$ sudo apt-get install lock-keys-applet
$ killall gnome-panel


Once we have done this, we can add to the panel the new element doing right click in the panel, "Add to panel" and then choose the "Lock Keys" applet.

Source
http://ubuntuforums.org/showthread.php?t=1224918

Sunday, January 1, 2012

Subversion quick configuration

1.1 Create a folder to hold all repositories
$ mkdir ~/.svnroot

1.2 Create a repository
$ svnadmin create ~/.svnroot/project

2.1 Import the repository to work with it (only necessary to do it once)
$ svn checkout file:///home/pron/.svnroot/project

2.2 Create the main structure (only necessary to do it once)
$ cd project
$ mkdir trunk tags branches

3. Activate daemon to allow access to Subversion repositories using the svn network protocol
$ svnserve -d -r ~/.svnroot

4.1 Make a backup of a repository
$ svnadmin dump -q ~/.svnroot/project > project.dump

4.2 Restore a backup
$ svnadmin create project
svnadmin load project < project.dump

5.1 Creating a version
$ svn copy file:///home/pron/.svnroot/project/trunk \
> file:///home/pron/.svnroot/project/tags/v0.1 \
> -m "Creating v0.1 with the right command"

6.1 Recover the last version of a file that has been saved but no commited
$ rm file
$ svn up file


6.2 SVN Diff against changes in the remote repository 
$ svn diff -r HEAD

6.3 How to ignore a directory with SVN
$ svn propedit svn:ignore .

If you have multiple things to ignore, separate by newlines in the property value. In that case it's easier to edit the property value using an external editor:
$ svn propset svn:ignore dirname .

6.4 Getting SVN revision number into a program automatically
Add this code to your file (i.e. file.py)
VERSION='$Rev$'

After this, in the command line write this:
$ svn propset svn:keywords "Revision" file.py


Resources
http://svnbook.red-bean.com/en/1.1/ch04s06.html
http://stackoverflow.com/questions/116074/how-to-ignore-a-directory-with-svn http://stackoverflow.com/questions/1449935/getting-svn-revision-number-into-a-program-automatically

Unixtime quick usage - Seconds to date

1.1 Get unixtime in the console
$ date +%s


1.2 Get unixtime in python
>>> import time
>>> int(time.time())


2 Unixtime to date in the console
$ date -d "UTC 1970-01-01 1294779314 secs"

or
$ date -ud @1294779314


Resources
http://en.wikipedia.org/wiki/Date_(Unix)
http://www.linuxhowtos.org/Tips%20and%20Tricks/converting_unixtimestamp.htm

GPG quick usage

1. Encrypt a file with public key
$ gpg --encrypt --recipient 'Your Name' foo.txt


2.1 Decrypt a file with private key (using the password in the commandline)
$ gpg --output foo.txt --passphrase "$_PASS" --decrypt foo.txt.gpg


2.2 Decrypt a file with private key (not using the password in the commandline)
$ gpg --output foo.txt --decrypt foo.txt.gpg


Resources
http://www.madboa.com/geek/gpg-quickstart/
http://aperiodic.net/phil/pgp/tutorial.html

Add a existing user to existing group (usermod)

If we want to add the existing user pron to the existing group vboxusers, we can execute this command:

$ usermod -Ga vboxusers pron


Is neccessary to put -a, otherwise other groups will be erased. To see changes type:

$ id


Resources
http://www.cyberciti.biz/faq/howto-linux-add-user-to-group/

Thursday, June 23, 2011

Aliasing cd and ls

In the Linux console, is a common action to list directory content (ls), once entered into that folder (cd). Thus, it would be more efficient to join those 2 command into 1.

We can do this adding the next code into ~/.bashrc file:

function cl {
if [ "$1" == "" ]
then
cd
else
cd $1
fi
ls
}
alias cd='cl'


Therefore if we open a new console and we type 'cd <directory>', it will execute 'cd <directory>' and 'ls', respectively.

Resources
http://www.unix.com/shell-programming-scripting/16318-cd-then-ls-l.html
http://www.linuxforums.org/forum/newbie/161327-aliasing-cd-ls.html