Fade colors in Corona using Transitions

Posted by in Software, Tutorial

Corona provides transitions. According to this post, a transitionTo(…) would suffice:

The user can also cancel the transition if needed (which is waht I would need to do later in the code). In case you’re into custom stuff and the easing functions are not enough, you can create your own. A sample can be found here. The signature of the easing function is (at the moment of writing) function customEasing(t, tMax, start, delta) where: t is the time elapsed since the start tMax is the duration of the transition…read more

Fade Colors on a Polygon using the Game Loop

Posted by in Software, Tutorial

One of the features I need to implement is to smoothly change the fill/stroke color of a polygon, like this: A manual approach In order to better understand the mechanics, I built my own fading PoC. First, one would need to build the polygon:

In this particular case, I have a text field and a rounded rectangle beneath it. the hud group contains both in the right order. Once the components have been created, we build the function to be called each frame:

The idea is to only…read more

Antialias a Polygon with Corona SDK

Posted by in Software, Tutorial

The other day I figured I needed to draw a polygon in Corona SDK. With display.newPolygon(...), the job is extremely easy and a result like (apologies for the JPEG artefacts): It is obvious that in non retina cases, one can see the aliasing of the polygon’s edges. Hence I’ve thought and searched of various ways to provide the polygons with antialiasing. The sum of solutions I found is: Find a flag to enable antialiasing for a polygon Use effects to perform e.g. a blur or a glow and adapt it…read more

Ignore ESLint Directives in Code

Posted by in Software, Tutorial

The other day I’ve had to refactor a piece of angular code. Unfortunately, the original code was written a long time ago and has some issues like having $scope in controllers and a rather large number of unused variables. changing the $scope to this is a very time-consuming task as it implies prefixing functions and variables in the HTML code as well as selective replacements in JS ($scope.$watch for example must remain intact). In order to minimise the effort, I’ve decided to only move the code blocks around using John…read more

Monitor ethOS Distro with Elastic Search – 3

Posted by in IT, Software, Tutorial

Once we’ve set up the data sending from out ethOS machine, we can check that ElasticSearch collects data. With GET /ethos/_count, we get something like:

If the count is greather than 0, we can start analysing the data. Metrics I am currently measuring only machine. Therefore, I’ve set up some simple measurements: Hash rate Temperature Network Fan speed Hash rate I am measuring the average sum of all GPUs’ hash rates and the trend: I’ve built this with Timelion and the code is:

As you can see, there…read more

Proxy Content from URL with Webpack Dev Server

Posted by in Software, Tutorial

An application I’m working with has a large amount of static files (path starting with ‘/files/’) deployed on a mounted volume in Docker. They are subsequently served via nginx. for local development, I thought of two options: Add files to the local dev server (e.g. copy assets) Build a proxy to pipe the request to the nginx-served site The first option is somewhat restrictive: I’d have to make sure the files are kept in sync with the latest version. I’d have to integrate the syncing process with the build scripts….read more

Monitor ethOS Distro with Elastic Search – 2

Posted by in IT, Software, Tutorial

Following the previous post, we are now in position to install the monitoring code on the monitoried machine, of course. The easiest way is to download the code on the machine in /home/ethos. Following steps will assume you have the unpacked code in

Once you have downloaded the code, you need to add the location of the ElasticSearch server to the local.conf:

Dissecting the scripts The scripts are written in PHP, like ethOS‘s own scripts. I did that for two reasons: Take advantage of the already written code…read more

Monitor ethOS Distro with Elastic Search – 1

Posted by in IT, Software

TL;DR: It’s possible to monitor your ethos distro install on an ElasticSearch instance. I like EthOS. I like its panel too, but at the time of writing it had some issues on updating values This was somewhat unfortunate because it’s the same time when I set up my rig so monitoring without typing show stats every minute or so was quite important. So, I’ve proceeded to try and find a replacement for the panel. Initially, I’ve thought to develop my own solution with something like django, but since I’m not…read more

Match String on Multiple Columns

Posted by in Software

TL;DR: Use concatenation, Luke! I had to search a name for an user in a table containing the first and last names in separate columns. After a while I got tired on looking up the first_name and last_name columns one at a time and I decided to try and search both. The result is something like:

I have to do the LOWER() call because the names are provided by user input. At first I’ve been worried about performance, but since this is not a recurrent query, it’s acceptable (0.25s…read more

Make a Shell Script with Arguments (Native)

Posted by in Software, Tutorial

I was building a bash script and I needed several arguments to make it more versatile (e.g. dry-run). The list of parameters was: help as -h or –help dry run ad -d or –dry-run to go through the motions without actually executing commands keep last N images ad -k num or –keep num to keep last N images (default 5) As one can see, none of the parameters are compulsory and have default values:

The snipped taking care of my input parameters is:

The idea is that we…read more