Skip to content

Instantly share code, notes, and snippets.

var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'Express' });
});
module.exports = router;
@gyengus
gyengus / espruino_pico_demo.js
Last active August 29, 2015 14:23
espruino_pico_demo
var l = false;
setInterval(function() {
l = !l;
LED1.write(l);
LED2.write(!l);
}, 500);
function readBTN() {
if (digitalRead(BTN1) == 1) {
@gyengus
gyengus / espruino_bmp180.js
Last active August 29, 2015 14:23
Espruino Pico BMP180 example
I2C1.setup({scl: B6, sda: B7});
var bmp = require("BMP085").connect(I2C1, 3);
function readBTN() {
if (digitalRead(BTN1) == 1) {
LED1.write(true);
bmp.getPressure(function(d) {
console.log(new Date().toString());
console.log("Pressure: " + d.pressure + " Pa");
console.log("Temperature: " + d.temperature + " °C");
@gyengus
gyengus / thermometer_demo.ino
Created July 24, 2015 19:30
Particle Photon thermometer demo
#include "OneWire.h"
OneWire ds(D3);
void btn_handler(void);
int readTemp(String command);
void pushbulletTemp(void);
uint8_t gateway_ip[] = {192, 168, 0, 11};
int gateway_port = 80;
@gyengus
gyengus / pushbullet_gw.php
Created July 25, 2015 07:22
Pushbullet gateway
<?php
$title = "";
if (isset($_POST['title'])) $title = $_POST['title'];
$text = "";
if (isset($_POST['text'])) $text = $_POST['text'];
$dest = "";
if (isset($_POST['dest'])) $dest = $_POST['dest'];
if ($title and $text) {
$url = "https://api.pushbullet.com/v2/pushes";
@gyengus
gyengus / redbear_duo_blink.ino
Created March 6, 2016 12:53
redbear_duo_blink.ino
version: "2"
services:
wordpress:
build: .
#image: ulsmith/alpine-apache-php7
volumes:
- ./www:/app/public
- ./logs:/var/log
environment:
<ifmodule mod_ssl.c>
<virtualhost *:443>
ServerName gyengus.hu
ServerAlias www.gyengus.hu
RequestHeader set X-Forwarded-Proto "https"
ProxyPreserveHost on
ProxyPass / http://localhost:8888/
ProxyPassReverse / http://localhost:8888/
<?php
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
$scheme = "https";
$_SERVER['HTTPS'] = 'on';
} else {
$scheme = "http";
}
define('WP_SITEURL', $scheme . '://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', $scheme . '://' . $_SERVER['HTTP_HOST']);
1,2c1
< dist: trusty
< sudo: required
---
> image: debian
4c3,4
< language: c++
---
> stages:
> - build