Skip to content

Instantly share code, notes, and snippets.

View a11ce's full-sized avatar
🐱

sophia a11ce

🐱
View GitHub Profile
import random
def main():
pop = makePopulation(10)
pop[3][3] = 5
for i in range(100):
pop = stepForward(pop)
# COMMENT AND UNCOMMENT NEXT TWO LINES
@a11ce
a11ce / script.gs
Created August 26, 2021 21:53
Class Spreadsheet Sorter
// https://stackoverflow.com/a/54024653
function hsv2rgb(h,s,v)
{
let f= (n,k=(n+h/60)%6) => v - v*s*Math.max( Math.min(k,4-k,1), 0);
return [f(5) * 255,f(3) * 255,f(1) * 255];
}
// https://stackoverflow.com/a/52171480
function hash(str, seed = 0) {
let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
@a11ce
a11ce / julia.rkt
Created October 18, 2021 22:22
julia fractals with shading.rkt
#lang racket
(require (except-in "shading.rkt"
; we need magnitude from racket
; for complex numbers
magnitude))
; creates a procedure f_c(z) = z^2 + c
; given a constant c
(define (julia-fc c)
@a11ce
a11ce / reversing-the-technical-interview.rkt
Created November 19, 2021 20:52
Racket translation of "Reversing the technical interview"
#lang racket
; read this, and check back here as you go for racket code
; https://aphyr.com/posts/340-reversing-the-technical-interview
(define (cons h t)
(lambda (p)
(if p
h
t)))
#!/bin/bash
# no set -e because gh might 404
set -uo pipefail
IFS=$'\n\t'
if test "$#" -ne 2; then
echo "run as ./github-add-collabs.sh user/repo usernames.txt"
exit
fi

DO NOT USE THIS INFORMATION

Some libraries are incorrectly identified as Apache 2.0/MIT. The solution is to manually add license fields in each info.rkt and (make a tool to) go off of those.

Library License
com-win32-i386 Apache 2.0/MIT
com-win32-x86_64 Apache 2.0/MIT
db-ppc-macosx Apache 2.0/MIT
db-win32-i386 Apache 2.0/MIT
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// included bc i use clang, remove if gcc.
// taken from
// https://github.com/lattera/glibc/blob/master/string/memfrob.c
void *memfrob(void *s, size_t n) {
char *p = (char *)s;