Skip to content

Instantly share code, notes, and snippets.

View thinkyhead's full-sized avatar
🤓
Squashing Marlin bugs.

Scott Lahteine thinkyhead

🤓
Squashing Marlin bugs.
View GitHub Profile
#!/usr/bin/env python
#
# Conway's Game of Life (Three Color Variant)
# Author: @thinkyhead
# Date: 11 Oct 2024
#
# P = PAUSE
# Q = QUIT
# K = CLEAR
# B = SPAWN BLINKERS
@thinkyhead
thinkyhead / _ComfyTerm.md
Last active January 20, 2025 03:54
Imagine with ComfyUI in iTerm2, Ghostty, etc.

ComfyUI Terminal Inline Image

Invoke ComfyUI in a terminal program like Ghostty (Kitty Terminal Graphics Protocol) or iTerm2 (Inline Images Protocol) and display the resulting image inline.

Usage

usage: imagine-v1.py [-h] [--comfyui COMFYUI] [--workflow WORKFLOW] [--model MODEL] [--seed SEED]
                     [--steps STEPS] [--sampler SAMPLER] [--scheduler SCHEDULER]
                     [--negative NEGATIVE] [--ratio RATIO] [--size SIZE] [--width WIDTH]
                     [--height HEIGHT] [--scale SCALE]
                     [prompt]
@thinkyhead
thinkyhead / OpenWebUI-GenerateImage-flux-schnell-fp8.json
Last active December 21, 2024 23:47
ComfyUI FLUX Workflow for Open WebUI
{
"6": {
"inputs": {
"text": "prompt",
"clip": [
"11",
0
]
},
"class_type": "CLIPTextEncode"
@thinkyhead
thinkyhead / OpenWebUI-GenerateImage-LCM.json
Created November 21, 2024 06:02
ComfyUI Workflow for Open WebUI
{
"1": {
"inputs": {
"seed": 0,
"steps": 8,
"cfg": 1.2,
"sampler_name": "lcm",
"scheduler": "normal",
"denoise": 1,
"model": [
@thinkyhead
thinkyhead / termcolor.scpt
Last active September 2, 2025 20:32
Randomize Terminal Colors, watch for Appearance change
--
-- termcolor - Set all open Terminal tabs to a random color based on Dark mode.
-- Stay open and check for a change in Dark mode every couple of seconds.
-- When Dark Mode changes update the background color of all Terminal tabs.
--
-- Possible enhancements:
-- • Watch for a new tab and set its colors. Alternative to the 'rndterm' perl script.
-- • Remember the background colors and retain the hue when dark mode changes.
--
-- To make the exported application into a hidden background app:
@thinkyhead
thinkyhead / timer_fun.cpp
Last active November 13, 2017 10:29
A function to set Arduino Timer 5 using the FastIO macros included with Marlin Firmware
/**
* Set Timer 5 PWM frequency in Hz, from 3.8Hz up to ~16MHz
* with a minimum resolution of 100 steps.
*
* DC values -1.0 to 1.0. Negative duty cycle inverts the pulse.
*/
uint16_t set_pwm_frequency_hz(const float &hz, const float dca, const float dcb, const float dcc) {
float count = 0;
if (hz > 0 && (dca || dcb || dcc)) {
count = float(F_CPU) / hz; // 1x prescaler, TOP for 16MHz base freq.
@thinkyhead
thinkyhead / RENUM.LST
Last active December 31, 2016 09:49
Line renumber in Atari BASIC
.
. AtariBASIC RENUM.BAS
. Renumbers lines only, not GOSUB/GOTO.
.
. Corrected version of
. http://www.atarimagazines.com/compute/issue10/042_1_ATARI_BASIC_A_LINE_RENUMBERING_UTILITY.php
.
. To save: L."D:RENUM.LST"
. To run: E."D:RENUM.LST":G.9000
.
@thinkyhead
thinkyhead / Ambidextrous-SCARA.scad
Created September 5, 2016 04:25
Ambidextrous SCARA Kinematics
/**
* Ambidextrous SCARA Kinematics with optimized mathematics
*/
// Lengths of the arm segments
// If the lengths are the same the maths can be optimized
arm1_length = 5;
arm2_length = 3;
arm_sum = arm1_length + arm2_length;
@thinkyhead
thinkyhead / prune
Last active March 24, 2016 09:24
Git Prune Everything - Prune all merged branches and all "gone" branches
#!/usr/bin/env bash
echo "Pruning Merged Branches..."
git branch --merged | egrep -v "^\*|master|development" | xargs -n 1 git branch -d
echo
echo "Pruning Gone Branches..."
git branch -vv | grep ': gone]' | gawk '{print $1}' | xargs -n 1 git branch -D
echo
@thinkyhead
thinkyhead / drupal-view-ftp.php
Created October 6, 2012 00:35
Drupal: FTP the output of a View
<?php
function _my_export_view_via_ftp($nid) {
$out = 'FTP ERROR'; // assume the worst
// example view/display/ftp info/filename
$view_name = 'feeds';
$display_id = 'views_display_name';
$host = 'ftp.mydomain.com'; $user = 'myftpuser'; $pass = 'myftppass';
$filename = "node{$nid}.xml";