Skip to content

Instantly share code, notes, and snippets.

View wouterds's full-sized avatar
:octocat:
Hello world!

Wouter wouterds

:octocat:
Hello world!
View GitHub Profile
@wouterds
wouterds / samples.sql
Last active July 17, 2019 08:12
I want to select data between day x and day y returned as z amount of rows (scaled down data set).
CREATE TABLE IF NOT EXISTS `samples` (
`id` char(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`value` float(8,2) NOT NULL,
`createdAt` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `samples_created_at` (`createdAt`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO `samples` (`id`, `value`, `createdAt`)
VALUES
CREATE USER 'user'@'host' IDENTIFIED BY 'pass';
GRANT ALL PRIVILEGES ON `db`.* TO 'user'@'host' IDENTIFIED BY 'pass';
FLUSH PRIVILEGES;
import Hashids from 'hashids';
const hashids = new Hashids(
process.env.HASHIDS_SALT,
4,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890',
);
export const encode = (id: number): string => hashids.encode(id);
export const decode = (id: string): number | null => {
SELECT
sensors.type,
samples.value,
DATE_FORMAT(
CONVERT_TZ(
samples.createdAt,
'+00:00',
'+01:00'
),
'%Y-%m-%d %h:%i %p'
#include <Wire.h>
#include <ESP8266WebServer.h>
#include <TSL2561.h>
const char *ssid = "Wouter's Place";
const char *password = "";
ESP8266WebServer server(80);
TSL2561 tsl2561(TSL2561_ADDR_FLOAT);
#include <Wire.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#define LED D1
const char *ssid = "Wouter's Place";
const char *password = "";
const axios = require('axios');
const chalk = require('chalk');
const sleep = require('await-sleep');
const checkCode = async (code) => {
const codes = [code];
const response = await axios.post('https://winadrone.kelloggs.com/api/nl_BE/redemption/validate-codes', { codes });
const { data } = response;
/*
* sixpair.c version 2007-04-18
* Modified to run on Mac OSX by
* Erlend Cleveland 2011-09-04
*
* Compile with: gcc -o sixpair sixpair.c -lusb
*/
#include <string.h>
#include <unistd.h>
@wouterds
wouterds / config.txt
Last active June 6, 2017 22:18
Raspberry Pi 3 fixes
# Overclock
arm_freq=1350
core_freq=500
over_voltage=4
disable_splash=1
force_turbo=1
boot_delay=1
gpu_mem=320
# Hdmi fixes