Skip to content

Instantly share code, notes, and snippets.

View rvdende's full-sized avatar
🤖
automating

Rouan van der Ende rvdende

🤖
automating
View GitHub Profile
@rvdende
rvdende / export.js
Created May 20, 2020 16:50
Export mongodb collection as .json files
const mongojs = require('mongojs')
const fs = require('fs');
const db = mongojs('moprop')
var list = [];
// test connection
db.properties.find({}, (e, r) => { })
db.on('error', function (err) {
@rvdende
rvdende / import.js
Created May 20, 2020 16:43
Imports a list of json files to a mongodb collection.
const fs = require('fs');
const testFolder = 'export';
const mongojs = require('mongojs')
var list = [];
const db = mongojs('moprop');
@rvdende
rvdende / types_reactCustomScroll.d.ts
Created May 13, 2020 10:56
Typescript definition file to react-custom-scroll
declare module 'react-custom-scroll' {
interface Props {
allowOuterScroll?: boolean;
heightRelativeToParent?: string;
flex?: number | string;
onScoll?: (e?: any) => any
addScrolledClass?: boolean;
freezePosition?: boolean;
minScrollHandleHeight?: number;
@rvdende
rvdende / types_styled.d.ts
Created May 12, 2020 16:40
Workaround for styled-components types definition bug
declare module 'styled-components' {
// Type definitions for styled-components 4.1
// Project: https://github.com/styled-components/styled-components
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
// Ihor Chulinda <https://github.com/Igmat>
// Adam Lavin <https://github.com/lavoaster>
// Jessica Franco <https://github.com/Kovensky>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.9
@rvdende
rvdende / currentsense.ino
Created May 10, 2018 14:07
currentsense
//https://www.arduino.cc/en/Tutorial/MasterWriter
//https://github.com/PaulStoffregen/RadioHead
#include <Wire.h>
//setup
const int currentPin = A0;
//config
float AC_voltage = 230.0; //volts
@rvdende
rvdende / node-js-mailgun-via-api.js
Created August 25, 2017 07:49 — forked from neguse11/node-js-mailgun-via-api.js
Call Mailgun API from node.js with Request
// node.js : Mailgun via API
var request = require('request')
var apiBaseUrl = 'https://api.mailgun.net/v3/sandboxXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.mailgun.org';
var apiKey = 'key-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var from = 'Excited User';
var to = 'example@example.com';
var subject = 'Hello';
var text = 'Testing some Mailgun awesomness!';
@rvdende
rvdende / combinations.js
Created August 2, 2017 06:51 — forked from axelpale/combinations.js
JavaScript functions to calculate combinations of elements in Array.
/**
* Copyright 2012 Akseli Palén.
* Created 2012-07-15.
* Licensed under the MIT license.
*
* <license>
* 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,
@rvdende
rvdende / gist:9038528
Last active August 29, 2015 13:56
PID function
// PID control function.
//
// USAGE
// inputTemperature - latest sensor reading
// targetTemperature - what temperature you want to achieve
// timedelta - seconds since last call. this can be fractions of a second.
//
// double calcPID(double inputTemperature, double targetTemperature, double timedelta)
//
// eg.: double temperatureControl = calcPID(125.1, 180.0, 0.12);
# rouan van der ende - fluentart.com
# loads obj, renders, deletes the obj, next frame.
import bpy
import os
import bpy, random
import threading, time
import io_scene_obj.import_obj
from mathutils import Vector
var http = require("http");
var fs = require("fs");
var s = http.createServer(function(req, res) {
fs.readFile("./" + req.url, function(error, data) {
if (error) {
res.writeHead(404, { 'content-type': 'text-plain' });
res.end("The page is not found!");
}
else {