Chuck Norris em seu terminal

Bem, pelo menos, piadas sobre ele.

Uso: (assumindo que o nome do arquivo seja “chuck-norris”)

chuck-norris 5

Resultado:

* When Chuck Norris plays Monopoly, it affects the actual world economy.

* Chuck Norris doesn't stub his toes. He accidentally destroys chairs,
bedframes, and sidewalks.


* What many people dont know is Chuck Norris is the founder of planned

parenthood. Not even unborn children can escape his wrath.


* Wilt Chamberlain claims to have slept with more than 20,000 women in his

lifetime. Chuck Norris calls this "a slow Tuesday."


* With the rising cost of gasoline, Chuck Norris is beginning to worry

about his drinking habit.

Fonte: (Windows com Xampp e Git Shell ou Cygwin instalado)

#!C:xamppphpphp.exe -q
<?php

$amount
= 1;
if (isset($argv[1])) {
$amount
= (int) $argv[1];
}
if (!$amount) {
$amount
= 1;
}

$ch
= curl_init();
curl_setopt_array
($ch, array(
CURLOPT_RETURNTRANSFER
=> 1,
CURLOPT_URL
=> 'http://api.icndb.com/jokes/random/'.((string) $amount)
));
$json
= curl_exec($ch);
curl_close
($ch);

$data
= json_decode($json);
foreach ($data->value as $joke) {
$joke_msg
= wordwrap("n * ".html_entity_decode($joke->joke), 75, "n ", TRUE)."n";
echo $joke_msg
;
}