Activate Free SSL Certificate for Website – Cloudflare


Hits: 787  

Google will soon shame all websites that are unencrypted also Google count HTTPS for ranking factor. Cloudflare provide Free SSL Certificate in your website DNS system. You just need to edit your DNS records / Name-servers

Cloudflare HTTPS protects website from Security Vulnerabilities and DDoS attacks.

Origin Server (Your Domain) ===== HTTP =====> CloudFlare ===== HTTPS =====> Visitors

Setting up your free Cloudflare Flexible SSL

1. Sign up to Cloudflare.com

2. Enter your domain name and Begin Scan

3. Verify all Your DNS Records for your domain

4. Select Free Cloudflare Plan then follow all steps

5. Change Your Nameservers in your domain control panel

6. Goto Crypto tab then activate free SSL. Choose Flexible Type.
Cloudflare will take approx 24 hours to activate new SSL certificate.

7. Other Cloudflare settings for caching

8. For wordpress websites add Page Rules in CloudFlare

You can use WordPress Plugins

CloudFlare Flexible SSL

Cloudflare

WordPress Force HTTPS

Really Simple SSL

SSL Insecure Content Fixer

OR

1. http://www.svnlabs.in/wp-admin/*
Always Online: On, Cache Level: Bypass

2. http://www.svnlabs.in/wp-login.php*
Always Online: On, Cache Level: Bypass

3. http://svnlabs.in/*
Forwarding URL: (Status Code: 301 – Permanent Redirect, Url: https://www.svnlabs.in/$1)

Free SSL

Google App Engine – Downloading source code


Hits: 3708  

I am working on my old project on Google App Engine… so I need to download old source code from Google App Engine ….

We can download source code for application by appcfg.py with the download_app action in the Python SDK command-line tool:

> appcfg.py download_app -A <your_app_id> -V <your_app_version> <output-dir>

But it is giving error …

D:\Program Files\Google\google_appengine>appcfg.py download_app -A svnlabs -V 1 E:/AppEngine/svnlabs
Usage: appcfg.py [options] download_app -A app_id [ -V version ]

appcfg.py: error: “download_app” expects one non-option argument, found 3. 🙁

D:\Program Files\Google\google_appengine>appcfg.py download_app -A svnlabs -V 1 E:/AppEngine/svnlabs

D:\Program Files\Google\google_appengine>appcfg.py download_app help
Usage: appcfg.py [options] download_app -A app_id [ -V version ]

appcfg.py: error: You must specify an app ID via -A or – -application. 

Solution

> appcfg.py download_app – -application=<your_app_id> – -version=<your_app_version> <output-dir> 🙂

D:\Program Files\Google\google_appengine>appcfg.py download_app – -application=svnlabs E:/AppEngine/svnlabs
01:50 PM Host: appengine.google.com
01:50 PM Fetching file list…
Email: svnlabs@domain.com
Password for svnlabs@domain.com:

Use an application-specific password instead of your regular account password.
See http://www.google.com/support/accounts/bin/answer.py?answer=185833
However, now the recommended way to log in is using OAuth2. See
https://developers.google.com/appengine/docs/python/tools/uploadinganapp#Python_Password-less_login_with_OAuth2

Google IssuedAuthSubTokens accesscode

Email: svnlabs@domain.com
Password for svnlabs@domain.com:
01:55 PM Fetching files…
01:55 PM [1/41] WEB-INF/lib/script-10.jar
01:55 PM [2/41] WEB-INF/classes/META-INF/jdoconfig.xml
01:55 PM [3/41] svnlabs.php

.
.
.

GAE - Download

Install Wowza Media Server for Google Compute Engine


Hits: 4317  

Hope you really enjoyed our articles about Google Compute Engine..

Install Apache, PHP, MySQL on Google Compute Engine

Build your business on Google Cloud Platform

Install Red5 on Google Compute Engine

First you need to install Google Cloud platform command-line tools https://developers.google.com/compute/docs/gcutil

$ wget https://code.google.com/p/google-compute-engine-tools/downloads/detail?name=gcutil-1.9.0.tar.gz
$ sudo apt-get install unzip

$ export PATH=${PATH}:$HOME/gcutil-1.9.1
$ sudo ln -s /usr/local/share/gcutil-1.9.1/gcutil /usr/local/bin/gcutil

Then make sure you have Ports used for Wowza streaming
http://www.wowza.com/forums/content.php?217#openPorts

TCP 1935: RTMP (all variants)
TCP 8084-8085: JMX/JConsole monitoring and administration
TCP 8086: HTTP administration
TCP 80: Apple HTTP Live Streaming (Apple HLS), Adobe HTTP Dynamic Streaming (Adobe HDS), Microsoft Smooth Streaming, MPEG-DASH streaming, RTMPT
TCP 443: RTMPS, HTTPS
TCP 554: RTSP

$ gcutil addfirewall red5 –description=”Let open port 5080.” –allowed=”tcp:5080″
$ gcutil addfirewall rtsp –description=”Let open 554 rtmp port.” –allowed=”tcp:554″
$ gcutil addfirewall rtmp –description=”Let open 1935 rtmp port.” –allowed=”tcp:1935″
$ gcutil addfirewall http2 –description=”Let open port 5080.” –allowed=”tcp:8086″
$ gcutil getfirewall

Check Java Version or Install

$ sudo apt-get update
$ sudo apt-get install java-package
$ sudo apt-get install openjdk-6-jdk
$ sudo apt-get install openjdk-6-jre

Now read Install Wowza Examples

Download Wowza and install examples

$ wget http://www.wowza.com/downloads/WowzaMediaServer-3-6-2/WowzaMediaServer-3.6.2.deb.bin
$ chmod +x WowzaMediaServer-3.6.2.deb.bin
$ ./WowzaMediaServer-3.6.2.deb.bin
$ cd /usr/local/WowzaMediaServer/bin
$ sudo ./startup.sh
$ cd /usr/local/WowzaMediaServer-3.6.2/examples
$ sudo chmod +x installall.sh
$ sudo ./installall.sh

$ sudo service WowzaMediaServer start

Please check Wowza Forum for more help…
http://www.wowza.com/forums/content.php?560-How-to-set-up-Wowza-for-Google-Compute-Engine

MP3 waveforms with PHP


Hits: 7203  

If you are thinking how soundcloud.com generates the waveform for sound MP3 player?

soundcloud-waveform

There are some audio processing libraries used to process MP3 files to WAV and then PNG / SVG images..

MP3 to WAV to PNG

1. LAME MP3 encoder/decoder

$ lame input.mp3 -f -m m -b 16 –resample 8 resampled.mp3 && lame –decode resampled.mp3 output.wav

2. SOX – Sound eXchange

$ sox output.wav −n spectrogram
$ sox output.wav -n spectrogram -Y 140 -l -r -o output.png

3. wav2png – Creates waveform pngs out of audio files

$ sox mp3-song.mp3 -c 1 -t wav – | wav2png -o mp3-song.png /dev/stdin
$ wav2png –foreground-color=2e4562ff –background-color=00000000 -o  output.png   input.wav

4. wavesurfer.js is a customizable audio waveform visualization, built on top of Web Audio API and HTML5 Canvas

wavesurfer.js

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/wavesurfer.js/1.4.0/wavesurfer.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/wavesurfer.js/1.4.0/plugin/wavesurfer.playlist.min.js"></script>

<div id="waveform"></div>

<script>

var wavesurfer = WaveSurfer.create({
container: '#waveform',
waveColor: '#00FF00',
progressColor: '#FF0000'
});


wavesurfer.load([MP3-File-URL]);

wavesurfer.on('ready', function () {
wavesurfer.play();
$('.waveform__duration').text( formatTime(wavesurfer.getDuration()) );
});

wavesurfer.on('audioprocess', function () {
$('.waveform__counter').text( formatTime(wavesurfer.getCurrentTime()) );
});

</script>

WaveForm generated using SOX

WaveForm Generator using SOX

Links:

https://github.com/afreiday/php-waveform-png
https://github.com/afreiday/php-waveform-svg
https://github.com/beschulz/wav2png
https://github.com/beschulz/wav2json
http://www.rarewares.org/mp3-lame-bundle.php

Liquidsoap GStreamer


Hits: 5880  

LiquidSoap Liquidsoap is a programming language to manage audio and video source streams for Icecast Radio server.

Liquidsoap is a powerful and flexible language for describing, creating or transforming streams. It offers rich operators and library that you can be used for making Icecast Radio Server.

Now Play Your Favorite Radio FM Stream in HTML5 Player…..
Live Audio Streaming, Internet Radio Player

Features

* It can play icecast stream from files, playlists, directories or scripted playlists.
* Liquidsoap used for scheduling of source streams.
* It help to Mix sources streams.
* It allows queuing of user requests.
* It allows sound compression, normalization, echo, volume, Blank detection.
* It is useful for rewriting and inserting Metadata in Radio Stream.
* It can play live stream play files and streams like Last.fm.
* It can output to Radio Server Icecast/Shoutcast (MP3/Ogg).
* It also support Video streams generation.

You can use it to stream RTMP MP3 stream to Icecast/Shoutcast using mplayer, rtmpdump or gstreamer …

GStreamer- open source multimedia framework

GStreamer provide a rich library to manage streaming audio/video with complex audio (mixing) and video (non-linear editing) processing.

#!/usr/bin/liquidsoap
set(“log.file.path”,”logs/gs.log”)
set(“log.file”,true)
set(“log.stdout”,true)
….
….
gst = input.gstreamer.audio(pipeline=”playbin uri=rtmp://server.com/livestream.mp3″)
output.icecast(%mp3(), host = “localhost”, port = 8000, password = “xxxxxx”, mount = “gst stream”, fallible=true, gst)

Common Errors

File format problem can display ^M characters

😉 : set ff=unix and then : x in vi editor

init: security exit, root euid (user)

😉 you need to run liq file with non root user

the variable input.gstreamer.audio used here has not been previously defined

😉 Define variable “input.gstreamer.audio” .. .find here https://github.com/savonet/liquidsoap/tree/master/scripts

Stay connected for more Audio / Video Programming ….

Installing Apache, MySQL, PHP in Gentoo Server


Hits: 9470  

All commands are performed as root to install Apache, MySQL, PHP and phpMyAdmin in Gentoo Linux Server.

1. Update your System

# emerge –sync

2. Install Apache Webserver

# emerge apache

The web server ROOT is in /var/www/localhost/htdocs/

# /etc/init.d/apache2 start

Then go to http://server-ip/
it works on gentoo

Add apache2 to the startup script
# rc-update -v add apache2 default

3. Install MySQL Database

# emerge mysql

Install MySQL database
# /usr/bin/mysql_install_db

Start MySQL Server
# /etc/init.d/mysql start

Change MySQL User Password
# /usr/bin/mysqladmin -u root -h localhost password ‘new-password’

Test MySQL Server
# /etc/init.d/mysql restart

Add MySQL to the startup script
# rc-update -v add mysql default

4. Install the PHP with modules

# USE=”cli cgi apache2 xml mysql mysqli” emerge ‘dev-lang/php’

Before you can use PHP with Apache… Edit /etc/conf.d/apache2 and add “-D PHP5″ to APACHE2_OPTS

It looks like
APACHE2_OPTS=”-D DEFAULT_VHOST -D INFO -D LANGUAGE -D SSL -D SSL_DEFAULT_VHOST -D PHP5″

You can find php.ini in /etc/php/apache2-php5.4

then restart apache server
# /etc/init.d/apache2 restart

Then go to http://server-ip/info.php (Create phpinfo() file)

phpinfo on gentoo
phpinfo on Gentoo

phpinfo php

phpinfo mysql

5. Install phpMyAdmin

# emerge -av phpmyadmin

Then go to http://server-ip/phpmyadmin/

phpMyAdmin on gentoo
phpMyAdmin on Gentoo

Creating Zip Without Recording ROOT Paths


Hits: 4095  

Simply use chdir() to change the working directory before you exec()

Or you can use ….

exec(“cd /var/www/html/media; zip -r -9 Media.zip . 2>&1”, $log);

exec(“mv /var/www/html/media/Media.zip /var/www/html/Media.zip”);

Get zip file size

exec(“ls -ls /var/www/html/Media.zip | awk ‘{print $6}’ 2>&1”, $size);

$zipsize = implode(” “, $size);

Without this solution

Length Date Time Name
——– —- —- —-
0 03-08-13 15:10 /var/www/html/media/dialogs/
125305 08-07-12 16:31 /var/www/html/media/dialogs/1.3.mp3
125305 08-07-12 16:33 /var/www/html/media/dialogs/1.5.mp3
184864 08-07-12 16:32 /var/www/html/media/dialogs/1.4.mp3
125305 08-07-12 16:30 /var/www/html/media/dialogs/1.1.mp3
125305 02-24-13 16:48 /var/www/html/media/dialogs/1.2.mp3
125305 08-07-12 16:34 /var/www/html/media/dialogs/1.6.mp3

With this solution

Length Date Time Name
——– —- —- —-
0 03-08-13 16:40 dialogs/
125305 08-07-12 16:51 dialogs/1.3.mp3
125305 08-07-12 16:53 dialogs/1.5.mp3
184864 08-07-12 16:52 dialogs/1.4.mp3
125305 08-07-12 16:50 dialogs/1.1.mp3
125305 02-24-13 16:58 dialogs/1.2.mp3
125305 08-07-12 17:04 dialogs/1.6.mp3

Install Airtime – open source radio automation software


Hits: 8245  

Airtime is open source radio automation software (GPL v3) for GNU/Linux platforms. It’s recommend installing on Ubuntu Linux 12.04 LTS or Debian Squeeze on a computer with at least a 1 GHz processor and 512 MB of RAM for a Server Edition OS or 1GB of RAM for a Desktop Edition OS.

Download airtime-easy-setup

$ sudo wget http://apt.sourcefabric.org/misc/airtime-easy-setup.deb
$ sudo apt-get install gdebi

$ sudo gdebi airtime-easy-setup.deb

Airtime-Icecast
Airtime-Icecast

Unpacking airtime-easy-setup (from airtime-easy-setup.deb) …
Setting up airtime-easy-setup (2.3.0-1) …
Installing Sourcefabric package signing key…
OK
Setting up Airtime for Etc/UTC timezone…
Setting Icecast and Airtime domain names to ip-10-xxx-yy-74.ec2.internal…
Setting defaults for non-interactive installation…
Checking that the server has a UTF-8 locale…
en_US.UTF-8 is the default locale on this server and appears to support UTF-8 encoding.

Now please run the commands:

sudo apt-get update
sudo apt-get install airtime

After that, installation of Airtime should be complete in a couple of minutes.

You should then be able to log in to Airtime at http://ip-10-xxx-yy-74.ec2.internal/
Processing triggers for man-db …

Install Airtime

$ sudo apt-get update
$ sudo apt-get install airtime

*** Verifying your system environment, running airtime-check-system ***
AIRTIME_STATUS_URL = http://ip-10-xxx-yy-74.ec2.internal:80/api/status/format/json/api_key/%%api_key%%
AIRTIME_SERVER_RESPONDING = OK
KERNEL_VERSION = 3.5.0-21-generic
MACHINE_ARCHITECTURE = x86_64
TOTAL_MEMORY_MBYTES = 604072
TOTAL_SWAP_MBYTES = 0
AIRTIME_VERSION = 2.3.0
OS = Ubuntu 12.10 x86_64
CPU = Intel(R) Xeon(R) CPU E5430 @ 2.66GHz
WEB_SERVER = Apache/2.2.22 (Ubuntu)
PLAYOUT_ENGINE_PROCESS_ID = 19766
PLAYOUT_ENGINE_RUNNING_SECONDS = 32
PLAYOUT_ENGINE_MEM_PERC = 2.6%
PLAYOUT_ENGINE_CPU_PERC = 0.9%
LIQUIDSOAP_PROCESS_ID = 19801
LIQUIDSOAP_RUNNING_SECONDS = 31
LIQUIDSOAP_MEM_PERC = 3.4%
LIQUIDSOAP_CPU_PERC = 7.9%
MEDIA_MONITOR_PROCESS_ID = 19701
MEDIA_MONITOR_RUNNING_SECONDS = 38
MEDIA_MONITOR_MEM_PERC = 2.4%
MEDIA_MONITOR_CPU_PERC = 0.0%
RABBITMQ_PROCESS_ID = 16705
RABBITMQ_RUNNING_SECONDS = 427
RABBITMQ_MEM_PERC = 4.8%
RABBITMQ_CPU_PERC = 0.9%
— Your installation of Airtime looks OK!

******************************* Install Complete *******************************
Setting up liquidsoap-plugin-faad (1.0.1+repack1-1) …
Processing triggers for libc-bin …
ldconfig deferred processing now taking place

Airtime
Airtime

Help: http://en.flossmanuals.net/airtime-en-2-3/easy-setup/

Amazon S3 Expiring Link


Hits: 9923  

I was working on Amazon S3 Cloud HTML5 MP3 Player for S3 Bucket security and Expiring Media links.

Amazon S3 Cloud HTML5 MP3 Player
Amazon S3 Cloud HTML5 MP3 Player
<?php

  if(!function_exists('el_crypto_hmacSHA1')){
      /**
      * Calculate the HMAC SHA1 hash of a string.
      *
      * @param string $key The key to hash against
      * @param string $data The data to hash
      * @param int $blocksize Optional blocksize
      * @return string HMAC SHA1
      */
      function el_crypto_hmacSHA1($key,$data,$blocksize=64){
          if(strlen($key)>$blocksize)$key=pack('H*',sha1($key));
          $key=str_pad($key,$blocksize,chr(0x00));
          $ipad=str_repeat(chr(0x36),$blocksize);
          $opad=str_repeat(chr(0x5c),$blocksize);
          $hmac=pack('H*',sha1(
              ($key^$opad).pack('H*',sha1(
                  ($key^$ipad).$data
              ))
          ));
          returnbase64_encode($hmac);
      }
  }

  if(!function_exists('el_s3_getTemporaryLink')){
      /**
      * Create temporary URLs to your protected Amazon S3 files.
      *
      * @param string $accessKey Your Amazon S3 access key
      * @param string $secretKey Your Amazon S3 secret key
      * @param string $bucket The bucket (bucket.s3.amazonaws.com)
      * @param string $path The target file path
      * @param int $expires In minutes
      * @return string Temporary Amazon S3 URL
      * @see http://awsdocs.s3.amazonaws.com/S3/20060301/s3-dg-20060301.pdf
      */
      function el_s3_getTemporaryLink($accessKey,$secretKey,$bucket,$path,$expires=5){
          // Calculate expiry time
          $expires=time()+intval(floatval($expires)*60);
          // Fix the path; encode and sanitize
          $path=str_replace('%2F','/',rawurlencode($path=ltrim($path,'/')));
          // Path for signature starts with the bucket
          $signpath='/'.$bucket.'/'.$path;
          // S3 friendly string to sign
          $signsz=implode("\n",$pieces=array('GET',null,null,$expires,$signpath));
          // Calculate the hash
          $signature= el_crypto_hmacSHA1($secretKey,$signsz);
          // Glue the URL ...
          $url=sprintf('http://%s.s3.amazonaws.com/%s',$bucket,$path);
          // ... to the query string ...
          $qs=http_build_query($pieces=array(
              'AWSAccessKeyId'=>$accessKey,
              'Expires'=>$expires,
              'Signature'=>$signature,
          ));a
          // ... and return the URL!
          return$url.'?'.$qs;
      }
  }

  ?>

Uses:

$ExpiringLink = el_s3_getTemporaryLink(‘AWS-KEY’, ‘AWS-SECRET-KEY’, ‘BUCKET’, ‘FILENAME’, ‘EXPIRING-TIME’);

Demo Amazon S3 Cloud HTML5 MP3 Player

Reference: http://snipplr.com/view/46753.57507/

Backup Disk Snapshot on Google Compute Engine


Hits: 8808  

Snapshots are stored in Google Cloud Storage, which is secure, incredibly large, and remarkably inexpensive. You might want to think about whether the labor involved in saving snapshots on your local PC, with all the attendant risks of data loss.

For pricing, see
https://cloud.google.com/pricing/cloud-storage. For example, if you have a 10 GB snapshot, that’s going to cost you $0.85/ month.

Overview Google Compute Engine
Overview Google Compute Engine

You can read more about here ….

https://cloud.google.com/pricing/compute-engine

https://developers.google.com/compute/docs/disks

1) Create a snapshot with the gcutil getsnapshot command.

$ gcutil addsnapshot red5 –source_disk red5 –zone us-east1-a

Snapshot Google Compute Engine
Snapshot Google Compute Engine

2) Create a new persistent disk with that snapshot

Disk Google Compute Engine
Disk Google Compute Engine

3) Create an instance with that persistent disk

Instance on Google Compute Engine
Instance on Google Compute Engine

4) Create an image of that instance

Operations Google Compute Engine
Operations Google Compute Engine

5) Save the image on the instance

$ sudo python /usr/share/imagebundle/image_bundle.py -b red5 -o /tmp

6) Download the image of the instance

You can find archived image in current user folder i.e. /home/svnlabs/red5/096df5a918c746f965338bda6b4c886ac4097c08.image.tar.gz