Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so dont bother with any of their useless mail servers here and just use oauth login instead. Thank the nice Russians for causing that. :)

Paste

Pasted as Bash by registered user uwe ( 12 years ago )
#!/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

 

Revise this Paste

Your Name: Code Language: