Skip to content

Instantly share code, notes, and snippets.

View sleibrock's full-sized avatar
🗿
Chronomaly Moai

Steven sleibrock

🗿
Chronomaly Moai
View GitHub Profile
@sleibrock
sleibrock / keybase.md
Created March 30, 2017 19:07
My Keybase

Keybase proof

I hereby claim:

  • I am sleibrock on github.
  • I am sleibrock (https://keybase.io/sleibrock) on keybase.
  • I have a public key whose fingerprint is 1406 3C8D 0ADD C7DB 2CC0 467B 36D7 98FF F8C6 90B9

To claim this, I am signing this object:

@sleibrock
sleibrock / something.rs
Created April 19, 2017 18:30
Dumb Sum of Multiples of 3 or 5 under N
fn solution(num: i32) -> i32 {
let mut acc = 0;
for x in 0..num {
match (x % 3, x % 5) {
(0, 0) => acc += x,
(0, _) => acc += x,
(_, 0) => acc += x,
_ => {}
}
}
@sleibrock
sleibrock / kf2m.md
Created June 15, 2017 17:15
Killing Floor 2 Workshop Maps
@sleibrock
sleibrock / loop.cpp
Created August 16, 2017 22:58
Basic Mandelbrot Loop
unsigned char iter;
for(unsigned int y=0; y < h; y++)
{
for(unsigned int x=0; x < w; x++)
{
iter = 0;
z_re = 0;
z_im = 0;
z_re2 = 0;
z_im2 = 0;
@sleibrock
sleibrock / weight-table.py
Created March 23, 2018 22:15
Character weight table generator
# character thing
weight_table = [
(100, "Humans"),
(50, "Elves"),
(25, "Dragonborn"),
(20, "Changeling"),
]
def create_roll_table():
@sleibrock
sleibrock / str2proc.rkt
Created September 4, 2019 01:07
Convert a Racket string to a Racket procedure/function
#lang racket/base
#|
String -> Procedure
A way to convert a Racket string into a procedure object.
This is done by hot-code evaluation. Since there's no built-in
method to convert anything to a procedure other than defining
the procedure itself, this lets us check if a string is indeed
@sleibrock
sleibrock / dct.py
Created December 2, 2019 21:21
Discrete Cosine Transform test
#!/usr/bin/env python
from math import cos, pi, sqrt
from itertools import product
test_matrix = [[90, 100], [100, 105]]
def dct(lst):
if len(lst) == 0:
@sleibrock
sleibrock / bot.rkt
Last active April 24, 2020 15:42
ssh-chat bot version 0.1
#lang racket/base
(define (start-bot)
(subprocess #f #f 'stdout
(find-executable-path "ssh")
"-p 2022"
"-o SetEnv TERM=bot"
"bot@0.0.0.0"))
@sleibrock
sleibrock / Cat.zig
Last active September 14, 2021 14:35
GNU Cat but in Zig
//! GNU Cat replacement, but with Zig I guess
/// -- made with love from @sleibrock
///
/// Exists as a proof of concept of general C-like programming using Zig.
/// Compiles to about 62kb compared to GNU/cat's 39kb.
/// @requires "zig-0.8.1"
const std = @import("std");
const io = std.io;
const fs = std.fs;
@sleibrock
sleibrock / CSVMacro.rkt
Last active December 7, 2021 21:55
A WIP CSV Macro in Racket
#lang racket/base
; for-syntax means importing bindings for the macro-level generation phase
(require (for-syntax racket/syntax racket/base racket/string)
(only-in racket/string string-join string-split)
(only-in racket/port port->lines))
(define-syntax (defrec stx)
(syntax-case stx ()
[(_ id col-headers (fields ...) delim)