Skip to content

Instantly share code, notes, and snippets.

View stephancom's full-sized avatar

stephan.com stephancom

View GitHub Profile
@stephancom
stephancom / startup.gcode
Created November 5, 2022 01:12
Cura startup gcode for CR-6 SE with wire brush cleaning
; Script based on an original created by tjjfvi (https://github.com/tjjfvi)
; An up-to-date version of the tjjfvi's original script can be found
; here: https://csi.t6.fyi/
; Note - This script will only work in Cura V4.2 and above!
; --- Global Settings
; layer_height = {layer_height}
; smooth_spiralized_contours = {smooth_spiralized_contours}
; magic_mesh_surface_mode = {magic_mesh_surface_mode}
; machine_extruder_count = {machine_extruder_count}
; --- Single Extruder Settings
@stephancom
stephancom / rails_six_calculations.rb
Created May 6, 2022 09:26
Rails 6 date/time calculations, backported
module CoreExtensions
module DateAndTime
# ___ _ _ ___ _ ___ _ _ _ _
# | _ \__ _(_) |__/ __(_)_ __/ __|__ _| |__ _ _| |__ _| |_(_)___ _ _ ___
# | / _` | | (_-<__ \ \ \ / (__/ _` | / _| || | / _` | _| / _ \ ' \(_-<
# |_|_\__,_|_|_/__/___/_/_\_\\___\__,_|_\__|\_,_|_\__,_|\__|_\___/_||_/__/
#
# A little backporting
# https://github.com/rails/rails/pull/32398
# https://github.com/rails/rails/pull/32398/commits/4e68b159d5696ca58c015a790ef3ceacb90b27c1
#
# superegg.rb
# Piet Hein's superegg
#
# ported from Python in 2022 by stephan.com
#
# original by Chris Wallace (kitwallace) 2013
# https://www.thingiverse.com/thing:48808
#
# https://en.wikipedia.org/wiki/Superegg
#
# superegg.rb
# Piet Hein's superegg
#
# ported from Python in 2020 by stephan.com
#
# original by Chris Wallace (kitwallace) 2013
# https://www.thingiverse.com/thing:48808
#
# https://en.wikipedia.org/wiki/Superegg
@stephancom
stephancom / tasks.rb
Created February 23, 2022 11:07
spec/support/tasks.rb
# https://www.eliotsykes.com/test-rails-rake-tasks-with-rspec
require 'rake'
# Task names should be used in the top-level describe, with an optional
# "rake "-prefix for better documentation. Both of these will work:
#
# 1) describe "foo:bar" do ... end
#
# 2) describe "rake foo:bar" do ... end
#
@stephancom
stephancom / enlang.rb
Last active December 5, 2021 06:32
a langfeldian binary encoding tool
#! /usr/bin/ruby
# full of sound and fury
class Hippie
def initialize(name)
@name = name
end
def smoke(this)
ciphertext = encode(this)
@stephancom
stephancom / delang.rb
Last active December 5, 2021 05:48
a software poem for john langfeld
#! /usr/bin/ruby
pearls = <<~ENDOFPOEM.freeze
Framed, Mounted and Preggers'
22975
6/19/19
Sneaking out of the bedroom in the wee hours he sat,
staring at digits and images and flummox and hope.
Who stared back?
01010100 01101000 01100101 00100000
@stephancom
stephancom / 5x5.rb
Created August 11, 2021 19:45
five by five, redux - blacksmith gunpowdery II
#!/usr/bin/ruby
# (c) 2021 stephan.com
# Find to N words of M letters, all unique
#
# No five-letter/five-word set exists, but there is a single
# result for two words of ten letters: blacksmith gunpowdery
require 'Set'
require 'progress_bar'
@stephancom
stephancom / brakeman.bash
Created July 21, 2021 18:19
brakeman shell script
#!/bin/bash
# _ _
# | |__ _ _ __ _ | |__ ___ _ __ __ _ _ _
# | '_ \ | '_| / _` | | / / / -_) | ' \ / _` | | ' \
# |_.__/ _|_|_ \__,_| |_\_\ \___| |_|_|_| \__,_| |_||_|
# _|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|
# "`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'
#
# Script for running Brakeman tests
# Brakeman is a security scanner https://github.com/presidentbeef/brakeman.
@stephancom
stephancom / Multipause.py
Created May 16, 2021 01:16
A script for Ultimaker Cura allowing for a list of layers to pause for filament change.
# Copyright (c) 2020 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
# modified for list of pauses by stephan.com
from ..Script import Script
from UM.Application import Application #To get the current printer's settings.
from UM.Logger import Logger