Skip to content

Instantly share code, notes, and snippets.

View tomconte's full-sized avatar
💻
Working from home

Thomas Conté tomconte

💻
Working from home
View GitHub Profile
{
"name": "Private",
"engine": {
"BasicAuthority": {
"params": {
"gasLimitBoundDivisor": "0x0400",
"durationLimit": "0x0d",
"authorities" : ["133e5245e3e5ab3f65e73120b34cc29f0f7ba504"]
}
}
# Install all pre-requisites for Ethereum Truffle
# Once complete, just open a new terminal window and run:
# npm install -g truffle
# If you want TestRPC:
# npm install -g testrpc
# N.B.: must be run as Administrator
# Also need to make sure the execution policy allows running scripts that aren't code-signed
# Set-ExecutionPolicy Unrestricted -Scope CurrentUser
@tomconte
tomconte / function.json
Created September 26, 2016 14:49
Node.JS Azure Function to resize images, using the pure JavaScript Jimp library. A Blob Trigger is used to detect incoming files, and a Blob Output binding is used to write the scaled image.
{
"bindings": [
{
"name": "inputBlob",
"type": "blobTrigger",
"dataType": "binary",
"direction": "in",
"path": "images-in/{name}",
"connection": "function821251a1b074_STORAGE"
},
Verifying that +tomconte is my blockchain ID. https://onename.com/tomconte
@tomconte
tomconte / ApolloTrade
Created May 24, 2016 14:47 — forked from anonymous/Untitled
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://chriseth.github.io/browser-solidity/#version=soljson-latest.js&optimize=undefined&gist=
contract ApolloTrade {
uint public kWh_rate = 1000;
mapping (address => uint) energyAccount;
mapping (address => uint) coinAccount;
address public owner;
function ApolloTrade() {
owner = msg.sender;
}
@tomconte
tomconte / mqtt_js.sh
Created May 12, 2016 09:39
This is an example showing how to use the MQTT.js command line tool "mqtt" to send data to Azure IoT Hub.
mqtt publish -C mqtts \
-h ciscohackhub.azure-devices.net -p 8883 \
-i lora1 \
-u 'ciscohackhub.azure-devices.net/lora1' \
-P 'SharedAccessSignature sr=ciscohackhub.azure-devices.net%2fdevices%2flora1&sig=xxxx&se=1470823180' \
-t 'devices/lora1/messages/events' \
-m "hello mqtt"
@tomconte
tomconte / send_iot-hub_paho_mqtt.py
Created May 12, 2016 09:32
This is a simple example showing how to use the [Paho MQTT Python client](https://eclipse.org/paho/clients/python/) to send data to Azure IoT Hub. You need to assemble the rights credentials and configure TLS and the MQTT protocol version appropriately.
#!/usr/bin/python
import paho.mqtt.publish as publish
import paho.mqtt.client as mqtt
import ssl
auth = {
'username':"ciscohackhub.azure-devices.net/lora1",
'password':"SharedAccessSignature sr=ciscohackhub.azure-devices.net%2Fdevices%2Flora1&sig=xxxx&se=1463048772"
}
@tomconte
tomconte / create_azure_vm.py
Created April 14, 2016 10:16
Creating a VM using the Python Azure Resource Management (ARM) SDK
import azure.mgmt.compute
import azure.mgmt.compute.models
import azure.mgmt.network
import azure.mgmt.network.models
import azure.mgmt.resource
import azure.mgmt.resource.resources.models
import azure.mgmt.storage
import azure.mgmt.storage.models
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.resource.resources import ResourceManagementClient, ResourceManagementClientConfiguration
@tomconte
tomconte / HueRGBConverter.java
Created March 19, 2016 11:08
I used this small servlet to convert RGB values to Hue's specific XY encoding.
package com.hypernephelist;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.philips.lighting.hue.sdk.utilities.PHUtilities;
@tomconte
tomconte / tcs34725hue.ino
Created March 19, 2016 10:33
Control the colors of your Hue lights using the Adafruit TCS34725 RGB sensor. Requires a Web Service to convert RGB values to hue XY color encoding.
#include <Wire.h>
#include <Console.h>
#include "Adafruit_TCS34725.h"
/* Example code for the Adafruit TCS34725 breakout library */
/* Connect SCL to analog 5
Connect SDA to analog 4
Connect VDD to 3.3V DC
Connect GROUND to common ground */