#!/bin/bash

md_btc=1EgLboTKRgBXUxe98R8sp7siipmb94KdrV
hashrate=$[720*3]

ltcd=$(curl -s http://erde.lu/mine/ltcdiff)
ltcb=$(curl -s http://erde.lu/mine/ltcblock)
ltcbtc=$(curl -s http://erde.lu/mine/ltcbtc)


tmp=$(mktemp)

curl -s http://www.middlecoin.com/reports/${md_btc}.json | ~/bin/json.sh -b | egrep 'amount|time' > $tmp

oldnum=0

while read l v; do
#    num=$(echo "$l" | cut -d, -f2)
    t=$(echo "$l" | cut -d, -f3)
#    if [ $oldnum -ne $num ]; then
#        oldnum=$num
#        printf "%s\t%s\n" $d ${amount/\"/}
#    fi
    case "$t" in
        '"amount"]') amount=${v/\"/} ;;
        '"time"]') time=$v; d=$(date -d "@$time" +%F) ;;
    esac
done < $tmp

ltc=$(echo "scale=8; $hashrate/(($ltcd*2^32)/($ltcb*1000)/3600/24)" | bc)
btc=$(echo "scale=8; $ltc*$ltcbtc" | bc)

printf "%s\t%s\t%s\t%s\t%s\n" $d ${amount/\"/} $ltcd $ltc $btc

rm -f $tmp

Add a code snippet to your website: www.paste.org