Skip to content

Instantly share code, notes, and snippets.

View siraben's full-sized avatar

Ben Siraphob siraben

View GitHub Profile
@siraben
siraben / actor.scm
Created February 3, 2019 02:42
Actor model in Scheme
(use-modules (ice-9 match))
;; An actor is a computational entity that, in response to a message
;; it receives, can concurrently:
;; send a finite number of messages to other actors;
;; create a finite number of new actors;
;; designate the behavior to be used for the next message it receives.
;; So it's a dispatch of sorts.
@siraben
siraben / forth.v
Last active April 16, 2023 04:50
Small-step operational semantics of Forth in Coq
Set Warnings "-notation-overridden,-parsing".
From Coq Require Import Arith.Arith.
From Coq Require Import Arith.EqNat.
From Coq Require Import Init.Nat.
From Coq Require Import Lia.
From Coq Require Import Lists.List.
Import ListNotations.
From PLF Require Import Maps.
From PLF Require Import Smallstep.
Import Nat.
@siraben
siraben / rk4.nix
Last active April 7, 2023 21:11
Implementation of sine function in Nix using fourth-order Runge-Kutta
{ lib ? (import <nixpkgs> {}).lib }:
with lib;
let
# Fourth-order Runge-Kutta method
rk4 = f: x0: y0: z0: h:
let
k1_y = z0;
k1_z = f x0 y0 z0;
@siraben
siraben / projects-leaving-freenode.md
Last active March 31, 2023 18:13
List of projects and channels that have left or stayed on Freenode

Note: due to volume, this has been moved to https://github.com/siraben/freenode-exodus

Projects and channels that have left Freenode

This is a (necessarily incomplete) list of projects and channels that have decided to permanently move out of Freenode to https://libera.chat (unless stated otherwise). Please reach out below or on IRC if there's additions or corrections.

Sources are mostly comments I've seen on HN, various IRC channels and web searches.

@siraben
siraben / owner.sol
Created November 6, 2022 22:54
Example Solidity contract with an owner field
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title Owner
* @dev Set & change owner
*/
contract Owner {
@siraben
siraben / factorial.txt
Last active September 25, 2022 18:32
Recursive descent parsing in Cool
((\f. (\x. (f \v. ((x x) v)) \x. (f \v. ((x x) v))) \r. \n. i(n,o,m(n,(r d(n))))) x)
@siraben
siraben / cbv.cl
Created September 8, 2022 18:52
Call-by-value λ-calculus interpreter in Cool
-- Call-by-value lambda calculus in cool
(*
data Expr = Var Str
| Abs Str Expr
| App Expr Expr
| Sub1 Expr
| Mul Expr Expr
| Add Expr Expr
| Ifz Expr Expr Expr
*)
@siraben
siraben / Proving insertion sort in Coq.pdf
Last active July 13, 2022 01:50
Proving insertion sort correct easily in Coq
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverlappingInstances #-}
{-# LANGUAGE TypeOperators #-}
module ExtALaCarte where
@siraben
siraben / vandy_covid.ipynb
Last active February 22, 2022 16:25
Web scraping Vanderbilt's COVID-19 dashboard
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.