Skip to content

Instantly share code, notes, and snippets.

@Billiam
Billiam / box.js
Created October 22, 2021 17:30
CascadeStudio box
let requestedWidth = Slider("Width", 100, 10, 300, true, 1, 0)
let requestedDepth = Slider("Depth", 50, 5, 300, true, 1, 0)
let requestedHeight = Slider("Height", 20, 11, 100, true, 1, 0)
let rows = Slider("Rows", 2, 1, 20, true, 1, 0)
let columns = Slider("Columns", 5, 1, 20, true, 1, 0)
let outsideRadius = Slider("Radius", 10, 2, 40, true, 1, 0)
let latches = Slider("Latches", 1, 1, 3, true, 1, 0)
let hingeStyle = Dropdown("Hinge type", "pin", {Pin: "pin", Detent: "cone"}, true)
@Billiam
Billiam / ProxyBot.rb
Last active November 1, 2018 19:43
Halite-III Ruby Debugging proxy
require 'socket'
SOCKET_FILE = './.bot_socket'
$stdout.sync = true
File.delete(SOCKET_FILE) if File.exist?(SOCKET_FILE)
server = UNIXServer.open(SOCKET_FILE)
bot_connection = server.accept
OUTPUT_DESTINATIONS = {

Start gcode

M301 P23.35 I1.56 D87.6 ; set PID
G28 ; home all axes
M205 X8 ; Reduce jerk
M201 X800 Y800 ; Reduce maximum acceleration
G1 Z5 F5000 ; lift nozzle

End G-Code

# Keep a series of backups of Tabletop Simulator's autosave files in an autosave directory
# The most recent 5 will keep the .json file extenion, and any older than that
# will use .bak, so that Tabletop Simulator will not try to process them.
# Update with the path to your save directory
$sourceDir = "C:\Path\To\Documents\My Games\Tabletop Simulator\Saves"
$destinationDir = $sourceDir + "\Autosave"
# The total number of rotated backups to keep.
module Life; end
class Life::DeadWorldException < Exception; end
module Depth
def self.color(depth, str)
color = 255 - (depth * 22).floor
"\033[38;5;#{color}m#{str}\033[0m"
end
#!/usr/bin/env ruby
# encoding: utf-8
require 'bigdecimal'
def pseudo_science(num)
decimal = BigDecimal(num)
# Split incoming number into component parts
sign, significant_digits, base, exponent = decimal.split
# strip trailing decimal zeroes from input
function truncate_lines(str, lines, width, font, suffix)
if not width or lines == 1 then return string end
lines = lines or 1
font = font or love.graphics.getFont()
suffix = suffix or '...'
local suff_len = #suffix
while select(2, font:getWrap(str, width)) > lines and str ~= suffix do
str = str:sub(1, - (suff_len + 2)) .. suffix
@Billiam
Billiam / telemetry.py
Created July 3, 2015 17:19
DiRT Rally Telemetry
import socket
import struct
import os
# Create UDP socket.
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# Bind to LFS.
sock.bind(('127.0.0.1', 20777))
var $b = $('#box');
new MutationObserver(function() {
setTimeout(function() {
$b.find('span').filter(function(i,s) { return $(s).data('type') == 'a' }).click();
})
}).observe($b.get(0), {childList: true});
$('.btn-restart, .play-btn').click();
source 'https://rubygems.org'
ruby '1.9.3'
gem 'padrino', '~> 0.11.4'
gem "mongoid_geospatial", "~> 2.8.2"