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

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