I have been using Linux on my laptop since 2007 ( and since 2006 on my Desktop) and this is how my journey has been. The graph is just a chronological depiction of the distros I have used and the learning curve involved. It does not intend to show the superiority of one distro over the other. I have also tried out a few variants of BSD , but forgot to include them. This will be followed by a description of how I got to use the various distros and the experience I gained through them. As I am completely jobless nowadays, you can expect the description very soon !!
My journey with Linux and the learning curve
- Add new comment
- 26 reads
creating pdf docs of source code ( for printing)
Have you ever felt that you could read the code better had it been in the form of a pdf, if yes then here is a simple method to convert files in a given directory into PDF documents using the tool highlight. Highlight can be installed on Fedora and Debian/Ubuntu using the following respective commands :
yum install highlight
apt-get install highlight
Now the process involves two steps :
- Use highlight to convert the source code files into tex files.
- Use tex and dvipdf to transform the tex files into PDF files.
To convert all the source files in the current directory into tex run the following command :
highlight --force * -l -T -o ./
once this is done you will have new files generated ending in .tex . Now we have to convert the files into PDFs which can be done using the following simple script :
#!/bin/bash
for file_name in *.tex
do
file_new=$(basename $file_name .tex)
tex $file_new
dvipdf $file_new.dvi
echo " "
echo " "
echo "Cleaning Up ..... "
rm $file_new.log $file_new.aux $file_new.dvi
echo " "
echo " "
if [ "$@" = "-o" ]
then
echo " Opening the Pdf file "
evince $file_new.pdf
fi
doneFollowing this you will find PDF docs of the source code. Ping me back if this method does not work.
- Add new comment
- 19 reads
The Leonidas : the roar of FLOSS ( Fedora 11)
The Announcement
"Ladies and gentlemen of the Royal Explorers Club! Your attention please. It falls to me to be the host of our proceedings to-day, as we celebrate a great achievement in the annals of this hallowed............." announces Paul W. Frields on the Fedora list here .
The Features
I have been long waiting for this day, and my bit-torrent client is already downloading two torrents , the Live CD and the Fedora installation DVD for i386. Fedora 11 has exciting features which would get any FOSS enthusiast interested ( at least to test them , or take a tour ) , some of the features I have been waiting for include :
- 20-second startup and plymouth
- OProfile and Valgrind integration into the Eclipse IDE
- Ext4 as the default filesystem
- Gnome 2.26
- Yum Presto
- rpm update to v4.7
A massive list of all the features can be found on the Fedora wiki here
- 2 comments
- Read more
- 224 reads
swappines, I/O caches and the unresponsive Linux desktop
While I was recently investigating the reason for the sluggishness of the Linux desktop during file copy, I found out some interesting things. The linux kernel by default allocated some memory for I/O caches to spped up I/O operations, now when the memory is low, the creation of such caches can come at a cost.
It has been told ( on the Linux kernel mailing lists) that the recent kernels have a tendency to swap out memory mapped pages giving preference to the creation of I/O caches.
You might already be aware that on x86 systems the memory is allocated as pages, these pages are allocated by mapping the memory when a particular process is created, hence by swapping out these pages for creation of I/O caches, the desktop (Linux) becomes unresponsive during file copy. HOW ?
When the pages are swapped out, they are stored on a backing store ( the swap partition or any other swap file), though the backing store is faster than normal file transfers, it is slower than accessing the page directly from main memory, hence when you try to run other applications ( whose pages might have been swapped out to create space for caches), they take some time to respond, because the corressponding pages have to be brought back from the backing store(swap space ) to the main memory.
- Add new comment
- Read more
- 79 reads
decreasing the boot time on GNU/Linux
The latest linux distributions are boasting high about the decrease in the average boot times. Both the latest release of Ubuntu ( 9.04) and the upcoming release of Fedora (11) have remarkeable improvements in the boot time bringing it closer to the 20 second mark set by most of the community. But this article is not about that, listed here are a few tips which can be done on any system to improve the boot time noticeably.
- Remove the splashimage in grub and set the default timeout to 0 or 1:
unless you have decide everytime you boot your system which option you have to run. That is most of use mostly get into one of the options pointed to by grub, then what is the point of waiting for 5 seconds ( the default timeout). Edit the file /etc/grub.conf and comment out the line starting with "splashimage" and set the value assigned to timeout to 0 or 1. - Disable graphical boot option ( for Fedora and RHEL/centos) :
On all fedora versions till Fedora 9 and on all RHEL and Centos variants , the RedHat Graphical Boot (RHGB) options is enabled by default , this makes a progress bar appear when the system is booting, this results in an overhead in starting the X server to display the progress bar. So unless you are too worried about the fancy progress bar, you can switch it off. Again edit the file /etc/grub.conf and remove the word rhgb on the line beginning with "kernel", do that only for the default option which you boot into. - Disable the unused services and daemons:
- Add new comment
- Read more
- 304 reads
program to left justify a text file
/* * text_justify.c * * program to justify the text in the file passed as argument towards left. * * by default the program justifies the text so that, there at the maximum * 100 characters on a line, this limit can also be set by giving the command * line argument -lncount * * AUTHOR : SATISH KUMAR EERPINI <eerpini@gmail.com> * DATE : 24 APRIL 2009 * 0128 HRS IST * */ #include<stdio.h> #include<string.h> #include<fcntl.h> #include<unistd.h> #include<stdlib.h> void strcate(char *a, char *b){ int len; len=strlen(a); *(a+len)=*b; *(a+len+1)='\0'; return; } int main(int argc, char *argv[]){ int i=0; char ch; /* * default line limit */ int line_limit=100; /* * defining the variables required to store the * word and line state for the word being currently * read in */ int curr_word_cnt=0; char curr_word[21]=""; FILE *fd ; /* * asking for the arguments, if they are not given */ if(argc<3){ printf("Please give arguments , USAGE : justify --file <filename> -lncount <number_of_characters_per_line>\n"); exit(0); } /* * taking the arguments and performing appropriate tasks */ for(i=1;i<argc;i++){ if(strcmp(argv[i],"-lncount")==0) line_limit = atoi(argv[i+1]);
- Add new comment
- Read more
- 44 reads
python script to select rpms of highest version
When I was creating the spin for the Lug, I used to copy packages downloaded on my system to the repository directory as and when my system was updated, so the repository had a lot of same packages of different versions, like I had almost four versions of firefox package rpms in the directory. This is a pain, more when the size of the directory grew with the updates and because of the redundancies, it was getting tough to distribute the repository to anyone ( it grew to nearly 6 GB). I could not also find satisfactory tools which would allow me to filter out the rpms of the latest versions of all the packages, ..... So to "scratch my own itch" , I sat down and decided to write my own python script, .........
I knew I had to start with the already existing Python rpm api. So I went through some documentation here : http://fedora.linuxsir.org/fedoradocs/rpm-guide/en/ch16s02.html . And after some effort I ended up with the following script, which when pointed out to a directory containing RPMS, moves rpms of lower versions to a directory backup in the working directory.
#!/usr/bin/python import os, sys, rpm, glob if len(sys.argv)<2: print "Need the directory as a command line argument " exit() if sys.argv[1].endswith("/") : rpm_dir=sys.argv[1] else: rpm_dir=sys.argv[1]+"/" ts = rpm.TransactionSet() list=os.listdir(rpm_dir) for file in list: if os.path.isfile(rpm_dir+file) and file.endswith(".rpm"): fd = os.open(rpm_dir+file,os.O_RDONLY) l_hdr = ts.hdrFromFdno(fd)
- Add new comment
- Read more
- 65 reads
Python-twitter : Tweeting in Python
everyone knows about the twitter API for communicating and retrieving status messages. Now there exists a python wrapper API for the twitter API which is provided as a python module. This can be downloaded from here : http://code.google.com/p/python-twitter/
What left me really spellbound was the simplicity of the python-twitter interface. Here are a few easy and fun things you can do with it , straight away from your python command prompt ( you need to be connected to the internet ofcourse);
Here is a simple script for retrieving your friend tweets :
#!/usr/bin/python import twitter api=twitter.Api(username="SatishEerpini", password="satisheerpini") for frnd in api.GetFriends(): print frnd.name print api.GetFriendsTimeline(frnd).text print "Finsihed getting your tweets ......... tweet .. tweet :-)\n"
HTH;-)
- 4 comments
- 154 reads
changing the 'root' password on linux
Have you ever faced a situation where you forgot the administrator password of your linux installation, then probably it will happen again and the following hack is for you, follow the given steps and you can restore the root password to something new :
1. add the following to the boot parameters on grub or whatever boot loader you use :init=/bin/sh
2. boot into the system and you will be taken to a shell ( without a login),.. there you can use 'passwd' to change the password
3. reboot
What actually happens when you set init=/bin/sh is that after the kernel is loaded, instead of running the init program, the shell program ( /bin/sh) is executed, which takes you to a command prompt after loading the filesystem read only. Be careful that you don't mess around with anything else in this mode. HTH ;-)
PS : also cross-posted at http://vlug.playdrupal.com/?q=node/156 .
- 2 comments
- 97 reads
SLIM and a script for changing the SLIM theme
I have been using SLIM , as a replacement for GDM , mainly for the following two (silly) reasons :
--> because it is faster( really does not matter on my lappy with around 2.5 gigs of memory)
--> it allows root login without tweaking( now that is something very silly)
anyway I recently discovered that the themes for SLIM can be changed and that there is a command for previewing the SLIM themes once they are extracted into a directory, based on this I just wrote a simple script which helps in changing the SLIM theme , here goes the script :
#!/bin/bash
SLIM_THEME_DIR=/usr/share/slim/themes
echo -ne $"program for changing the SLIM theme"
echo -ne $"The available SLIM themes are : "
for i in $SLIM_THEME_DIR/*
do
echo -ne $"$i \n"
done
echo -ne $"Enter the theme to be set as default : "
read def_theme
echo -ne $"Removing the current default theme\n"
rm -rf $SLIM_THEME_DIR/default
echo -ne $"Setting the requested theme as default \n"
cp -r $SLIM_THEME_DIR/$def_theme $SLIM_THEME_DIR/default
echo -ne $"Previewing the default theme \n"
slim -p $SLIM_THEME_DIR/default
echo -ne $"Done .......... "The slim package can be installed from the Fedora repository ( I am using Fedora 10), and slim themes can be downloaded from here : http://slim.berlios.de/themes01.php. I am still searching if there is any automatic tool for changing the themes and planning to write a tool using python and Tk.
- Add new comment
- 152 reads
