Skip to content

Instantly share code, notes, and snippets.

View sploders101's full-sized avatar

Shaun Keys sploders101

View GitHub Profile
# Example configuration for the m5stack ATOM Echo with support for speaking through an external speaker
substitutions:
name: m5stack-atom-echo-31ace0
friendly_name: Shaun's Room Echo
speaker_entity: media_player.shaun_s_bedroom_lamp
wake_word: okay_nabu
api:
esphome:
@sploders101
sploders101 / test.c
Created December 16, 2023 19:21
Proof we live in the Matrix
/*
Proof we live in the matrix:
If black holes are formed by compressing more and more matter into a
limited space until it gives in and sucks in everything around it,
then it stands to reason that this phenomenon is caused by an integer
overflow in the density property of that space.
Because integers within a computer occupy a finite space, they cannot
[colors.bright]
black = "0x7f7f7f"
blue = "0x5c5cff"
cyan = "0x00ffff"
green = "0x00ff00"
magenta = "0xff00ff"
red = "0xff0000"
white = "0xffffff"
yellow = "0xffff00"
@sploders101
sploders101 / streamSplicer.ts
Created May 3, 2021 20:35
Readable stream to splice many different sequential streams into one
import {
Readable,
} from "stream";
export interface SpliceEntry {
size: number;
stream: Readable | Buffer;
}
export class StreamSplicer extends Readable {
@sploders101
sploders101 / updateProxy.ts
Last active August 6, 2021 13:58
Example update proxy for electron
import http from "http";
import https from "https";
import {
AddressInfo,
} from "net";
import { URL } from "url";
const updateServer = "https://updates.yourserver.com/path/to/update/dir/without/trailing/slash";
const updateAuth = `Basic ${Buffer.from("username:password").toString("base64")}`
@sploders101
sploders101 / MuuriGrid.vue
Last active August 18, 2020 08:45
Array-based muuri grid
<template>
<div
ref="muuriel"
class="muuri"
>
<div
class="muuri-item"
v-for="field in value"
:muurikey="field[muurikey]"
@sploders101
sploders101 / download.js
Last active June 23, 2020 21:11
Simple function for downloading text
function downloadString(str, name) {
const elem = document.createElement("a");
elem.href = URL.createObjectURL(new Blob([str]));
elem.download = name;
elem.click();
}
@sploders101
sploders101 / stringifyParseCircular.ts
Created February 14, 2020 21:57
[JS] Circular reference deconstructor/reconstructor. Can be used to serialize objects with circular references
const rand = () => Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
type CSValue = CSLiteral | CSRef;
type CSLiteral = string | number | boolean | null;
type CSRef = [string];
export function analyzeRefs(obj: any) {
const reference = new Map<object | any[], string>();
// Build reference table
@sploders101
sploders101 / barcodeInput.vue
Created December 19, 2019 20:26
Barcode scanner input component [vue] [vuetify] [instascan]
<template>
<div>
<v-text-field
v-model="syncVal"
>
<template slot="append">
<v-tooltip top>
<template v-slot:activator="{ on }">
<v-btn
v-on="on"
@sploders101
sploders101 / events.d.ts
Last active October 30, 2019 16:01
Muuri 0.8.0 types
import Item from "./item";
import Muuri from ".";
// Type this!!!
export type DraggerEvent = any;
export interface EventListeners {
synchronize(): any;
layoutStart(items: Item[]): any;
layoutEnd(items: Item[]): any;