Skip to content

Instantly share code, notes, and snippets.

View chasepeck's full-sized avatar
™️

Chase Peck chasepeck

™️
View GitHub Profile
use sdl2::render::Canvas;
pub fn new_sdl(name: &str, width: u32, height: u32)
-> (sdl2::Sdl, Canvas<sdl2::video::Window>, sdl2::VideoSubsystem)
{
let context = sdl2::init().unwrap();
let video_subsystem = context.video().unwrap();
let window = new_window(name, width, height, &video_subsystem);
let canvas = new_canvas(window);
@chasepeck
chasepeck / tis100-overflow_detector
Last active July 6, 2022 00:40
TIS-100 Puzzle: Overflow Detector
function get_name()
return "OVERFLOW DETECTOR"
end
function get_description()
return { "Read a -99-terminated sequence from IN and output the sum of all of the items to OUT.A.", "If adding a number would bring the total over 999, output a 1 to OUT.O." }
end
function get_streams()
input = {}
@chasepeck
chasepeck / ac.gml
Last active July 1, 2022 11:52
AC system
function ac(_curve, _channel, _step, _backwards = false, _frame = 0, _disabled = false, _mn = 0, _mx = 1, _autoreset = true, _autodisable = true) constructor {
curve = _curve;
channel = _channel;
step = _step;
backwards = _backwards;
frame = _frame;
disabled = _disabled;
mn = _mn;
mx = _mx;
autoreset = _autoreset;
@chasepeck
chasepeck / tis100-parallel_binary_converter
Last active July 29, 2022 04:33
TIS-100 Puzzle: Parallel Binary Converter
function get_name()
return "PARALLEL BINARY CONVERTER"
end
function get_description()
return { "Convert the binary from IN.D0 thru IN.D3 to a decimal number.", "Send the number to OUT." }
end
function get_streams()
d0 = {}
@chasepeck
chasepeck / tis100-decimal_to_binary
Last active July 6, 2022 00:39
TIS-100 Puzzle: Decimal to Binary
function get_name()
return "DECIMAL TO BINARY"
end
function get_description()
return { "Convert the decimal number from IN.A to binary. Send the binary to OUT.A.", "Binary numbers should be seperated by -99." }
end
function get_streams()
input = {}
@chasepeck
chasepeck / earth.micro
Created September 11, 2021 15:58
Earth theme for the Micro editor - https://github.com/zyedidia/micro
color-link default "#1e1615, #c6beab"
color-link comment "italic #6a5553"
color-link identifier "#c48519"
color-link constant "#c13838"
color-link constant.string "#639e29"
color-link statement "#d65151"
color-link symbol "#c6beab60"
color-link symbol.tag "#ba9d6f"
color-link symbol.operator "#756160"
color-link symbol.brackets "#756160"
@chasepeck
chasepeck / tis100-binary_to_decimal
Last active July 6, 2022 00:39
TIS-100 Puzzle: Binary to Decimal
function get_name()
return "BINARY TO DECIMAL"
end
function get_description()
return { "Convert the binary from IN.A to a decimal number. Send the number to OUT.A.", "Binary numbers are 8 digits long." }
end
function get_streams()
input = {}
# mh theme
# preview: https://cl.ly/1y2x0W0E3t2C0F29043z
# features:
# path is autoshortened to ~30 characters
# displays git status (if applicable in current folder)
# turns username green if superuser, otherwise it is white
# if superuser make the username green
if [ $UID -eq 0 ]; then NCOLOR="green"; else NCOLOR="white"; fi