Check all vim colorschemes for minor issues

2013-10-10 2 min read Bash Vim Tips

Here is script that checks all the colorschemes in the current directory and corrects them if possible (Processing of the file is done with simple commands like sed, grep)

Checks that the color_name is same as Filename

Here is the script:

#!/bin/bash -
#===============================================================================
#
#          FILE: check_colors.sh
#
#         USAGE: ./check_colors.sh
#
#   DESCRIPTION:
#
#       OPTIONS: ---
#  REQUIREMENTS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Amit Agarwal (aka), 
#      REVISION:  ---
#===============================================================================
cd ~/.vim/colors
for i in *vim
do
    #echo "Processing $i"
    if [[ $(grep -c g:colors_name $i ) -eq 0 ]]; then
        if [[ $(grep -c colors_name $i ) -eq 0 ]]; then
            echo "File $i does not have colorname";
            missing=$missing" $i"
        else
            sed -i.bak '/colors_name/ s/.*/let g:colors_name="'${i//.vim}'"/g' $i
        fi
    else
        if [[ $(grep -c colors_name $i|grep let ) -gt 1 ]]; then
            echo "WARN ----->> File $i has more than one colorsname"
        fi
        colorname=$(grep g:colors_name $i|grep let| sed -e 's/"//g' -e 's/.*=//' |tr -d ' ')
        if [[ ${colorname}.vim != $i ]]; then
            echo "Filename $i does not match colorname $colorname .. correcting "
            sed -i.bak '/colors_name/ s/.*/let g:colors_name="'${i//.vim}'"/g' $i
            #sed -i.bak 's/(.*g:colors_name.*=)/1'${i//.vim}'/g' $i
        fi
    fi
done

if [[ x$missing != x ]] ; then
    echo "Missing colornames in $missing"
fi

 

Continue reading

ssmtp configuration and installation – raspberry pi.

2013-06-04 2 min read Raspberry Pi
English: Extract from Raspberry Pi board at Tr...
English: Extract from Raspberry Pi board at TransferSummit 2011 (Photo credit: Wikipedia)

To get your email working on your raspberry pi, First thing that you should probably do is to set up outgoing emails from your RPi. The easiest way to do so is with ssmtp.

Install ssmtp:

sudo apt-get install ssmtp

Next configure the ssmtp client to send emails using your ISP, open up the file /etc/ssmtp/ssmtp.conf file and make the changes as suggested below:

Continue reading

lightweight pdf viewer – zathura.

2013-01-28 1 min read Fedora

Zathura is a lightweight viewer for pdf which works on plugins. Here is shor description :

Zathura is a highly configurable and functional PDF viewer based on the Poppler
rendering library and the GTK+ toolkit. The idea behind zathura is an
application that provides a minimalist and space saving interface as well as
an easy usage that mainly focuses on keyboard interaction.

But the viewer will not work unless you install the plugins to display the correct plugin. So, if you want to use it for any real purposes then you will have to install the appropriate plugin as well, so here is what you need to do:

Continue reading

vim mappings for multiple files.

2012-08-06 1 min read Vim Tips

If you open multiple files in vim with command line option. Then the only way to move between the files is “:n” and “:N”. There is a easier way to do this. Just add mappings for this in vimrc. Here is what you can use.

map  :N
map  :n

And if you want to make sure that you move to the prev or next file after saving the file, then you modifyt the mapping like this:

Continue reading

gqlplus – sqlplus with readline (tab completion)

2012-08-03 1 min read Database

Tab completion is something which is missing in the sqlplus and if you have lot of tables with long names or lot of columns then it is sufficiently  difficult to type them 🙂

Here is a solution for this problem. Download and install gqlplus. gqlplus is a replcement for sqlplus which supports completion for commands/tablenames and column names. Quite useful.

Oracle SQL*Plus
Oracle SQL*Plus (Photo credit: Manuel Cernuda)
Enhanced by Zemanta

rpmconf – Tool to handle rpmsave and rpmnew files

2012-06-18 1 min read Bash Fedora

Install the utility:

sudo yum install rpmconf

Description:

Description : This tool search for .rpmnew, .rpmsave and .rpmorig files and ask you what to do
with them:
Keep current version, place back old version, watch the diff or merge.

And finally run the utility:

sudo rpmconf -a

and if there is a conflict or rpmsave or rpmnew file, then you will see something like this:

Continue reading

pigz -parallel gzip

2012-03-26 1 min read Fedora Linux

Here is a short description of pigz:

pigz, which stands for parallel implementation of gzip,
is a fully functional replacement for gzip that exploits
multiple processors and multiple cores to the hilt when compressing data.

And for the installation:

sudo yum install pigz

With pigz, if you don’t have many things running on your multi processor machine then you will see a significant improvement when you are gzipping the files.

Continue reading
Older posts Newer posts