Tuesday, October 19, 2010

Setup Jinzora media streaming and management on CentOS /Fedora/RHEL

Jinzora is a web based media streaming and management system, written in PHP.
Streaming your media with Jinzora gives you quick and easy access to your online music and video collection from any device with a web browser.
Enjoy your media from your PC, notebook, PDA, Smart Phone, Xbox, PS3 or Wii.
Use Jinzora in Jukebox Mode to control a hardware device like your stereo set or Squeezebox and third-party software, including MPD, VLC and Shoutcast.

Pre-installation
Before you can install Jinzora, you must set up a LAMP server first.

#yum install  mysql mysql-server httpd php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc

#service httpd start
#service mysqld start
#mysql_secure_installation (set up root password)
#wget http://downloads.sourceforge.net/jinzora/jz280.tar.gz
#tar zxvf jinzora-3.0.tar.gz
#cd jinzora-3.0
#mv * /var/www/html/jinzora
#cd /var/www/html/jinzora
#sh config.sh
You are now in setup mode.
Please direct your web browser to the directory where you installed Jinzora
and load index.php - you will then be taken through the complete setup

http://yourdomain.com/
















:)

Monday, October 18, 2010

vi and vim commands

Command mode ESC

                dd       delete
                u        undelete
                y        yank (copy to buffer)
                p/P      p before cursor/P after cursor

                Ctl-g    show current line number
                shft-G   end of file
              n shft-G   move to line n

               /stuff/   search
                  n   repeat in same direction
                  N   repeat in opposite direction
                  /return  repeat seach forward
                  ?return  repeat seach backward

               "dyy  Yank current line to buffer d
               "a7yy Yank next 7 lines to buffer a
                    or
               :1,7ya a  Yank [ya] lines 1,7 to buffer a
               :1,7ya b  Yank [ya] lines 1,7 to buffer b

               :5 pu b   Put [pu] buffer b after line 5

               "dP   Put the content of buffer d before cursor
               "ap   Put the contents of buffer a after cursor

               :1,4 w! file2  Write lines 1,4 to file2
               :1,3

               :set nu     Display line numbers
               :set nonum  Turns off display

               :set ic     Ignore Case

               :e  Edit a file in a new buffer

               :g//p   Print matching regular expression

            vim
               :split
               :split 
               :sp 
               :split new

                   ctl-w   To move between windows
                   ctl-w+
                   ctl-w-  To change size
                   ctl+wv  Split windows vertically
                   ctl-wq  Close window

               :only       To view only 1 window

            vim dictionary - put the following command in ~/.vimrc

                   set dictionary+=/usr/share/dict/words
                   set thesaurus+=/usr/share/dict/words
              
               Now, after you type a word  and to 
               go back in the listing 

                   butter

           Scripting - you can script vi commands using ex. For example
               suppose you want to replace all occurrences of "one" with "two", then
               exit the file if there are changes. You would put the following in a file call script

               Contents of script

                   %s/one/two/g|x

               If you want to run this on all files with the patten "example*"

                   for i in $(ls example*); do ex - $i 

What Network Services are Running

$ netstat -tanup

     or if you just want tcp services
 
          $ netstat -tanp

     or

          $ netstat -ap|grep LISTEN|less

     This can be helpful to determine the services running.

     Need stats on dropped UDP packets?

          $ netstat -s -u

     or TCP

          $ netstat -s -t

     or summary of everything

          $ netstat -s

     or looking for error rates on the interface?

          $ netstat -i

     Listening interfaces?

          $ netstat -l

awk - common awk commands.

Find device names "sd" or with major number 4 and device name "tty". Print the
     record number NR, plus the major number and minor number.

          $ awk '$2 == "sd"||$1 == 4 && $2 == "tty" { print NR,$1,$2}' /proc/devices

     Find device name equal to "sound".

          $ awk '/sound/{print NR,$1,$2}' /proc/devices

     Print the 5th record, first field, in file test

          $ awk 'NR==5{print $1}' test

     Print a record, skip 4 records, print a record etc from file1

          $ awk '(NR-1) % 4 == 0 {print $1}' file1

     Print all records except the last one from file1

          $ tac file1|awk 'NR > 1 {print $0}'|tac

     Print A,B,C ..Z on each line, cycling back to A if greater than 26 lines

          $ awk '{ print substr("ABCDEFGHIJKLMNOPQRSTUVWXYZ",(NR-1)%26+1,1),$0}' file1

     Number of bytes in a directory.

          $ ls -l|awk 'BEGIN{ c=0}{ c+=$5} END{ print c}'

     Remove duplicate, nonconsecutive line. As an advantage over "sort|uniq"
     you can eliminate duplicate lines in an unsorted file.

          $ awk '! a[$0]++' file1

     Or the more efficient script

          $ awk '!($0 in a) {a[$0];print}' file1

     Print only the lines in file1 that have 80 characters or more

          $ awk 'length < 80' file1

     Print line number 25 on an extremely large file -- note it has
     to be efficient and exit after printing line number 25.

          $ awk 'NR==25 {print; exit}'  verybigfile