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 / 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 / pig-latin-translator.md
Last active November 27, 2023 04:15
Pig Latin Translator

Pig Latin Translator

A new alien species has moved to earth and they only speak pig-latin! The president has called you and says that they need your help!

Your mission is to create a module that is capable of taking an english sentence and translating it into pig latin. We must also be able to understand what our new alien friends are saying, so the module needs to be able to convert pig-latin back to english.

TL;DR: Create a module that translates a string into Pig Latin, and is capable of translating Pig Latin back into in the native language.

How Pig Latin Works

Basically, the Pig Latin system used here works as follows:

@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 / 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 / 1README.md
Last active January 1, 2023 19:33
graphql + dataloader + express-graphql Live Coding Demo

How to test if Dataloader is working correctly, we are going to turn on server logging in order to see how many queries are being made to our db. If Dataloader is setup correctly, we should only see one hit on our db perrequest, even if duplicate data is being requested. Here's how to enable logging on postgresql. Note - This is the Mac way to enable logging.

  • subl /usr/local/var/postgres/postgresql.conf

  • around line 434 log_statement = 'all' uncomment and set to all log_statement = 'all'

  • then brew service restart postgresql

@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
[user]
name = Joe Karlsson
email = joekarlsson1@gmail.com
github = joekarlsson1
[color]
branch = auto
diff = auto
status = auto
ui = auto
@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() {