Yahoo finance rates convert (for educational purposes only)

<?php
class Rates {
	function Convert($amount,$from,$to){
		$url="http://adsynth-ofx-quotewidget-prod.herokuapp.com/api/1";
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL,$url);
		curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, '{"method":"spotRateHistory","data":{"base":"'.$from.'","term":"'.$to.'","period":"week"}}');
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
		curl_setopt($ch, CURLOPT_REFERER, "https://widget-yahoo.ofx.com/");
		$html = curl_exec ($ch);
		curl_close ($ch);
		$veri=json_decode($html,true);
		return $veri["data"]["CurrentInterbankRate"]*$amount;
	}
}
$kur = new Rates();
echo $kur->Convert(1, 'USD', 'GBP');

Apply and revert patch

# Test before apply
patch -p1 --dry-run > /path/to/some.patch
# Apply patch
patch -p1 > /path/to/some.patch
# Revert
patch -p1 -R > /path/to/some.patch

Creating patch

git format-patch -1 SHA5

Convert mp4 to mp3

ffmpeg -i wombsounds.mp4 -f mp3 -ab 192000 -vn wombsounds.mp3

Paypal buy now button html code

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_self">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="imran.aghayev@yahoo.co.uk"/>
<input type="hidden" name="item_name" value="Itemname"/>
<input type="hidden" name="item_number" value="1"/>
<input type="hidden" name="amount" value="150"/>
<input type="hidden" name="currency_code" value="GBP"/>
<input type="hidden" name="lc" value="UK"/>
<input type="hidden" name="bn" value="btn_buynow_SM.gif"/>
<input type="hidden" name="weight_unit" value="kgs"/>
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynow_SM.gif" name="submit" alt="Make payments with PayPal"/>
</form>

Scrum methodology events

1. Sprint Refinement – when a team goes through the backlog, score points, etc. It focuses on a long term goals
2. Scrum Planning – when a team go through the backlog and discuss tickets to be added to oncoming Sprint, assign to developer. It focuses on a short term, goals within next Sprint.
3. Scrum Retro(spective) – when a team discuss finished Sprint, how did it go, what could have been done better.
4. Scrum Review – when a project manager demonstrates achievements of last Sprint/s to the management.

Mysql convert timestamp to date

SELECT DATE_FORMAT(FROM_UNIXTIME(yourfield), '%e %b %Y') FROM yourtable;

PHP arrays comparision to Javascript and Java

Associative arrays in PHP = Javascript Objects written as name value pairs = Hash maps in Java

Php determine every 5th record in interation

<?php
 
$x = 5;
 
for($i=0; $i<10; $i++)
{
    if($i % $x == 0)
    {
       echo 'yes';
    }
}

Result: yes yes

Explanation: 5 % 5 has remainder 0 (fully divided), 10 % 5 has remainder 0 (fully divided)

Split file and having header kept in all generated files

head -n 1 upload_images.csv > header.csv; tail -n +2 upload_images.csv | split --numeric-suffixes=1 --additional-suffix=.csv -l 320 - --filter='sh -c "{ head -n1 header.csv; cat; } > $FILE"'
 split filename.csv --numeric-suffixes=1 --additional-suffix=.csv -l 50

Result: 50 files named as x{number}.csv