Skip to content

Instantly share code, notes, and snippets.

View Chriscbr's full-sized avatar

Chris Rybicki Chriscbr

View GitHub Profile
package main
import (
"errors"
"fmt"
"log"
"math/rand"
"sync"
"time"
)
use std::{collections::HashSet, rc::Rc};
#[derive(Debug, PartialEq, Eq, Hash)]
pub enum Type {
Int,
String,
Boolean,
Array(Box<Type>),
Function(Vec<Type>, Box<Type>), // parameter types, return type
}
@Chriscbr
Chriscbr / functions.als
Created August 4, 2024 18:54
Modeling type systems with Alloy
abstract sig Type {}
sig Primitive extends Type {}
sig Resource extends Type {}
fact {
one Primitive
}
sig Function {
@Chriscbr
Chriscbr / numbers.asm
Created July 14, 2024 03:35
Prints numbers from a file - written in NASM
; nasm -fmacho64 numbers.asm && gcc numbers.o -o numbers && ./numbers
global _main
extern _printf
extern _scanf
extern _fopen
extern _fgets
extern _atoi
section .text
"""
Goal: try to find a functions f(x) and g(x) such that f(g(x)) is increasing and g(f(x)) is decreasing.
(This program does not solve the puzzle.)
"""
import math
fns = [
(lambda x: 0, "0"),
#!/bin/bash
set -euxo pipefail
# Ensure AWS CLI is installed
if ! command -v aws &> /dev/null; then
echo "AWS CLI is not installed. Please install it and configure it."
exit 1
fi
# List all APIs and delete them
use gpui::prelude::*;
use gpui::*;
struct Counter {
count: usize,
}
impl Render for Counter {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
let mut button = div()
@Chriscbr
Chriscbr / uninit-alloc-bench.rs
Created February 1, 2024 02:54
use `cargo bench` with toolchain set to nightly
#![feature(test)]
extern crate test;
use test::Bencher;
const SIZE: usize = 2 << 10;
#[bench]
fn bench_zeroed_memory(b: &mut Bencher) {
b.iter(|| {
@Chriscbr
Chriscbr / perf3.log
Created January 19, 2024 20:42
wing compile -t tf-aws (complex app)
2024-01-19T20:18:48.186Z cli called
2024-01-19T20:18:48.210Z main called
2024-01-19T20:18:48.215Z importing command
2024-01-19T20:18:48.245Z calling imported command
2024-01-19T20:18:48.245Z compile called
2024-01-19T20:18:48.245Z globbing finished
2024-01-19T20:18:48.245Z setting up synthesis dir
2024-01-19T20:18:48.269Z finished setting up synthesis dir
2024-01-19T20:18:48.269Z loading wingc
2024-01-19T20:18:48.277Z invoking wingc
@Chriscbr
Chriscbr / perf2.log
Last active January 19, 2024 20:42
wing compile -t tf-aws (simple app)
2024-01-19T20:39:52.816Z cli called
2024-01-19T20:39:52.854Z main called
2024-01-19T20:39:52.861Z importing command
2024-01-19T20:39:52.909Z calling imported command
2024-01-19T20:39:52.909Z compile called
2024-01-19T20:39:52.909Z globbing finished
2024-01-19T20:39:52.910Z setting up synthesis dir
2024-01-19T20:39:52.913Z finished setting up synthesis dir
2024-01-19T20:39:52.913Z loading wingc
2024-01-19T20:39:52.944Z invoking wingc