Skip to content

Instantly share code, notes, and snippets.

View KEGustafsson's full-sized avatar

Karl-Erik Gustafsson KEGustafsson

View GitHub Profile
@KEGustafsson
KEGustafsson / FMI Rannikkoasemat
Last active March 1, 2024 11:10
FMI Rannikkoasemat
const haversine = require("haversine")
const fetch = (...args) => import('node-fetch').then(({ default: fetch }) => fetch(...args));
const ownLocation = { latitude: 60.2, longitude: 22.3 }
let stationAmount;
let distToStation = []
const stations = [
["Kotka Haapasaari", 101042, 60.29, 27.18],
["Kotka Rankki", 101030, 60.38, 26.96],
["Loviisa Orrengrund", 101039, 60.27, 26.45],
@KEGustafsson
KEGustafsson / gist:42c5f5d54db282cdc5507df4a05a2961
Created October 23, 2023 09:15
Cannot read properties of null (reading 'path')
Oct 22 22:22:29 TypeError: Cannot read properties of null (reading 'path') at /usr/lib/node_modules/signalk-server/lib/tokensecurity.js:462:98 at Array.find (<anonymous>) at /usr/lib/node_modules/signalk-server/lib/tokensecurity.js:461:35 at Array.find (<anonymous>) at strategy.shouldAllowWrite (/usr/lib/node_modules/signalk-server/lib/tokensecurity.js:455:46) at processUpdates (/usr/lib/node_modules/signalk-server/lib/interfaces/ws.js:365:31) at Sparky.<anonymous> (/usr/lib/node_modules/signalk-server/lib/interfaces/ws.js:162:33) at Sparky.emit (node:events:514:28) at done (/usr/lib/node_modules/signalk-server/node_modules/primus/spark.js:347:25) at transform (/usr/lib/node_modules/signalk-server/node_modules/primus/spark.js:309:30) at Sparky.transforms (/usr/lib/node_modules/signalk-server/node_modules/primus/spark.js:330:4) at decoding (/usr/lib/node_modules/signalk-server/node_modules/primus/spark.js:215:13) at Sparky.decoder (/usr/lib/node_modules/signalk-server/node_modules/primus/parsers/json.js:34:3)
@KEGustafsson
KEGustafsson / docker-compose.yml
Last active December 31, 2023 17:08
Docker-compose example for Signalk + Grafana (old&new) + Influxdb (v1.8) + Telegraf
version: "2.2"
services:
influxdb:
image: influxdb:1.8
container_name: influxdb
restart: unless-stopped
network_mode: host
volumes:
- $PWD/signalk_volume/influxdb:/var/lib/influxdb
We couldn’t find that file to show.
@KEGustafsson
KEGustafsson / gist:9dde7a82fcfec6db4c31713d0e43b5a0
Created November 11, 2020 11:07 — forked from tkurki/gist:d8d45dfb368b3b544542511e8e95a45b
ESP8266 script to read DS18B20 sensors over 1W and broadcast Signal K JSON over udp
#include <OneWire.h>
#include <DallasTemperature.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <SPI.h>
#include <Wire.h>
#include <ESP8266WebServer.h>
#include <DNSServer.h>
#include <WifiServer.h>
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
@KEGustafsson
KEGustafsson / delete-slack-messages.js
Created April 7, 2020 20:01 — forked from firatkucuk/delete-slack-messages.js
Deletes slack public/private channel and chat messages.
#!/usr/bin/env node
// Channel ID is on the the browser URL.: https://mycompany.slack.com/messages/MYCHANNELID/
// Pass it as a parameter: node ./delete-slack-messages.js CHANNEL_ID
// CONFIGURATION #######################################################################################################
const token = 'SLACK TOKEN'; // You can learn it from: https://api.slack.com/custom-integrations/legacy-tokens
// GLOBALS #############################################################################################################