Skip to content

Instantly share code, notes, and snippets.

@adtac
adtac / Dockerfile
Last active November 1, 2024 03:05
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@tetele
tetele / README.md
Last active September 29, 2024 08:32
ESPHome config - Onju Voice/Home as a voice assistant satellite in Home Assistant
@tetele
tetele / README.md
Last active November 15, 2024 13:56
ESPHome config - Raspiaudio Muse Luxe as a voice assistant satellite in Home Assistant

Introduction

The purpose of this ESPHome config is to be able to use the Raspiaudio Muse Luxe as a voice assistant satellite in Home Assistant.

Features

  • wake word, push to talk and continuous conversation support
  • response playback
  • service exposed in HA to start and stop the voice assistant from another device/trigger
  • visual feedback of the recording/success/error status via the Luxe's onboard LED
@aileftech
aileftech / hex-colors.txt
Created October 1, 2022 18:10
A Bash one-liner to produce a list of HEX color codes that read like (supposedly) valid English words
$ grep -P "^[ABCDEFabcdefOoIi]{6,6}$" /usr/share/dict/words | tr 'OoIi' '0011' | tr '[:lower:]' '[:upper:]' | awk '{print "#" $0}'
#ACAD1A
#B0BB1E
#DEBB1E
#AB1DED
#ACAC1A
#ACCEDE
#AC1D1C
#BAB1ED
#BA0BAB
@mikenabhan
mikenabhan / esphome-magtag.yaml
Created September 1, 2021 02:53
This is a GIST that will help you complile MagTag firmware in ESPHome while platformIO is in a transitional state.
substitutions:
devicename: magtag
upper_devicename: Magtag
esphome:
name: magtag
platform: esp32
board: esp32dev
platformio_options:
@hynek
hynek / Prepositions.md
Last active August 31, 2019 09:26
Why English is Difficult vol. 42

From “Simply English – An A to Z of Avoidable Errors” by Simon Heffer:

Here are some of the most common mistakes with the choice of prepositions: they are often made when a demotic usage seeps into the consciousness of supposedly educated people. A person is absorbed in a task, not by it; but liquid may be absorbed by a sponge. One acquiesces in something, not with it, and one connives at something, not in it. One aims at something, not for it. One becomes angry with someone, not at him. One is ashamed of bad behaviour, not by it. A decision is between one thing and another, not one thing or another. One is bored by or with something, never of it. Something is different from something else, not to it or, even more abominable, than it. One is disgusted with something, not by it. One becomes fed up with things, not of them. Something is identical to something else, not with it. One inculcates something on somebody, one does not inculcate somebody with something;

@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active November 17, 2024 14:13
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@Sorix
Sorix / KeyboardChangeFrameObserver.swift
Last active May 21, 2022 16:03
Report keyboard height changes
import UIKit
/// Observer that will fire events when keyboard frame will be changed (shown, hidden or resized)
/// - Note: Call `addKeyboardFrameChangesObserver()` on init, e.g. on `viewWillAppear`
/// and `removeKeyboardFrameChangesObserver()` on deinit, e.g. on `viewDidDisappear`
public protocol KeyboardChangeFrameObserver: class {
func willChangeKeyboardFrame(height: CGFloat, animationDuration: TimeInterval, animationOptions: UIView.AnimationOptions)
}
public extension KeyboardChangeFrameObserver {
@lukassup
lukassup / zipapp.md
Last active September 12, 2023 02:17
Python zipapp

Python zipapp web apps

What's a zipapp?

This concept is very much like .jar or .war archives in Java.

NOTE: The built .pyz zipapp can run on both Python 2 & 3 but you can only build .pyz zipapps with Python 3.5 or later.

Initial setup

@lianyi
lianyi / test.sh
Created June 12, 2017 19:02
solr testing Transfer-Encoding: chunked
export SOLRUPDATE='http://localhost:8983/solr/testingCore/update?wt=json&commit=true'
export SOLRQUERY='http://localhost:8983/solr/testingCore/select?wt=json&q=*:*'
curl $SOLRUPDATE --data-binary '[{"id": "1"},{"id": "2"}]' -H 'Content-Type: application/json' -X POST -H "Transfer-Encoding: chunked"
#>> response {"responseHeader":{"status":0,"QTime":295}}
curl $SOLRQUERY
#>> {"responseHeader":{"status":0,"QTime":15,"params":{"q":"*:*","wt":"json"}},"response":{"numFound":2,"start":0,"maxScore":1.0,"docs":[{"id":"1","_version_":1570026155898044416},{"id":"2","_version_":1570026155878121472}]}}