Tuesday, September 17, 2013

Update Ubuntu from 10.10 to 12.04

copy /etc/apt/sources.list from 12.04 to 10.10 and then 'sudo apt-get update'

# deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release amd64 (20120425)]/ dists/precise/main/binary-i386/

# deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release amd64 (20120425)]/ dists/precise/restricted/binary-i386/
# deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release amd64 (20120425)]/ precise main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://ro.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://ro.archive.ubuntu.com/ubuntu/ precise main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://ro.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb-src http://ro.archive.ubuntu.com/ubuntu/ precise-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://ro.archive.ubuntu.com/ubuntu/ precise universe
deb-src http://ro.archive.ubuntu.com/ubuntu/ precise universe
deb http://ro.archive.ubuntu.com/ubuntu/ precise-updates universe
deb-src http://ro.archive.ubuntu.com/ubuntu/ precise-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://ro.archive.ubuntu.com/ubuntu/ precise multiverse
deb-src http://ro.archive.ubuntu.com/ubuntu/ precise multiverse
deb http://ro.archive.ubuntu.com/ubuntu/ precise-updates multiverse
deb-src http://ro.archive.ubuntu.com/ubuntu/ precise-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://ro.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://ro.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu precise-security main restricted
deb-src http://security.ubuntu.com/ubuntu precise-security main restricted
deb http://security.ubuntu.com/ubuntu precise-security universe
deb-src http://security.ubuntu.com/ubuntu precise-security universe
deb http://security.ubuntu.com/ubuntu precise-security multiverse
deb-src http://security.ubuntu.com/ubuntu precise-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu precise partner
# deb-src http://archive.canonical.com/ubuntu precise partner

## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main
deb http://archive.canonical.com/ precise partner
deb-src http://archive.canonical.com/ precise partner

Tuesday, September 10, 2013

Install Firefox, Chrome, Opera, Safari Internet Browsers in Ubuntu

http://www.guguncube.com/694/ubuntu-installation-of-firefox-chrome-opera-safari-internet-browsers-in-ubuntu-12-04-12-10-13-10

Friday, August 30, 2013

make Ruby 1.9 to be default


1. sudo apt-get update
2. sudo apt-get install ruby1.9.1 ruby1.9.1-dev rubygems1.9.1 irb1.9.1 ri1.9.1 rdoc1.9.1 build-essential libopenssl-ruby1.9.1 libssl-dev zlib1g-dev
3. sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.1 400 --slave /usr/share/man/man1/ruby.1.gz ruby.1.gz /usr/share/man/man1/ruby1.9.1.1.gz --slave /usr/bin/ri ri /usr/bin/ri1.9.1 --slave   /usr/bin/irb irb /usr/bin/irb1.9.1 --slave   /usr/bin/rdoc rdoc /usr/bin/rdoc1.9.1
4. sudo update-alternatives --config ruby (choose 1st variant /usr/bin/ruby1.9.1)
5. sudo update-alternatives --config gem (choose last variant with /usr/bin/gem1.9.1)

If you try 'ruby --version' will have the ruby1.9.1 version

Tuesday, April 9, 2013

Count the occurrences of a string per line in a file


cat exampleFile
text 1 text
text text 4 text 56
2
4
test
345
87 text

Count the occurrences of 'text' in exampleFile per line
awk -F "text" '{print NF-1}' exampleFile
2
3
0
0
0
0
1

Friday, March 29, 2013

Sort,uniq (string, int) columns in csv files


cat file

text1,5
text4,3
text3,1
text1,4
text7,2
text3,7
text2,9


1. less file | sort -u -t, -k1,1 - sort the first column and get unique texts
text1,5
text2,9
text3,1
text4,3
text7,2

2. less file | sort -u -t, -k1,1 | sort -t, -k2 -nr - get unique texts on first column and reverse order for the second column using -r option
text2,9
text1,5
text4,3
text7,2
text3,1

Saturday, September 15, 2012

Grep in pdf file for a certain word

find . -name '*.pdf' -exec pdftotext {} - \; | grep -rn "test"

find . -name "*.pdf" -print0| while read -d $'' file; do co=$(pdftotext -q "$file" - |grep -crn "test"); if [ $co -ne 0 ]; then echo $co - "$file" ; fi ; done

Wednesday, September 12, 2012

uninstall a firefox plugin

http://askubuntu.com/questions/150095/how-to-uninstall-a-firefox-plugin


Manually uninstalling a plugin

If you can't use an uninstaller program to remove a plugin, you can remove it manually:

In the Location bar, type about:config and press Enter.

The about:config "This might void your warranty!" warning page may appear. Click I'll be careful, I promise!, to continue to the about:config page.
Search for the preference: plugin.expose_full_path.

Double-click on the plugin.expose_full_path preference in the list to change the value to true.

Enter about:plugins into the Location bar to display the About Plugins page.

Each entry in the About Plugins page will have "File name:" followed by a path. Use Windows Explorer to navigateNavigate to the folder shown for the plugin you want to remove.

Rename the file to something other than its normal name - e.g. npswf32 becomes Xnpswf32

Double-click on the plugin.expose_full_path preference in the list on the about:config page to change the value back to false to avoid exposing the plugin path to websites.

Tuesday, September 11, 2012

Download a web site using wget

wget -r --level=0 -convert-links --page-requisites --no-parent <URL>
httrack <URL>

Thursday, August 9, 2012

download youtube files with youtube-dl-tci

curl -s "http://www.youtube.com/playlist?list=UUuqxLlNgdBCqhTxphhhTbZg&page=2" | grep watch? |cut -d\= -f3 | cut -d\& -f1 | grep -v data | grep -v watch | while read file ; do youtube-dl -tci "http://www.youtube.com/watch?v=$file" ; done