Hashgraph: an analysis

A closer look into hashgraph functionality:
https://hackernoon.com/demystifying-hashgraph-benefits-and-challenges-d605e5c0cee5

Advertisements

Automating Google Play publishing

If you ever need to create use a script to upload your apk to google play without using the console, that the way!!

  1. Go to the Google Play Developer Console
    1. Choose the Credential section
    2. From the “Create Credential” popup select “create service account key”
    3. Select “New Service Account”
      1. Enter “my App Publisher” in service account name
      2. Select “project owner” in the role popup
      3. Choose the JSON radio button
      4. Press Create
      5. Save the file (for example: myGoogle.json) in a secure place.
        1. Open the JSON file and search for the value of “Client_Email“:
          it will be something like:
          xxxxxyyyy@api-lotsofnumbers.iam.gserviceaccount.com 
          we will use in the very next step.
  2. Now go to the Google Play Console
    1. Go to the Settings item and the select Users & Roles
    2. Click on “add new user
      1. enter the email taken from the JSON
      2. set the user as admin and save
  3. Now we need the script for the upload
    1. launch a teminal with the following command:

      pip install google-api-python-client

    2. Now we get the actual script:

      wget https://gist.githubusercontent.com/mix3d/665f4ab329b4482297a2f425ebba402c/raw/0949385dd6c80d0701170746b1bd5fd479303412/basic_upload_apks_service_account.py

    3. rename the script in upload.py
    4. we need an apk to upload for authorising the API, let call it myApk.apk with package my.app
    5. execute the following command:

      python upload.py -a myApk.apk -p my.app -t beta -s myGoogle.json

    6. the command will ask to go to a google URL to confirm the API, copy it to the browser and authorise the API.
    7. Done, your script is set

last point, the -t parameter you can choose between the following parameters:
alpha‘, ‘beta‘, ‘production‘,’rollout

Logging presence using Domoticz and IFTTT

I needed a way to lower the heating when no one is at home.
My heating is controlled by a Danfoss zwave thermostats so I can interact with them.

I came out with a simple solution using Domoticz and IFTTT.

Let’s proceed step by step, assuming you have a Domoticz installation up and running,
otherwise install on your system clicking here https://www.domoticz.com/

Step 1: Domoticz configuration

1.1) create a dummy …….
then create a virtual sensor
screen-shot-2017-02-08-at-11-24-41

1.2) Choose the Switch sensor type and give it a meaningful name:
screen-shot-2017-02-08-at-11-25-06

1.3) Now go to devices and take note of the deviceID, we will need it later…Screen Shot 2017-02-08 at 11.25.33.png
… to change the switch status. The URL to call is in this format:
http://url:8080/json.htm?type=command&param=switchlight&idx=deviceID&switchcmd=On

Step 2: Set up IFTTT

2.1) First of all, your Domoticz needs to be reachable from IFTTT, in my case I opened a non-standard port on my firewall and enable the port forwarding to domoticz.
Keep in mind that if you open the port 10000 on the router firewall you need to forward to the 8080 port to reach Domoticz.
EX: http://my.host.domain:10000/pluto –> http://my.internal.domoticz:8080/pluto

2.2) Install IFTTT on your smartphone and create a new applet by clicking this:screen-shot-2017-02-08-at-12-01-45

Let’s start by choosing the location service:
screen-shot-2017-02-08-at-12-03-06

In the following screen choose the “Exit an area” trigger:
screen-shot-2017-02-08-at-12-03-59

Select the area around your home and create the trigger:screen-shot-2017-02-08-at-12-05-34

The last step will be to call you domoticz, so let’s move to the that action:
screen-shot-2017-02-08-at-12-09-45
and choose the “Maker” action:
screen-shot-2017-02-08-at-12-12-20

then add the url for domoticz using the deviceID from the 1.3 step.
make sure to use the port from the 2.1 step.
There will be something like:
http://username:password@yourIP:yourPort/json.htm?type=command&param=switchlight&idx=deviceID&switchcmd=On

screen-shot-2017-02-08-at-12-13-58
Don’t forget to add the very same rule for the “Enter Area” and using the same URL but changing On to Off :
http://username:password@yourIP:yourPort/json.htm?type=command&param=switchlight&idx=deviceID&switchcmd=Off

Integrating Homebridge and Siri with IFTTT

After the iOS 10 release, it’s finally possibile to play with Siri and HomeKit!

I installed Homebridge on my Raspberry PI and create some rules to play: control some LED bulbs, check temperature and so on…

But I wanted more! I need to extend to the full features IFTTT!
The good news is that Homebridge support IFTTT with a plugin.

IF you need to install it, go to https://github.com/ilcato/homebridge-ifttt/ and install it:

npm install -g homebridge-ifttt

After then we need to create the configuration, but first we need some preparation.

For make it work properly let’s create a rule on IFTTT.

  1. Enable the Maker Channel
  2. Create a rule:
    • Choose an event name: for example “Speedy
    • Choose an action: for example send email
    • the result should be something like this:
      • If Maker Event “Speedy”, then send an email from user@domain

Now let’s go back to the config.json for the Homebridge and connect IFTTT adding the following code:

{
    "platform": "IFTTT",
    "name": "IFTTT",
    "makerkey": "INSERT YOUR MAKER KEY",
    "accessories": [
         {
          "name": "Speedy Mail",
          "buttons": [
              {
               "caption": "Speedy Mail",
               "trigger": "Speedy"
              }
            ]
          }
       ]
 }

restart Homebridge and you can send email from HomeKit.

 

Automate Xcode build

there’s a simple way to build your Xcode project from command line:

xcodebuild

assume your project test.xcodeproj has two targets: testing and release.

Building the release target is simple:

xcodebuild -project test.xcodeproj -configuration release -target release 

Once Xcode has finished building you’ll find your .ipa in the directory

<yourproject>/build/release-iphoneos/