Skip to content

Instantly share code, notes, and snippets.

View carlozamagni's full-sized avatar
🎯
Focusing

Carlo Zamagni carlozamagni

🎯
Focusing
  • Technogym
  • Bologna
View GitHub Profile
@carlozamagni
carlozamagni / Spark-Uptime.cpp
Created November 14, 2015 17:57 — forked from wgbartley/Spark-Uptime.cpp
Spark-Uptime
char srvIP[] = "256.256.256.256";
char srvHost[] = "myhost.mydomain.tld";
int srvPort = 80;
char srvPath[] = "/?l=test1";
void setup() {
delay(5000);
pinMode(D7, OUTPUT);
@carlozamagni
carlozamagni / express.js
Created January 13, 2016 21:21 — forked from azat-co/express.js
Tutorial: REST API with Node.js and MongoDB using Mongoskin and Express.js
var express = require('express')
, mongoskin = require('mongoskin')
var app = express()
app.use(express.bodyParser())
var db = mongoskin.db('localhost:27017/test', {safe:true});
app.param('collectionName', function(req, res, next, collectionName){
req.collection = db.collection(collectionName)
// This #include statement was automatically added by the Particle IDE.
#include "MQTT/MQTT.h"
// This #include statement was automatically added by the Spark IDE.
#include "Adafruit_DHT/Adafruit_DHT.h"
#define DHTPIN 2 // pin
#define DHTTYPE DHT11 // DHT 11
@carlozamagni
carlozamagni / double.py
Created February 26, 2016 07:58
Python support for IEEE 754 double-precision floating-point numbers.
# double.py
# Copyright (C) 2006, 2007 Martin Jansche
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, distribute with modifications, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
function Person(props) {
this.firstName = props.firstName;
this.lastName = props.lastName;
}
Person.prototype.getFullName = function() {
return this.firstName + ' ' + this.lastName;
}
class Person {
constructor(props) {
this.firstName = props.firstName || 'John';
this.lastName = props.lastName || 'Doe';
}
getFullName() {
return this.firstName + ' ' + this.lastName;
}
}
class Person {
constructor({ firstName, lastName }) {
this.firstName = firstName || 'John';
this.lastName = lastName || 'Doe';
}
getFullName() {
return this.firstName + ' ' + this.lastName;
}
}
class Person {
constructor(props) {
this.firstName = props.firstName || 'John';
this.lastName = props.lastName || 'Doe';
}
getFullName() {
return this.firstName + ' ' + this.lastName;
}
}
'use strict'
const http = require("http")
const addr = process.argv[2]
const port = process.argv[3]
console.log('\nBinding tester to port: ' + port + '\n')
var server = http.createServer(function(request, response) {