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

Wednesday, August 8, 2012

Install μTorrent in Ubuntu

wget http://download.utorrent.com/linux/utorrent-server-3.0-25053.tar.gz
sudo cp utorrent-server-3.0-25053.tar.gz /opt/
cd /opt/
sudo tar -xvf utorrent-server-3.0-25053.tar.gz
sudo rm -rf utorrent-server-3.0-25053.tar.gz
sudo chmod 777 -R utorrent-server-v3_0/
sudo ln -s /opt/utorrent-server-v3_0/utserver /usr/bin/utserver

Create a launcher in panel. In name field type utorrent and in command filed type 'utserver -settingspath /opt/utorrent-server-v3_0/ &'


Go to localhost:8080/gui and for user name type admin and password leave it empty.

Start launch application in Ubuntu 12.04 Unity

sudo apt-get install gnome-panel
gnome-desktop-item-edit --create-new ~/Desktop

Sunday, August 5, 2012

Read text with voice in Ubuntu

espeak --stdout -f text.txt | aplay -> read with voice file text.txt
espeak -v en-uk --stdout 'some text' | aplay -> read with voice some text
espeak --voices -> display all available voices

Solution when sound in stuttering in Ubuntu

1. lsof | grep pcm
2. kill all the processes and the sound will work fine

Tuesday, July 10, 2012

Kernel driver not installed (rc=-1908)


The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing

'/etc/init.d/vboxdrv setup'

as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.


Friday, May 4, 2012

How to get the last modified item using ll command

touch file
echo "test" > file
cat `ll -ltr | tail -1 | awk '{print $8}'`

Result:
test

Friday, February 24, 2012

Back UP contact, notes, calendars, SMS on IPHONE

/private/var/mobile/Library/AddressBook
/private/var/mobile/Library/Calendar
/private/var/mobile/Library/Notes
/private/var/mobile/Library/SMS





sqlite3 AddressBook.sqlitedb
sqlite> .mode csv
sqlite> .output contacts.csv
sqlite> SELECT ROWID, First, Last, ABMultiValue.value, record_id FROM ABPerson, ABMultiValue WHERE ROWID=record_id;
sqlite > .quit

Wednesday, February 15, 2012

screenshot of a webpage

catycapt --url="www.google.com" --out=/home/test/screenshot.png

Thursday, February 9, 2012

Download pictures using lynx and wget

test@test:~$ lynx --source "http://www.funnyjokes.org/" | grep gif
    <td><a href="/"><img src="images/logo.gif" border="0" /></a></td>
<a href="funny_cartoons.aspx"><img src="http://www.martybucella.com/toon.gif" alt="cartoon" width=150 /></a>

test@test:~$ lynx --source "http://www.funnyjokes.org/" | grep http | grep gif | cut -d\" -f4
http://www.martybucella.com/toon.gif
test@test:~$ wget `lynx --source "http://www.funnyjokes.org/" | grep http | grep gif | cut -d\" -f4`
--2012-02-09 16:31:46--  http://www.martybucella.com/toon.gif
Resolving www.martybucella.com... 72.167.131.126
Connecting to www.martybucella.com|72.167.131.126|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14076 (14K) [image/gif]
Saving to: `toon.gif'

100%[====================================================================================================================================================================================================>] 14,076      33.8K/s   in 0.4s  

2012-02-09 16:31:47 (33.8 KB/s) - `toon.gif' saved [14076/14076]
test@test:~$ display toon.gif

Wednesday, February 8, 2012

Use bittorrent from command line

sudo apt-get install bittorrent
btdownloadcurses "http://name.torrent"

 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| file:     test                                                                                                                                                                                                       |
| size:     1,192,962,793 (1.1  G)                                                                                                                                                                                                          |
| dest:     /home/work/Downloads/test                                                                                                                                                                                  |
| progress: ############################################################################################################################################################################################################################### |
| status:   download succeeded!                                                                                                                                                                                                             |
| speed:      0    B/s down -   0    B/s up                                                                                                                                                                                                 |
| totals:     1.1  G   down -  30.7  M   up                                                                                                                                                                                                 |
| error(s):

Friday, February 3, 2012

Print PS output using AWK

ps aux | grep -v grep | grep apache2 | awk '{printf $1","$2","$3","$4","$5","$6","$7","$8","$9","$10"," ; for(i=11;i<=17;i++){printf "%s%s",sep,$i;sep=FS} print ""}'
root,2284,0.0,0.1,203544,9176,?,Ss,Feb02,0:00,/usr/sbin/apache2 -k start  
www-data,2398,0.0,0.1,205544,8236,?,S,Feb02,0:00, /usr/sbin/apache2 -k start  
www-data,2399,0.0,0.1,205544,8236,?,S,Feb02,0:00, /usr/sbin/apache2 -k start  
www-data,2400,0.0,0.1,205544,8236,?,S,Feb02,0:00, /usr/sbin/apache2 -k start  
www-data,2401,0.0,0.1,205544,8236,?,S,Feb02,0:00, /usr/sbin/apache2 -k start  
www-data,2402,0.0,0.1,205544,8236,?,S,Feb02,0:00, /usr/sbin/apache2 -k start

TIME,USER,PID,%CPU,%MEM,VSZ,RSS,TTY,STAT,START,TIME,COMMAND

Thursday, February 2, 2012

ps aux output


$ ps aux  
USER       PID  %CPU %MEM  VSZ RSS     TTY   STAT START   TIME COMMAND
root     29505  0.0  0.0 38196 2728 ?        Ss   Mar07   0:00 sshd: can [priv] 
USER = user owning the process
PID = process ID of the process
%CPU = It is the CPU time used divided by the time the process has been running.
%MEM = ratio of the process’s resident set size to the physical memory on the machine
VSZ = virtual memory usage of entire process
RSS = resident set size, the non-swapped physical memory that a task has used
TTY = controlling tty (terminal)
STAT = multi-character process state
START = starting time or date of the process
TIME = cumulative CPU time
COMMAND = command with all its arguments