Skip to content

Instantly share code, notes, and snippets.

View JoeKarlsson's full-sized avatar
🏠
Working from home

Joe Karlsson JoeKarlsson

🏠
Working from home
View GitHub Profile
@JoeKarlsson
JoeKarlsson / Code.gs
Last active August 15, 2023 21:06
Send data to Tinybird from Google Sheets
function sendDataToTinybird() {
// 1. Get Data from the Sheet
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var rows = sheet.getRange('A1:C2').getValues(); // Modify this range as needed
// 2. Define the options common to all requests
var headers = {
Authorization: 'Bearer YOUR_AUTH_TOKEN' // Replace with your token
};
@JoeKarlsson
JoeKarlsson / README.md
Last active April 15, 2024 21:41
Script for infra-monitoring-demo for Tinybird

Slack Status

Real-Time Infrastructure Monitoring with Tinybird

This demo shows you how to build an infrastructure monitoring tool, similar to a mini-datadog, that keeps track of some stats from all of the computers running this included script. Using this data, we can plot time series and build something based on "real" data being captured in the moment.

The script

@JoeKarlsson
JoeKarlsson / findAndFollowMe.py
Last active August 9, 2022 20:10
Viam Dofbot Config
from viam.components.arm import ArmClient
from viam.components.gripper import GripperClient
from viam.proto.api.component.arm import JointPositions
from viam.robot.client import RobotClient
from viam.components.camera import CameraClient, Camera
from viam.services.vision import DetectorConfig, DetectorType, Detection
from viam.services.types import ServiceType
from viam.rpc.dial import Credentials, DialOptions
import time
import asyncio
@JoeKarlsson
JoeKarlsson / memsql-helios-commands.sql
Created August 24, 2021 22:09 — forked from robrich/memsql-helios-commands.sql
Welcome to MemSQL Helios
-- create a database
create database cosmeticshop;
-- create a table
use cosmeticshop;
create table cosmeticshopfunnel
(
event_time TIMESTAMP,
event_type CHAR(18),
product_id CHAR(10),
@JoeKarlsson
JoeKarlsson / mySeedScript.js
Last active February 11, 2021 18:49
Script written in Node.js for seeding IoT Data to a MongoDB Atlas database.
/* mySeedScript.js */
// require the necessary libraries
const faker = require("faker");
const MongoClient = require("mongodb").MongoClient;
function randomIntFromInterval(min, max) { // min and max included
return Math.floor(Math.random() * (max - min + 1) + min);
}
async function init() {
@JoeKarlsson
JoeKarlsson / albums.mongdb
Last active January 15, 2021 20:59
[DevHub] From SQL to MongoDB: Aggregation Pipeline
// MongoDB Playground
// To disable this template go to Settings | MongoDB | Use Default Template For Playground.
// Make sure you are connected to enable completions and to be able to run a playground.
// Use Ctrl+Space inside a snippet or a string literal to trigger completions.
// Select the database to use.
use('mongodbVSCodePlaygroundDB');
// The drop() command destroys all data from a collection.
// Make sure you run it against proper database and collection.
@JoeKarlsson
JoeKarlsson / mongodb-linked-list.js
Last active November 6, 2023 03:43
A linked list implemented using MongoDB documents
const MongoClient = require("mongodb").MongoClient;
class LinkedList {
constructor() {}
async init() {
const uri =
"ATLAS CLUSTER URL HERE";
this.client = new MongoClient(uri, {
useNewUrlParser: true,
@JoeKarlsson
JoeKarlsson / moodlite.ino
Created March 25, 2019 23:12
Moodlite Arduino Backup: https://moodlite.co.uk/
/*
Name: Moodlite.ino
Created: 27.12.2018
Version: 2.0
AuthorS: Spigot (M.V.), Shiryou & Steve Wagg aka CdRsKuLL
License: This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License v3.0 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/gpl.html>
Support: Wether you use this project, have learned something from it, or just like it, please consider supporting us on our web site. :)
@JoeKarlsson
JoeKarlsson / step-1-promises.js
Last active February 26, 2019 20:38
Async Await Demo
const resolveAfter2Seconds = () => {
console.log("starting slow promise");
return new Promise(resolve => {
setTimeout(() => {
resolve(20);
console.log("slow promise is done");
}, 2000);
});
};