PS:336 – Relaxing by Coding.

So one of my side little projects of late has been the coding of tools to better keep me up-to-date on my coins – my previous post (334) I mentioned the small coding project and I think I may write a small page for it and update the code as I have updates, currently on version .04:

<?php

/****
Coins.php (v.04)

A simple API call to get the value of a coin in the user's desired currency, great for using in Google Sheets (Use: =IMPORTDATA("yoururl") or if you simply want to grab
the current value of a certain coin. Currently geared towards USD, but hope in next version to add proper currency markings for the amount conversion.


## Changelog

.01 -   First Release
.02 -   Adjustments to code & calling methods.
        Changed from XML output to plaintext for use of IMPORTDATA vs IMPORTXML
.03 -   Removed dual posting of plaintext price for import & added amount conversion.
        Commented code.
.04 -   Added Conversion for ATM without Value Text for Onion pull - Also adding $ for easier formatting on Onion curl call.
***/


//Get Data
$url = file_get_contents("https://min-api.cryptocompare.com/data/price?fsym=".$_REQUEST['coin']."&tsyms=".$_REQUEST['curr']."");
$json = json_decode($url,true);
//Check for Amount to Convert
if ($_REQUEST['atm'] != '') {
$value = $_REQUEST['atm'] * $json[$_REQUEST['curr']];
$tvalue = round($value,2);
echo "$".$tvalue;
} else {
//no amount? provide plaintext response for dollar amount.
print $json[$_REQUEST['curr']];
}
?>

Well, it’s quite handy, feel free to use it if you need to, but basically, it’s allowed me to use my Ometa2+’s OLED screen to every 5 minutes update the current value of coins! Here’s a peek:

Enjoying it a lot, really neat to look over and not have to re-open my Google Docs, just a glance and the screen presents all the goodies.

Maybe I’ll write it all up and send it over to the Onion forums, it is simple, purely informational, but thinking about maybe converting a bitcoin icon -> LCD file and place it on the right side? Long-term if the value is huge (they say it will be) then it will overlap, but for now, a bash script, php script, and a cron job give me some info at a glance.

PS:335 – Dental Day… Bleh.

Today was a day of dental work. I went in for a consult on my tooth pain to find that something I’ve been saying to 2 previous dentists, as well as my current, was true: My Tooth is Cracked.

Well, the specialist confirmed it, of course correcting me on where the crack was, and the bummer news that the nerve was dying a slow and painful death thus the reason for my some-days-pain.

So today was a root canal. I’ve had one before which wasn’t bad, but this time…. ouch. ouch. ouch. Not fun, apparently I had “two canals” in which he found one hiding behind some bone? Unless I heard him wrong. At some point I’ll be honest I was in so much pain – I cried and was ready to run away.

I survived, in fact just took my heavy hitter pain meds, so far so good, still feeling pain, but I figure at least a full 30 before they even begin to take a dent off, but the hope is it’ll let me get back to sleep.

Still, need to get a crown on it, for now, just want to rest and try and if possible get some work done. Lots to do, and I know I should rest, but just that need to knock some things off the to-do list.

Who knows maybe this weekend I’ll be running smoothly, or at least getting some much-needed rest. Night all.

PS:334 – Small Coding Project

While I’ve wrapped up a few things on the docket (foof) I took a little time tonight to write a small tweak for a project of my own related to crypto currency.

I replicated a Google Spreadsheet (link) from BiteSize Bitcoin (link) and while it was designed around my Litecoin investment, you can just as easily adapt it to handle Bitcoin or any other alt-coin you like, it simply helps log your transactions.

Now I have a much more complex version rolling now which is a single sheet for all my assets across alt-coins etc. and it contains things like the type of transaction (purchase, trade, mining) as well as some general profit statements across the board.

Now the one thing I wanted to have was a live updated current coin cost, and I used an importXML function someone posted on a video, however, it was slow & tended to time out with “too large” of a dataset to crunch so I wrote this small PHP app:

<?php
$url = file_get_contents("https://min-api.cryptocompare.com/data/price?fsym=".$_REQUEST['coin']."&tsyms=".$_REQUEST['curr']."");
$json = json_decode($url,true);
print $json[$_REQUEST['curr']];
?>

And that’s it. 3 lines to get exactly what I need, and I simply use the Google Sheets command: =IMPORTDATA(“http://domain.xxx/coins.php?coin=BTC&curr=USD”) – That’s it. With that in place and the coins.php made, when I load my sheet to record or review where I’m at – math is all done for me based upon the current rates in my currency! See the example? It’s a break down to BTC in USD currency, so the current USD for Bitcoin. Easy peasy.

Must say all and all, very happy with the code, of course back to the real world, as if I can wrap a few projects this week, I’ll survive back to school! (oi!)

PS:333 – Life isn’t easy. But God is Good.

I’m tired. It’s 3 AM on a Saturday, and let’s just say the amount of stress and things to do this week reached a point in which I was laid out after a dentist visit.

Now nothing happened other than a quick check, then a referral to get a CT scan on a tooth to see what’s going on with my poor teeth – but I came home, tried to work, and just finally ended up laying down and sleeping.

My life has been nuts this year so far, changes in finances, changes in temp, changes in me. I’m tired. I hurt. I’m not always cheerful, but God is still God, and that’s a big thing of what keeps me going.

Right now this very moment? I would rather be sleeping, but instead a break from work, I wish I could push it off, I wish I could disconnect and take a vacation, but sadly? Not in the cards for me. Instead of working through the night to early morning to pay the bills, I’d love to go on a walk, a drive, something not in front of a computer.

I know I’m on the verge of burn out again, things like a random ex-customer leaving a 1-star review and a complaint about a lost live chat session knock me down a bit more than they should, but lately my victory list seems small, so I take the short list and thank God for where I can find the good.

A better balance is needed. Not sure how I can make the changes to make life run smoother, but right now – I’m leaning on God and going to get back to work so that I can go to sleep before I see the sun rising.

 

PS:332 – No Rest. Lots to Do.

So here we are at nearly 3:30 am, seems like a rather common place for me, tonight the culprit was an old PHP app which is showing growth pains (seems to be the usual culprit, sadly its all the same collection of apps in a big website) but I solved the issue in part.

It was creating far too many elements to toss into an array in a cookie, and at some point the garbage was overwhelming and not letting the actual new info in. Easy fix? Cut it down to 100 items displayed. Now customer will likely want those additional items displayed, but for starters? It’s allowing adding/removing – hoping it doesn’t fiddle with reports, but again this thing was not built with the idea this would ever happen.

I have another website I was tinkering with tonight, however, I think I am going to wrap up, thus why I am sitting at the workstation just taking some time to chill out and write. One of the reasons I have it setup. Now granted things are wobbly, I used this as a temp desk before my door desk, but I have a few desk options in mind to build (or get lazy and buy it at IKEA) 😀

Did manage to snag a $300+ monitor for half price, and it’s very crisp, clean and so far working smoothly (writing this using it) a lot nicer than my current monitor on the other desk, but another expense for another year as I doubt the other one is going to die, and it’ll work for now 🙂

Ramblings aside? It’s been a rough couple of weeks. A lot of stress, before I dug back into the code actually just stopped – took a minute, got my bearings and dug back in completing what needed to be done TODAY. More to do later once I wake up, praying things continue to improve and get better, need less stress.