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 / 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";
@thinkyhead
thinkyhead / subl
Last active March 24, 2016 09:21
Sublime Text 2 'subl' scripts for OS X
#!/usr/bin/env bash
#
# Alternative 'subl' command for OS X using 'open -a'
#
TMPL=`basename "$0"`
if [ "$1" = "-" ]; then
FN=$(mktemp "/tmp/$TMPL stdin.XXXXXX")
rm "$FN"
@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 / 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 / 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 / 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 / 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 ")