|
<!DOCTYPE HTML> |
|
<html lang="en"> |
|
<head> |
|
<link href="http://pigshell.com/v/0.6.3-pre1/pigshell.css" rel="stylesheet"/> |
|
</head> |
|
<body> |
|
<div class="pigshell"> |
|
<div class="pmain2" id="pmain2"> |
|
<!--[if lte IE 11]> |
|
<p class="warning">Pigshell is known to work on recent (~2013-14) versions of Firefox and Chrome. It is unlikely to work on other browsers like IE and platforms like the iPad.</p> |
|
</p> |
|
<![endif]--> |
|
<p id="loading" class="info">Loading kernel...</p> |
|
</div> |
|
</div> |
|
<![if gte IE 11]> |
|
<script src="http://pigshell.com/v/0.6.3-pre1/libs.js"></script> |
|
<script src="http://pigshell.com/v/0.6.3-pre1/pigshell.js"></script> |
|
<script type="text/javascript"> |
|
$(document).ready(function() { |
|
var ps = pigshell, |
|
sorry = "Pigshell is known to work on recent (~2013-14) versions of Firefox and Chrome. It is unlikely to work on other browsers like IE and platforms like the iPad."; |
|
|
|
if (!ps.compatible()) { |
|
$("#pmain2").prepend("<p class='warning'>" + sorry + "</p>"); |
|
} |
|
ps.HttpFS.defaults.tx = 'direct'; |
|
var script = ps.multiline(function() {/* |
|
mount http://pigshell.com/v/$(uname -r)/usr/ /usr |
|
sh -s /etc/profile |
|
|
|
sh -s /usr/share/misc/countries.sh |
|
|
|
# Set Quandl auth_token if you have one, leave blank for anon access |
|
auth_token='' |
|
url='http://www.quandl.com/api/v1/multisets.csv?columns='$(sjoin , ODA.$countries^_NGDPD.1)'&trim_end=2012-12-31'$"auth_token |
|
cat $url > world-gdp.csv |
|
|
|
# Did we get it? If not, get a cached copy |
|
if [ $(ls world-gdp.csv | jf 'x.size') = 0 ]; then cp http://unixtheweb.com/pmedia/fun-with-quandl/world-gdp.csv .; fi |
|
|
|
# Process CSV, "rename" columns and read it into `gdp` |
|
cat world-gdp.csv | csv2js | rename -f $(sjoin , ODA.$countries^"_NGDPD - Value") -t $(sjoin , $countries) | read gdp |
|
|
|
# BRICS GDP |
|
echo $gdp | cut -f "Date,BRA,RUS,IND,AUS" | chart -t tseries -o ytitle="GDP (billion USD)",title="GDP at Current Prices" |
|
*/}); |
|
ps.init({rooturi: 'http://pigshell.com/v/0.6.3-pre1/root.tar', |
|
embedded: true}, ps.hef('#pmain2', function() { |
|
var p = ps.popen("ish -N ish1", {stdout: "#pmain2"}); |
|
p.read({}, ps.hef('#pmain2', function(){})); |
|
ps.publish('ish1', script); |
|
})); |
|
}); |
|
</script> |
|
<![endif]> |
|
</body> |
|
</html> |