Skip to content

Instantly share code, notes, and snippets.

View KTibow's full-sized avatar

Kendell R KTibow

View GitHub Profile
@KTibow
KTibow / esphome_effect_snippet.yaml
Created August 19, 2023 17:39
chroma haze esphome light strip effect
- addressable_lambda:
name: "Chroma Haze"
update_interval: 100ms
lambda: |
static uint8_t hue = 160;
static uint16_t saturation = 255;
hue = hue - 5 + (uint16_t)(random_float() * 10);
float rand_v = random_float();
uint16_t new_saturation = 255 - (uint16_t)(rand_v * rand_v * 200);

Title: "WHY DA PEE PEE WET"

Page 1:
Contents: "Dear reader, you're on the verge to stumble upon some new experiences being an adolescent boy. Some things may be puzzling - like why da pee pee wet? Let's explore this together!"
Alt text: A young teen boy appearing confused, holding a magnifying glass, setting off on an investigation.

Page 2:
Contents: "Let's start from the basics. What's puberty? Puberty is when your body starts to develop and change. It's a part of growing up!"
Alt text: Animated image of a boy hitting a growth chart marked with ages and signs of puberty.

@KTibow
KTibow / AddNotification.svelte
Created April 12, 2023 11:45
My system for web notifications
<script>
import { PUBLIC_NOTIF_KEY } from "$env/static/public";
let setupState = false;
async function setup() {
setupState = "loading-0";
await Notification.requestPermission();
const registration = await navigator.serviceWorker.ready;
setupState = "loading-1";
let sub;
try {
from PIL import Image, ImageOps
image = Image.open("snapshot.jpg")
width, height = image.size
if width > 178 or height > 128:
image.thumbnail((178, 128))
image = ImageOps.pad(image, (178, 128), color=(255, 255, 255))
image = image.convert("1")
words = set(open("words.txt").read().splitlines())
word_length = int(input("Enter word length: "))
words = {word.lower() for word in words if len(word) == word_length}
letters = "abcdefghijklmnopqrstuvwxyz"
def calc_reduction(letter):
masks = ["".join([letter if c == letter else " " for c in word]) for word in words]
counts = dict()
for item in masks:
@KTibow
KTibow / Monaco.svelte
Created November 6, 2022 20:14
Monaco editor in svelte
<script>
import { onMount } from "svelte";
import editorWorker from "monaco-editor/esm/vs/editor/editor.worker?worker";
import jsonWorker from "monaco-editor/esm/vs/language/json/json.worker?worker";
import cssWorker from "monaco-editor/esm/vs/language/css/css.worker?worker";
import htmlWorker from "monaco-editor/esm/vs/language/html/html.worker?worker";
import tsWorker from "monaco-editor/esm/vs/language/typescript/ts.worker?worker";
let subscriptions = [];
export let content;
// ==UserScript==
// @name for r/place
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the canvas!
// @author KTibow
// @match https://hot-potato.reddit.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=reddit.com
// @grant none
// @run-at document-end
import pygame
pygame.init()
width = 1024
height = 1024
screen = pygame.display.set_mode((width, height))
bg = pygame.Surface((width, height), pygame.SRCALPHA)
font = pygame.font.SysFont("Ubuntu", 64)
@KTibow
KTibow / index.html
Last active January 16, 2022 19:18
Sends you a notification when your Prusa Mini+ finishes (change IP in server.py)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Printer Notifier</title>
<style>
body {
background: #282233;
color: white;
@KTibow
KTibow / hangman_guesser.py
Last active December 13, 2021 00:45
Simple hangman game guesser written in Python.
# Simple hangman guesser by @KTibow
# Get the possible words from the file
import string
all_words = open("words_alpha.txt").read().splitlines()
# Get how long the word is
word_length = int(input("How long is the word? "))
word_letters = [[] for i in range(word_length)]
possible_words = []