Skip to content

Instantly share code, notes, and snippets.

@slaiyer
slaiyer / static.py
Created June 26, 2021 15:43
Yeelight color setter
#!/usr/bin/env python3
"""Yeelight color setter."""
import argparse as arg
import functools as func
import pathlib as path
import sys
import yeelight as y
@slaiyer
slaiyer / switch.py
Last active August 8, 2025 23:24
Yeelight bulb switch
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "yeelight",
# ]
# ///
"""Switch Yeelight bulb on or off."""
@slaiyer
slaiyer / blend.py
Last active August 8, 2025 23:23
Yeelight flow controller
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "numpy",
# "yeelight",
# ]
# ///
"""Yeelight flow controller."""
@slaiyer
slaiyer / tauler.py
Last active August 8, 2025 23:16
Euler's identity, but with tau
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "numpy",
# "PythonTurtle",
# ]
# ///
# `brew install python-tk`
@slaiyer
slaiyer / euler.py
Last active August 8, 2025 23:21
Euler's identity
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "numpy",
# "PythonTurtle",
# ]
# ///
# `brew install python-tk`
@slaiyer
slaiyer / hilbert.py
Last active August 8, 2025 23:11
Hilbert curve
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "PythonTurtle",
# ]
# ///
# `brew install python-tk`
import argparse
@slaiyer
slaiyer / validate-jenkins-pipeline.sh
Created March 9, 2021 20:01
Jenkins pipeline validator
# Get JENKINS_SESSION_COOKIE='JSESSIONID.[...]=[...]' from browser cookie jar for $JENKINS_URL while logged in
# This is in lieu of $JENKINS_URL/crumbIssuer/api/json?pretty=true not being usable
curl \
-H "cookie: $JENKINS_SESSION_COOKIE" \
-F "jenkinsfile=<$JENKINSFILE_PATH" \
$JENKINS_URL/pipeline-model-converter/validate
@slaiyer
slaiyer / dvd.html
Created December 29, 2020 10:41
HTML programming
<html>
<head>
<title>S04E05</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
background: black;
}
</style>
@slaiyer
slaiyer / .bash_profile
Created December 2, 2018 13:25
Bash PS1
export PS1='\n$([[ $(jobs | wc -l) -gt 0 ]] && printf '\''<\j> '\'')[\e[1m\u\e[0m] \w\n \[\e[1m\]\$\[\e[0m\] '