Skip to content

Instantly share code, notes, and snippets.

💭
Why is there a status bar?

Steven L sleibrock

💭
Why is there a status bar?
Block or report user

Report or block sleibrock

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sleibrock
sleibrock / weight-table.py
Created Mar 23, 2018
Character weight table generator
View weight-table.py
# character thing
weight_table = [
(100, "Humans"),
(50, "Elves"),
(25, "Dragonborn"),
(20, "Changeling"),
]
def create_roll_table():
@sleibrock
sleibrock / bot.rkt
Created Dec 7, 2017
wip Racket Bot
View bot.rkt
#lang racket/base
(require net/url)
; define consts, structs and params at top level
; constants used to access the thread vector
(define DB 0)
(define WEB 1)
@sleibrock
sleibrock / loop.cpp
Created Aug 16, 2017
Basic Mandelbrot Loop
View loop.cpp
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 / something.rs
Created Apr 19, 2017
Dumb Sum of Multiples of 3 or 5 under N
View something.rs
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,
_ => {}
}
}
View keybase.md

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 / .htaccess
Created Jan 6, 2017
Grad School .htaccess
View .htaccess
# Replace single occurance of CAP with cap, then process next Rule.
RewriteRule ^([^A]*)A(.*)$ $1a$2
RewriteRule ^([^B]*)B(.*)$ $1b$2
RewriteRule ^([^C]*)C(.*)$ $1c$2
RewriteRule ^([^D]*)D(.*)$ $1d$2
RewriteRule ^([^E]*)E(.*)$ $1e$2
RewriteRule ^([^F]*)F(.*)$ $1f$2
RewriteRule ^([^G]*)G(.*)$ $1g$2
RewriteRule ^([^H]*)H(.*)$ $1h$2
RewriteRule ^([^I]*)I(.*)$ $1i$2
@sleibrock
sleibrock / perimeter-polygon.hs
Created Jan 5, 2017
HackerRank find the perimeter of a polygon from a list of points
View perimeter-polygon.hs
-- Enter your code here. Read input from STDIN. Print output to STDOUT
import Control.Monad (forM)
hypot :: Floating a => a -> a -> a -> a -> a
hypot lx ly rx ry = sqrt $ (((rx-lx)**2)+((ry-ly)**2))
-- Fold over a list of points, taking the Euclidean distance, and
-- rotate the next point between each call until we reach an empty list
fp :: Floating a => a -> [a] -> [[a]] -> a
fp acc (lx:ly:[]) ((rx:ry:[]):t) = fp (acc + (hypot lx ly rx ry)) [rx,ry] t
@sleibrock
sleibrock / diff-folders.py
Created Nov 18, 2016
Copy unique files from multiple folders into a new folder
View diff-folders.py
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
Merge two folders together using a diff digest program
If a folders have multiple files of the same digest,
ignore the duplicates and proceed to copy the unique files
into a new target folder. If the folder doesn't exist,
create a new one.
@sleibrock
sleibrock / aucvosor.rkt
Created Oct 11, 2016
Area Under Curve / Volume of Solid of Revolution
View aucvosor.rkt
#lang racket
;; Compute the area under a curve and the volume of the solid between L and R
;; first line is the bases, second is the exponents, third is the L and R limits
(define bases (map string->number (string-split (read-line) " ")))
(define expos (map string->number (string-split (read-line) " ")))
(define-values
(left right)
(apply values (map string->number (string-split (read-line) " "))))
You can’t perform that action at this time.