Skip to content

Instantly share code, notes, and snippets.

View ludovicfrin's full-sized avatar

Ludovic FRIN ludovicfrin

View GitHub Profile
@ludovicfrin
ludovicfrin / dht22.ino
Created May 26, 2016 07:01
NodeMcu + DHT22
/**
* Script permettant la lecture régulière de la température et de l'humidité
* la lecture s'effectue sur un DHT22 en utilisant une carte NodeMCU
*/
#include <ESP8266WiFi.h>
#include <DHT.h>
#include <ArduinoJson.h>
#include <SPI.h>
@ludovicfrin
ludovicfrin / dht22.lua
Last active May 9, 2016 13:00
NodeMcu + DHT22
--
-- Fichier dht22.lua
--
-- Permet la lecture de la température et le pourcentage d'humidité
-- Envoi les valeurs obtenus dans une socket TCP
--
local dht = require 'dht'
DHT_PIN = 4
SERVER_IP = "xxx.xxx.xxx.xxx"
float temperature;
int reading;
int pin = 5;
void setup()
{
analogReference(INTERNAL);
Serial.begin(9600);
}
package fr.frin.spring;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Controleur
*
* @author Ludovic FRIN
*/
@ludovicfrin
ludovicfrin / spring-servlet.xml
Last active February 2, 2016 09:33
Fichier spring-serlvet.xml pour réalisation d'un service RESTful avec le framework Spring
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<context:component-scan base-package="fr.frin.spring" />
@ludovicfrin
ludovicfrin / web.xml
Last active February 2, 2016 09:33
Fichier web.xml pour projet RESTful avec le framework Spring
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<display-name>Spring REST</display-name>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
@ludovicfrin
ludovicfrin / pom.xml
Created February 2, 2016 09:19
Fichier pom.xml pour réalisation d'un service RESTFul avec le framework Spring
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.frin</groupId>
<artifactId>spring</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>spring</name>
<description>Spring REST</description>
<properties>
@ludovicfrin
ludovicfrin / Controller.java
Last active February 1, 2016 20:00
Contrôleur pour service RestFul Jersey
package fr.frin.jersey;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import fr.frin.phonesync.webapp.entity.Sms;
@ludovicfrin
ludovicfrin / web.xml
Last active February 1, 2016 19:45
web.xml Pour service RESTFul Jersey
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<display-name>Jersey REST</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
@ludovicfrin
ludovicfrin / pom.xml
Last active February 1, 2016 19:59
pom.xml Pour service RESTFul Jersey
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.frin</groupId>
<artifactId>jersey</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>jersey</name>
<description>Jersey REST</description>
<properties>