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
@thinkyhead
thinkyhead / termcolor.scpt
Created December 3, 2023 04:14
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.
--
-- To make the exported application into a hidden background app:
-- defaults write /Path/to/termcolor.app/Contents/Info LSUIElement 1
--
-- Thinkyhead - 2 Dec 2023 - CC-NC-BY
--
@thinkyhead
thinkyhead / StableDiffusion.command
Last active January 27, 2023 04:21
Start Stable Diffusion + InvokeAI on macOS
#!/usr/bin/env zsh
#
# StableDiffusion.command
#
# - Start Stable Diffusion - InvokeAI in the default Terminal.
# - When ready, open InvokeAI in the default Browser.
#
# author: @thinkyhead
# created: 2022-11-10
# revised: 2022-11-18 - allow for multiple project folders
@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 / MarlinMesh.scad
Last active August 9, 2019 06:52
A script to render a Bilinear Mesh in OpenSCAD, with animated scaling
/**************************************\
* *
* OpenSCAD Mesh Display *
* by Thinkyhead - April 2017 *
* *
* Copy the grid output from Marlin, *
* paste below as shown, and use *
* OpenSCAD to see a visualization *
* of your mesh. *
* *
@thinkyhead
thinkyhead / 6502.sublime-syntax
Last active January 4, 2023 00:05
6502 Assembly syntax for Sublime Text
%YAML 1.2
---
#
# 6502 Assembly
#
# 6502 is fairly straightforward, but there are many
# variants, not all of which are easy to take together.
#
# - Code lines have only a few fields, separated by whitespace:
# - Hexdump (e.g., "1234 5C 7F ")
@thinkyhead
thinkyhead / EXPORTER.LST
Created December 31, 2016 09:46
Atari Emulator Send File to Host
.AtariBASIC
.
. Export a file on D: to the host OS by sending it to P:
. Works with Atari800MacX and other Atari 8-bit Computer emulators
.
10 DIM F$(14),N$(12),C$(1),E$(1)
20 C$=CHR$(125):E$=CHR$(155)
30 ? C$;"< ATARI FILE EXPORT >"
40 ? "USES P: TO SEND FILES"
50 ? "TO THE HOST SYSTEM."
@thinkyhead
thinkyhead / SPACEATK.LST
Last active December 31, 2016 09:46
Outer Space Attack by Sheldon Leemon
.AtariBASIC
.
. OUTER SPACE ATTACK V.1 12/81
. By SHELDON LEEMON
. Oak Park, MI 48237
.
10 I=0:J=0:COUNT=0:ATTACK=0:GOSUB 280:GOTO 140
20 . OUTER SPACE ATTACK V.1 12/81
21 . By SHELDON LEEMON
22 . Oak Park, MI 48237
@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