Skip to content

Instantly share code, notes, and snippets.

View coderbyheart's full-sized avatar
🌩️
building serverless IoT solutions

Markus Tacker coderbyheart

🌩️
building serverless IoT solutions
View GitHub Profile
@coderbyheart
coderbyheart / espruino.js
Created August 29, 2020 10:31
espruino temperature controlled fan on Thingy:52
const threshold = 26.5;
const interval = 10;
let currentTemp;
let isOff;
function setLEDS(l1,l2,l3) {
digitalWrite(LED1, l1);
digitalWrite(LED2, l2);
digitalWrite(LED3, l3);
}
@coderbyheart
coderbyheart / espruino-temp-relay.js
Created August 28, 2020 15:59
espruino temperature controlled relay
var dht = require("DHT22").connect(A1);
const threshold = 25;
const interval = 10;
let currentTemp = 0;
// LEDs off
LED1.write(false);
LED2.write(false);
@coderbyheart
coderbyheart / regex.txt
Created August 21, 2020 08:07
Clean font properties from Inkscape SVG
(-inkscape|font|word|text|letter|writing)-[^:]+:[^;]+;
#!/bin/bash
ffmpeg -y -i $1 -vf palettegen palette.png
ffmpeg -y -i $1 -i palette.png -filter_complex paletteuse -r 10 $1.gif
@coderbyheart
coderbyheart / refill.mjs
Created March 12, 2020 12:44
copy DynamoDB items to another table
import AWS from 'aws-sdk'
const db = new AWS.DynamoDB();
const oldTable = 'bifravst-cellGeolocationdeviceCellGeoLocations9F25FBED-1VK9FPSS5GX3G'
const newTable = 'bifravst-cellGeolocationdeviceCellGeoLocation757F8D27-1K6Z9IBMWMV2K'
const refill = (ExclusiveStartKey) => db.scan({
TableName: oldTable,
Limit: 100,
@coderbyheart
coderbyheart / unresolved.json
Last active March 10, 2020 13:20
Unresolved Cells during Embedded World 20
[
{
"cellID": 1805149,
"mccmnc": 24412,
"areaCode": 50222,
"locations": [
{
"date": "2020-02-26T06:08:32.914Z",
"lat": 61.49116083333333,
"lng": 23.771811333333332,
@coderbyheart
coderbyheart / downloader.js
Last active March 10, 2020 06:29
nrfcloud message downloader
import fetch from 'node-fetch'
import * as querystring from 'querystring'
const f = (pageNextToken, messages = []) => fetch(`https://api.nrfcloud.com/v1/messages?${querystring.stringify({
inclusiveStart: '2019-01-01T00:00:00Z',
exclusiveEnd: new Date().toISOString(),
pageSort: 'desc',
pageLimit: 100,
...(pageNextToken ? { pageNextToken } : {}),
})}`, {
@coderbyheart
coderbyheart / README.md
Last active February 20, 2020 11:48
Dockerfile for a NCS application
@coderbyheart
coderbyheart / generate-sensor-messages.ts
Created November 1, 2019 13:34
Script to generate test data
import { Chance } from 'chance'
import { v4 } from 'uuid'
import { createWriteStream, WriteStream } from 'fs'
import * as path from 'path'
const numMessages = parseInt(process.argv[process.argv.length - 2], 10)
const outDir = process.argv[process.argv.length - 1]
const allSensors = [] as string[]
for (let i = 0; i < 5; i++) {
@coderbyheart
coderbyheart / gps.proto
Created August 19, 2019 10:55
protobuf example
package gps;
syntax = "proto3";
message gps {
message V {
double lng = 0;
double lat = 1;
double acc = 2;
double alt = 3;
double spd = 4;