PS:350 – The week that didn’t stop!

Oi! This was one of those weeks that while I’m excited about extra hours for consulting, I’d just as soon be done and sleeping!

I have 3 more tasks on the docket this evening, finishing a quote, a server, a piece of software.

Honestly? At the rate I’m going I think I’ll get 2 out of 3 unless I get a large boost in what I’ve got coded already. It’s glitchy, to begin with since I’m working with a really hard to work with the codebase. For instance, I’m having to embed javascript into javascript, to produce something that would have been easier and made the site function better if they simply avoided javascript in the first place.

I’m all for progressive coding ideas to give a real-time experience, no refreshing, however, honestly? for what this site does it should have been flat PHP generating HTML no buzz, no fluff, just HTML.

Now, this week will eventually end, but hopefully, I can get some rest before a busy week ahead.

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:176 – Code Done.

I picked up a coding project to fix a number of issues for a customer (actually, I have 2 now) but this one is a monthly gig it looks like, basically the original programmer did some weird stuff with processing images, and it fails for some reason. I dug through their code trying to find a reason why and it appears when parsing a CSV file it appends a TON of extra lines which overwrite database/files.

Instead of sorting out their code, I simply re-wrote my own with some of their functions because how they manage images is built into the theme, and we need a real fix long-term, but short-term images are missing from a big classifieds shop, and they need it sorted, so my script does what theirs does, but compensates for the extra CSV entries that it made up.

Hope to have it live, test item worked, but leaves a big gap to run it against all classifieds to re-parse their images from the feed, but should work out good.

PS:39 – Raspberry Pi 2

Well got an early birthday present of a Raspberry Pi 2. I’ve looked at some projects including a NAS for projects. Currently, I’ve got it set up as a LAMP setup to do some web dev.

I have been looking at though making a smart mirror! There are some projects using the Pi as a brain for a delightful display that shines through the mirror – super cool idea and who knows may make a nice gig to sell on Etsy or something similar.

Loving it so far, have it running headless in the other room, but lovely to have a low footprint for a system and next to nothing in power, even runs on battery power so may make a storage system for the truck! Lots of options!