A link for Internet Radio – mainly Eritrean and Ethiopian Tigrigna music. Some Amharic too.

http://linuxfreelancer.com:8000/listen.pls?sid=1

Link here.

How to search Internet radio channels –

1. Go to shoutcast.com
http://www.shoutcast.com/

2. Search using a key phrase

http://www.shoutcast.com/Internet-Radio/eritrean

http://www.shoutcast.com/Internet-Radio/ethiopian

Recently I was trying to download numerous files from a certain website using a shell script I wrote. With in the script, first I used wget to retrieve the files, but I kept on getting the following error message –

HTTP request sent, awaiting response... 403 Forbidden
2012-12-30 06:17:45 ERROR 403: Forbidden.

Then hoping that this was a wget problem, I replaced wget with curl. It turned out that Curl would actually create a file with the same name as the one being download, but to my surprise the file was not downloaded. Instead, it contained an html file with 403 Forbidden message.

403 Forbidden
Forbidden

You don't have permission to access /dir/names.txt on this server.

What was surprising is that I could download the files using Firefox, Internet Explorer, elinks and even text based browser ‘lynx’. It seems that the website was blocking access from client browsers with certain ‘User-Agent’ header field. So the trick was to simply modify the User-Agent to a ‘legitimate’ one. Both curl and wget support the altering of User-Agent header field.

wget --user-agent=""User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12" -c http://yourwebaddresshere/filetodownload.txt

curl -A "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12" -O http://yourwebaddresshere/filetodownload.txt

Download audio in mp3 format from Youtube

Got your favorite youtube video and yet you don’t have it in an audio format such as mp3 to play it offline? With open source tools, you can grab that video and convert it to mp3 at no cost.

Prepare a directory for downloading mp4 format files from youtube.

mkdir /home/youtube

Tools you need

1. youtube-dl: A python script to download videos from youtube – http://rg3.github.io/youtube-dl/download.html

Using curl –

sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

Using wget –

sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

Using pip –

sudo pip install --upgrade youtube_dl

2. ffmpeg: an audio/video conversion tool.

 apt-get install ffmpeg libavcodec-extra-53

Procedure
1. Make the youtube link ready for download and then download the mp4 using youtube-pl script
2. Use ffmpeg tools to convert mp4 to mp3

Sample download

Let us download the following youtube link

youtube-dl -f 18 -t http://www.youtube.com/watch?v=dAG2qxvYwsY

options: -f is for file format of the youtube video (check youtube-dl documentation for the whole list)

Next, convert it to mp3

ffmpeg -i Freselam_Mussie_s_Tsinih_Zeytibli-dAG2qxvYwsY.mp4 -f mp3 -ab 192000 -vn Freselam_Mussie_s_Tsinih_Zeytibli-dAG2qxvYwsY.mp3

options: -i for input
         -f for output file format
         -ab for bit rate
         -vn for Disable video recording.

References –

http://rg3.github.com/youtube-dl/

http://rg3.github.io/youtube-dl/download.html

You are being watched!

According to its website, Carrier IQ claims that its software is deployed in more than 141 millions handsets. Many of the major carriers and handset makers preinstall Carrier IQ on the handsets they sell, including AT&T, T-mobile, Apple, HTC etc. The software is nothing different from a rootkit, it records all keystrokes you make on your handset, the sites you visit, the sms messages you send and receive, and many more.

For more info –

http://www.engadget.com/2011/12/01/carrier-iq-what-it-is-what-it-isnt-and-what-you-need-to/

Besides a website, the server running this blog also hosts an Internet Music broadcasting radio. Do you see the “Listen Music” Link on the home page, top right corner of the page – http://danasmera.com:8000/listen.pls?sid=1 ? It is running on an AWS ec2 microinstance, which does not cost much. So how do you turn your public facing server into an internet radio, accessible from your pc, laptop or mobile phone. It is quite simple, some of the most popular solutions are Ice cast and shoutcast. Here is how you can setup an Internet broadcast radio using shoutcast.

1. Add shoutcast user

#useradd shoutcast or
#adduser shoutcast

cd /home/shoutcast

2. Download shoutcast

Go to http://www.shoutcast.com/broadcast-tools and download SHOUTcast Distributed Network Audio Server(DNAS).

#wget -c http://download.nullsoft.com/shoutcast/tools/sc_serv2_linux_x64_07_31_2011.tar.gz  

(for 64-bit linux machine)

#wget -c http://download.nullsoft.com/shoutcast/tools/sc_serv2_linux_07_31_2011.tar.gz

(for 32-bit linux machine)

If you plan to broadcast mp3 format, you will need the SHOUTcast Transcoder (SC_TRANS)

#wget -c http://download.nullsoft.com/shoutcast/tools/sc_trans_linux_x64_10_07_2011.tar.gz  

(for 64-bit linux machine)

#wget -c http://download.nullsoft.com/shoutcast/tools/sc_trans_linux_10_07_2011.tar.gz 

(for 32-bit linux machine)

3. uncompress and untar the shoutcast programs (In my case, it is the 64-bit version)

#tar xzvf sc_serv2_linux_x64_07_31_2011.tar.gz
#tar xzvf http://download.nullsoft.com/shoutcast/tools/sc_trans_linux_x64_10_07_2011.tar.gz

4. Time to edit two important config files: sc_serv_basic.conf and sc_trans_basic.conf

a. sc_serv_basic.conf

logfile=logs/sc_serv.log
w3clog=logs/sc_w3c.log
banfile=control/sc_serv.ban
ripfile=control/sc_serv.rip
publicserver=always</code>
<code>password=yourpasswordhere</code> #this password is used by sc_trans, make sure to use same password in sc_trans_basic.conf
<code>adminpassword=yourpasswordhereagain</code> #this password is used to access the admin page through your browser
<code>streamid=1
streampath=/test.aac

streamauthhash_1=AcMnKLMrYVmK2NlR9W8j #unique for each station, Needed if you plan to make your station publicly available.

b. sc_trans_basic.conf

logfile=logs/sc_trans.log
calendarrewrite=0
encoder_1=aacp</code>   ## uploaded mp3 music files will be played as AAC
<code>bitrate_1=56000
outprotocol_1=3
serverip_1=127.0.0.1</code> ##listen only on loopback interface
<code>serverport_1=8000  
uvoxauth_1=yourpasswordhere </code> ## This password has to be the same as 'password' in sc_serv_basic.conf
<code>uvoxstreamid_1=1
endpointname_1=/Bob
streamtitle=Eritrean and Ethiopian Guayla
streamurl=http://danasmera.com:8000/listen.pls?sid=1
genre=Tigrigna Guayla
playlistfile=playlists/main.lst</code> ## the file contaning the path to individual music files, we will populate this later.
<code>adminport=7999
adminuser=administrator
adminpassword=yourdminpasshere

5. Upload your music files

Upload all your music files to the /home/shoutcast/music directory. Use any sftp client, such as winscp or filezilla for this task. Sample output –

root@danasmera:/home/shoutcast# ls -al /home/shoutcast/music/
-rw-r--r--  1 shoutcast shoutcast  6418432 2011-09-07 02:13 abrahamAF.mp3
-rw-r--r--  1 shoutcast shoutcast  7345261 2011-11-22 23:41 Abreham-vol2.mp3
-rw-r--r--  1 shoutcast shoutcast  6222993 2011-11-22 23:41 asmera.mp3
-rw-r--r--  1 shoutcast shoutcast  3197056 2011-09-13 02:56 Bebizelenayo.mp3
-rw-r--r--  1 shoutcast shoutcast  5890765 2011-11-22 23:41 Bereket1.mp3

6. Populate your playlists file i.e. /home/shoutcast/playlists.lst with full path of all the music files you have on the server.

a. All music files in specific directory eg. /home/shoutcast/music, assuming mp3 file format.

#find /home/shoutcast/music/ -type f -name "*.mp3" -exec ls -1  {} \; > /home/shoutcast/playlists/playlist.lst

b. Music files are locate in different directories in the server, assuming mp3 file format.

#find / -type f -name "*.mp3" -exec ls -1  {} \; > /home/shoutcast/playlists/playlist.lst

7. File permissions and firewall

a. File permissions
Make sure all files under /home/shoutcast are owned by the shoutcast user, otherwise shoutcast will encounter permission denied errors when it tries to play the files.

#chown -R shoutcast:shoutcast /home/shoutcast

b. Open port 8000 and 8001

#iptables -A INPUT -p tcp -i eth0 --dport 8000 -m state --state NEW -j ACCEPT

(-i: might be different depending on your NIC interface such as eth1, eth2 …)

#iptables -A INPUT -p tcp -i eth0 --dport 8001 -m state --state NEW -j ACCEPT

In case of Amazon ec2 servers, you need to open up port 8000 for the specific security group under which the server is running. It is accessible in AWS web management console.

8. Run shoutcast services

#cd /home/shoutcast
#./sc_serv sc_serv_basic.conf > /dev/null 2>&1 &
#./sc_trans sc_trans_basic.conf > /dev/null 2>&1 &

Test if shoutcast is listening on the specified ports using netstat

root@danasmera:/home/shoutcast# netstat -talpn |grep sc_
tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN      1075/sc_serv    
tcp        0      0 0.0.0.0:8001            0.0.0.0:*               LISTEN      1075/sc_serv  

9. Register your shoutcast radio with yp.shoucast.com to make it publicly available station.

Follow the instructions on this wiki on how to do this – http://wiki.winamp.com/wiki/SHOUTcast_Authhash_Management
In short – Go to your admin page eg. http://yourip-or-domain:8000/admin.cgi
Click the “Create Authhash” link, and after filling out the form, make sure the appropriate entry is added to the streamauthhash_1 parameter in your sc_serv_basic.conf file.

10. Enjoy the music!

One way to listen the music is by directly browsing to the link as in http://danasmera.com:8000/listen.pls?sid=1 or http://yourip-or-hostname:8000/listen.pls?sid=1 in its generic form. But the most convenient one is to use your mobile phone app to search for your station in the shoutcast yellow pages, and add it to your favorites list. In Android mobile phones – download “A Online Radio” app from the Market, open it and search for a keyword. In my case it could be “tigrigna” or “guayla”, that is the keyword i added when registering my station to the yellow pages. The stations pops up in the search results, just click to play it. For an iphone, you can use the ‘shoutcast’ app.

Finally, keep an eye on the log files in /home/shoutcast/logs, some of the information you will find there includes the music files played, your listeners ip addresses etc. You might use the following command for instance to sort out the IP addresses of the listeners –

#less sc_serv*  | grep -i client | awk '{print  $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr

Last but not least, know the copyright laws in your country before you start broadcasting other people’s work!

The Empire in Africa – A reminder that there are lots of things going on around the World, which we never hear about. This documentary on the “civil war” in Sierra Leone has probably one of the most graphic scenes. It keeps you wondering how ruthless and monstrous humans can be towards their fellow human beings. Government bureaucrats and rebels blaming each other, the International community as well as global for profit Corporations intervening only to protect their interests and as always the innocent civilians, mainly women and children paying the price.

Most web based attacks tend to occur by uploading malicious scripts into world writable directories such as cache, and then letting the web server execute those scripts. In apache, one of preventing such scripts from being executed is to add a “.htaccess” file in that directory and insert the following lines

cd /var/www/html/mydomain/uploads
vim .htaccess

Options -ExecCGI
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi

Monit is a nice tool, it lets you monitor daemons like apache and mysql, and not only sends you alerts when these services fail but also it automagically restarts those services. But I have always faced problem with having monit properly detect whether mysql is running or not. It would always say mysql is not running although it is running and it immediately stops monitoring mysql. The default monit config file /etc/monit/monitrc has this entry for mysql

check process mysql with pidfile /var/run/mysqld/mysqld.pid
group database
start program = "/etc/init.d/mysql start"
stop program = "/etc/init.d/mysql stop"
if failed host 127.0.0.1 port 3306 then restart
if 5 restarts within 5 cycles then timeout

In order for this to work, first make sure that /var/run/mysqld/mysqld.pid is there, sometimes you have only mysqld.sock not .pid. In that case, go to your mysql config file /etc/mysql/my.cnf (or /etc/my.cnf) and add the following entry

pid-file = /var/run/mysqld/mysqld.pid

Secondly, comment out the line “group database” for monit in /etc/monit/monitrc. These two steps should do the trick.
Do not forget to restart mysql and monit for this to take effect.

Requirements

    Ubuntu 10.04 32-Requirements

      Ubuntu 10.04 32-bit or 64-bit server
      2 GB of memory
      5G of free disk space

      Install BBB apt repository

    wget http://ubuntu.bigbluebutton.org/bigbluebutton.asc -O- |  apt-key add -
    
    echo 'deb http://ubuntu.bigbluebutton.org/lucid/ bigbluebutton-lucid main' | tee /etc/apt/sources.list.d/bigbluebutton.list
    
    echo 'deb http://us.archive.ubuntu.com/ubuntu/ lucid multiverse' | tee -a /etc/apt/sources.list
    

    Install Asterisk

      apt-get update 
      apt-get install bbb-voice-conference
      

      Install BBB

      apt-get install bigbluebutton
      

      Restart service and check for any errors in configuration

      bbb-conf --clean
      bbb-conf --check
      

      Access BBB at http://yourip
      Make sure port 80 is not blocked by your server and no other service except nginx
      is listening on port 80.

      Create meeting rooms with BBB wordpress plugin

    Add php support to nginx

    apt-get install python-software-properties
    add-apt-repository ppa:brianmercer/php
    apt-get update
    apt-get install php5-fpm
    

    Edit /etc/php5/fpm/php5-fpm to include

    listen = /var/run/php5-fpm.socket
    

    Add the following line to /etc/nginx/sites-enabled/bigbluebutton

    location ~ .php$ {
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_pass   unix:/var/run/php5-fpm.socket;
        fastcgi_param  SCRIPT_FILENAME  /var/www/bigbluebutton-default$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
        fastcgi_index index.php;
      }
    

    Restart nginx and php5-fpm

    /etc/init.d/php5-fpm restart
    /etc/init.d/nginx restart
    

    Install wordpress

      cd /usr/local/src
      wget -c http://wordpress.org/latest.tgz
      tar xzvf latest.tgz
      mv latest /var/www/bigbluebutton-default/bbbwordpress
      cd /var/www/bigbluebutton-default/bbbwordpress
      cp wp-config-sample.php wp-config.php
      

      Create mysql database for worpress
      mysql -u root -p (enter your password, or if there is no password set,just type
      mysql -u root)

      create database bbbwordpress;

      grant all privileges on *.bbbwordpress to bbbuser@localhost identified by 'yourpass';
      exit;
      

      Then edit wp-config.php

      define('DB_NAME', 'bbbwordpress');
      define('DB_USER', 'bbbuser');
      define('DB_PASSWORD', 'yourpass');
      

      Go to http://yourip/wordpress and set administrative user and password. Then login to the administrative
      dashboard and click on the plugins in the left hand pane. In the ‘search plugin’ box, type “bigbluebutton”
      and install/activate it.

      To integrate it with BBB click on Appearance–>Widgets–>BigBlueButton and drag/drop it to the content area.
      GO to Settings–> put the URL to your BBB link http://yourip/bigbluebutton and insert the salt from the
      setting page.

      Within the administrative wordpress dashboard you can create meetings and the passwords for participants/moderator.
      You should be able to access the rooms in http://yourip/wordpress/.

        Sources

      http://code.google.com/p/bigbluebutton/wiki/InstallationUbuntu
      http://cbanta.wordpress.com/2010/12/18/enable-php-on-bigbluebutton/
      http://wordpress.org/extend/plugins/bigbluebutton/bit or 64-bit server
      2 GB of memory
      5G of free disk space

      Install BBB apt repository

    wget http://ubuntu.bigbluebutton.org/bigbluebutton.asc -O- |  apt-key add -
    
    echo "deb http://ubuntu.bigbluebutton.org/lucid/ bigbluebutton-lucid main" | tee /etc/apt/sources.list.d/bigbluebutton.list
    
    echo "deb http://us.archive.ubuntu.com/ubuntu/ lucid multiverse" | tee -a /etc/apt/sources.list
    

    Install Asterisk

      apt-get update 
      apt-get install bbb-voice-conference
      

      Install BBB

      apt-get install bigbluebutton
      

      Restart service and check for any errors in configuration

      bbb-conf --clean
      bbb-conf --check
      

      Access BBB at http://yourip
      Make sure port 80 is not blocked by your server and no other service except nginx
      is listening on port 80.

      Create meeting rooms with BBB wordpress plugin

    Add php support to nginx

    apt-get install python-software-properties
    add-apt-repository ppa:brianmercer/php
    apt-get update
    apt-get install php5-fpm
    

    Edit /etc/php5/fpm/php5-fpm to include

    listen = /var/run/php5-fpm.socket
    

    Add the following line to /etc/nginx/sites-enabled/bigbluebutton

    location ~ .php$ {
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_pass   unix:/var/run/php5-fpm.socket;
        fastcgi_param  SCRIPT_FILENAME  /var/www/bigbluebutton-default$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
        fastcgi_index index.php;
      }
    

    Restart nginx and php5-fpm

    /etc/init.d/php5-fpm restart
    /etc/init.d/nginx restart
    

    Install wordpress

      cd /usr/local/src
      wget -c http://wordpress.org/latest.tgz
      tar xzvf latest.tgz
      mv latest /var/www/bigbluebutton-default/bbbwordpress
      cd /var/www/bigbluebutton-default/bbbwordpress
      cp wp-config-sample.php wp-config.php
      

      Create mysql database for worpress
      mysql -u root -p (enter your password, or if there is no password set,just type
      mysql -u root)

      create database bbbwordpress;

      grant all privileges on *.bbbwordpress to bbbuser@localhost identified by 'yourpass';
      exit;
      

      Then edit wp-config.php

      define('DB_NAME', 'bbbwordpress');
      define('DB_USER', 'bbbuser');
      define('DB_PASSWORD', 'yourpass');
      

      Go to http://yourip/wordpress and set administrative user and password. Then login to the administrative
      dashboard and click on the plugins in the left hand pane. In the ‘search plugin’ box, type “bigbluebutton”
      and install/activate it.

      To integrate it with BBB click on Appearance–>Widgets–>BigBlueButton and drag/drop it to the content area.
      GO to Settings–> put the URL to your BBB link http://yourip/bigbluebutton and insert the salt from the
      setting page.

      Within the administrative wordpress dashboard you can create meetings and the passwords for participants/moderator.
      You should be able to access the rooms in http://yourip/wordpress/.

        Sources

      http://code.google.com/p/bigbluebutton/wiki/InstallationUbuntu
      Enable PHP on BigBlueButton .71 Server
      http://wordpress.org/extend/plugins/bigbluebutton/

This so simple bash script ejects the cdrom and immediately pulls it back repeatedly, till the script is manually stopped.

while [ 1 ]
do
eject -T /dev/cdrom
sleep 10
eject -T /dev/cdrom
sleep 10
done

check it out, it can even be used as a baby rocker!