Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

German Viscuso germanviscuso

🏠
Working from home
  • Amazon
  • Madrid
View GitHub Profile
@germanviscuso
germanviscuso / alljoyn_kii_peer
Last active Jan 27, 2016
Chat example host and client for nodejs. Logs incoming messages on Kii Cloud.
View alljoyn_kii_peer
var alljoyn = require('alljoyn');
require("node-jquery-xhr");
kii = require("./KiiSDK").create();
// process command line arguments
if(process.argv.length != 7){
console.log("Usage: node peer.js [host|client] kiiappid kiiappkey username password");
console.log("Create an app at developer.kii.com (US based) to get the app id and key");
console.log("Username and password will be created if they are not registered on Kii Cloud");
process.exit(1);
View GP_19_AQM_Particle_3G
/*
* ------------ [GP_019] - AQM with particle --------------
*
* Explanation: This is the basic code to manage and read CO, O3, SO2, NO2
* gas sensors and a prticle sensor. This gases are commonly meassured in
* air quality monitors. The concentration and the enviromental variables
* will be stored in a frame. Cycle time: 5 minutes.
*
* Copyright (C) 2015 Libelium Comunicaciones Distribuidas S.L.
* http://www.libelium.com
@germanviscuso
germanviscuso / sendDweet.js
Last active May 17, 2016
Functions to send a dweet.io via a Kii server extension (useful for connecting to Freeboard)
View sendDweet.js
function createDweetFromKiiObject(thingid, kiiObject, dweetKey, workerCallback, doneCallback) {
var string = null;
$.each(kiiObject, function(key, val){
if(key == "_customInfo")
string = JSON.stringify(val);
});
if (string == null){
console.log("Error: can't retrieve thing custom data for dweeting");
if(doneCallback) doneCallback("Dweet error");
}
@germanviscuso
germanviscuso / sendInitialState.js
Last active May 17, 2016
Function for Kii server extension to send events to InitialState.com (Note: object must have flat properties, no nesting supported)
View sendInitialState.js
function sendInitialState(accessKey, bucketKey, kiiObject, workerCallback, doneCallback) {
var targetUrl = "https://groker.initialstate.com/api/events";
var customInfo;
$.each(kiiObject, function(key, val){
if(key == "_customInfo")
customInfo = val;
});
if (!customInfo) {
var error = "Error: can't retrieve thing custom data for visualization";
console.log(error);
@germanviscuso
germanviscuso / index.js
Created Jul 6, 2016
Parking sensor to Kii snippet (node.js)
View index.js
const raspi = require('raspi'); // Raspberry Pi GPIO library
const Serial = require('raspi-serial').Serial; // Raspberry Pi UART library
const thingNode = require('thing-node'); // Kii node.js library
const dissolve = require("dissolve"); // binary stream parser
const appId = '<REPLACE_WITH_KII_APP_ID>';
const appKey = '<REPLACE_KII_APP_KEY>';
const appSite = 'US';
const vendorThingId = 'ParkingSensor_1';
const thingPassword = '<CHOOSE_PASSWORD_AND_REPLACE_HERE>';
@germanviscuso
germanviscuso / alljoyn_pi
Last active Jul 25, 2017
Compile AllJoyn on the Raspberry Pi
View alljoyn_pi
INDEX
-----
- BUILD IT YOURSELF
- BUILD THE AUDIO SERVICE
- BUILDING FOR ANDROID
- INSTALL WITHOUT BUILDING
BUILD IT YOURSELF
-----------------
@germanviscuso
germanviscuso / sync.sh
Last active Apr 27, 2018
Mirror/Sync Github Organization Repos locally
View sync.sh
#!/bin/bash
# Clone all org repos (via ssh)
curl -s https://api.github.com/orgs/<organization>/repos?per_page=200 | python -c $'import json, sys, os\nfor repo in json.load(sys.stdin): os.system("git clone " + repo["ssh_url"])'
# Later pull from each repo
back=`pwd`; for d in `find . -type d -name .git` ; do cd "$d/.."; git pull origin; cd $back ; done
View update_git_repos_in_dir.sh
find . -name .git -type d \
| xargs -n1 -P4 -I% git --git-dir=% --work-tree=%/.. remote update -p
@germanviscuso
germanviscuso / templates.json
Last active Oct 1, 2018
Templates to clone Alexa skills via ASK-CLI with "ask new --template --url http://bit.ly/2zJExED"
View templates.json
{
"Number Guessing Game": {
"gitUrl": "https://github.com/germanviscuso/skill-sample-nodejs-numberguessinggame.git",
"description": "The number guessing game is a game where the player tries to guess the target number."
},
"My Calculator": {
"gitUrl": "https://github.com/germanviscuso/skill-sample-nodejs-mycalculator.git",
"description": "Basic calculator skill (es-ES)."
}
}
@germanviscuso
germanviscuso / es-ES.json
Last active Oct 10, 2018
Alexa Skills Basics: Slot Confirmation in Dialogue Management
View es-ES.json
{
"interactionModel": {
"languageModel": {
"invocationName": "pintor mágico",
"intents": [
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{