Jun 28, 2017

shell script to create a set of each 3 values within a range

I am trying to create a set of each 3 values within a range using Shell script.


Range of values     : 512 -885
Column difference: 12
Column increment: 3

    512 524 536
    515 527 539
    518 530 542
                 ......
    860 872 884
    863 875 513  --> Column 3 Reset
    866 878 516
    869 881 519
    872 884 522
    875 513 525  --> Column 2 Reset
    878 515 528
    881 518 531
    884 521 534
    513 524 537
    ....

Shell Script:

#!/bin/bash

start=512
end=885
incr=12
col1=$start
col2=$(($col1+$incr))
col3=$(($col2+$incr))
colincr=3
for z in {1..50}
do
    if [ $col1 -gt $end ]
    then
        col1=$(($(($col1 % $end))+$start-1))
    fi
    if [ $col2 -gt $end ]
    then
        col2=$(($(($col2 % $end))+$start-1))
    fi
    if [ $col3 -gt $end ]
    then
        col3=$(($(($col3 % $end))+$start-1))
    fi
    printf '%-4s%-4s%-4s\n' $col1 $col2 $col3
    col1=`expr $col1 + $colincr`
    col2=`expr $col2 + $colincr`
    col3=`expr $col3 + $colincr`
    
done





Jun 20, 2017

Hosting a PHP page from a yaws server using FastCGI on WINDOWS

If you are looking for a way to host or run a PHP page on YAWS server using PHP FastCGI process, just follow the below steps.


  • Place the PHP file/s in doc root folder
  • Change the yaws.conf file to redirect PHP script to run on FastCGI service.
                <server localhost>
                        port = 9009 
                        listen = 0.0.0.0
                        docroot = "C:\Program Files (x86)\Yaws-2.0.2/test"
                        auth_log = true
                        appmods = <cgi-bin, yaws_appmod_cgi>
                        php_handler = <fcgi, 127.0.0.1:54321>
                </server>

  • Start the YAWS server and confirm the errors.
  • Start the php FastCGI service.
    • To start on Windows: 
      • Download the XAMPP application from the below link and install it.
      • https://www.apachefriends.org/download.html
      • c:\xampp\php>php-cgi.exe -b 127.0.0.1:54321



Apr 20, 2017

amazon.in 503 service unavailable - oops Red Mi 4A sales

Amazon Red Mi 4A sales are huge. Due to this amazon.in website access got slowdown and during the peak time shown 503 services unavailable page from amazon.in


It's rush hour and traffic is piling up on that page. Please try again in a short while.If you were trying to place an order, it will not have been processed at this time.