Skip to content

Instantly share code, notes, and snippets.

@sk-t3ch
sk-t3ch / growthbook-quickstart-infra.yml
Last active July 11, 2023 14:39
GrowthBook Quickstart CloudFormation Template
Parameters:
Product:
Type: String
Default: growthbook
Account:
Type: String
AllowedValues:
- dev
- prod
@sk-t3ch
sk-t3ch / dynamicSetInterval.js
Last active February 24, 2022 01:45
Set a dynamic interval with JS. This example shows a growing interval for logs.
const dynamicSetInterval = (func, getInterval) => {
setTimeout(() => {
func();
dynamicSetInterval(func, getInterval);
}, getInterval());
};
let currentInterval = 1000; // 1 second
const maxInterval = 1000 * 60 * 3; // 3 minutes
@sk-t3ch
sk-t3ch / share_qs_analysis.py
Created January 26, 2022 11:23
Share QuickSight Analysis to a different user with Boto3.
import boto3
AWS_SECRET_ACCESS_KEY="***"
AWS_ACCESS_KEY_ID="***"
AWS_ACCOUNT_ID="***"
client = boto3.client('quicksight', aws_access_key_id=AWS_ACCESS_KEY_ID,
aws_secret_access_key=AWS_SECRET_ACCESS_KEY)
# find your namespace
client.list_namespaces(AwsAccountId=AWS_ACCOUNT_ID,)
@sk-t3ch
sk-t3ch / medium-to-markdown.py
Last active January 31, 2022 16:55
Medium To MarkDown Script for the https://medium-to-markdown.t3chflicks.org service
import re
from datetime import datetime
import json
from io import BytesIO
import requests
MEDIUM_IMG_CDN = "https://cdn-images-1.medium.com/max/"
def MediumToMarkdownBuilder(request_get):
def _func(url):
@sk-t3ch
sk-t3ch / monitor_power.ino
Created March 2, 2021 22:17
Smart Buoy - Monitor usage/charging current and battery voltage with a INA219 power sensor
#include <Wire.h>
#include <Adafruit_INA219.h>
Adafruit_INA219 ina219;
float shuntvoltage = 0;
float busvoltage = 0;
float current_mA = 0;
float loadvoltage = 0;
float power_mW = 0;
@sk-t3ch
sk-t3ch / control_power_with_rtc_based_on_monitoring.ino
Created March 2, 2021 22:16
Smart Buoy - Control power with RTC module based on voltage from INA219 Power monitor
#include <DS3232RTC.h>
#include <Adafruit_INA219.h>
#include <Wire.h>
int led = LED_BUILTIN;
// INA219 - Power Monitor
Adafruit_INA219 ina219;
@sk-t3ch
sk-t3ch / control_power_with_rtc_alarm.ino
Created March 2, 2021 22:14
Smart Buoy - Control power with RTC module turns on every 15 seconds
#include <DS3232RTC.h>
#include <Wire.h>
int led = LED_BUILTIN;
void setup() {
Serial.begin(115200);
Wire.begin();
pinMode(led, OUTPUT);
}
@sk-t3ch
sk-t3ch / gps-radio-sd-transmitter.ino
Last active March 2, 2021 21:51
Smart Buoy - Transmit with nRF24L01nd store GPS measurements with SD card
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <SD.h>
TinyGPSPlus gps;
@sk-t3ch
sk-t3ch / sd_card_logging.ino
Created March 2, 2021 21:47
Smart Buoy - Saving GPS measurements with an SD card module
#include <SPI.h>
#include <SD.h>
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
TinyGPSPlus gps;
SoftwareSerial ss(4, 3);
struct dataStruct{
@sk-t3ch
sk-t3ch / gps-radio-transmitter.ino
Created March 2, 2021 21:44
Smart Buoy - Transmit GPS data with nRF24L01 Radio
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
TinyGPSPlus gps;
SoftwareSerial ss(4, 3);
RF24 radio(8, 7); // CE, CSN