Skip to content

Instantly share code, notes, and snippets.

Avatar

Brendan Zabarauskas brendanzab

View GitHub Profile
@Jack-Works
Jack-Works / 2018.js
Last active Jun 1, 2021
cRAzY eSnEXt (*all* proposals mixed in)
View 2018.js
#! Aaaaaaaaaaa this is JS!!!
// https://github.com/tc39/proposal-hashbang
// This file is mixing all new syntaxes in the proposal in one file without considering syntax conflict or correct runtime semantics
// Enjoy!!!
// Created at Nov 23, 2018
for await(const x of (new A // https://github.com/tc39/proposal-pipeline-operator
|> do { // https://github.com/tc39/proposal-do-expressions
case(?) { // https://github.com/tc39/proposal-pattern-matching
when {val}: class {
@mb64
mb64 / flat_tree.c
Created Oct 31, 2020
Flat trees in ATS and C
View flat_tree.c
/* A flat representation of
* data Tree = Leaf Int | Node Tree Tree
*
* Either:
* - *ft is LEAF and a single int follows
* - *ft is NODE and two subtrees follow
*/
#define LEAF 0
#define NODE 1
View hattifatteners.awk
#!/usr/bin/awk -f
function hoop(h, w) {
printf("l 0 %d ", -h);
printf("c 0 -%u, %u -%u, %u 0 ", w, w, w, w);
printf("l 0 %d", +h);
}
function hand(x, h, o, l) {
printf("<g transform='translate(%d.5 %d)'>\n", x, h);
@dvanhorn
dvanhorn / syntax-rules-eval.rkt
Last active Oct 25, 2020
A CPS interpreter for a CBV language w/ some fancy features written in syntax-rules
View syntax-rules-eval.rkt
#lang racket
;; A CPS interpreter for a CBV language written in syntax-rules
;; e ::= 'd literal
;; | x variable
;; | (e e ...) application
;; | (λ (x ...) e) abstraction
;; | (let ((x e) ...) e) let
;; | (if e e e) conditional
@pchiusano
pchiusano / splitmix.u
Last active Oct 20, 2020
SplitMix implementation
View splitmix.u
-- porting https://hackage.haskell.org/package/splitmix-0.1.0.1/docs/src/System.Random.SplitMix.html
-- could use a native popcount / hamming weight instruction
roll : Nat -> Nat ->{Random} Nat
roll n sides =
Nat.sum (List.replicate n '(Random.natIn sides + 1))
-- example, rolling 3 x d8
> Random.splitmix 10349 '(roll 3 8)
@Riateche
Riateche / sync_publish.sh
Last active Oct 17, 2020
Wait after publish on crates.io
View sync_publish.sh
#!/bin/bash
# Usage: sync_publish /path/to/crate -f
#
# Publish a crate and wait for it to become available.
set -e
set -o pipefail
TMP_DIR=/tmp/test1
View proofs-are-memes.rkt
#lang cur
(require
cur/stdlib/nat
cur/stdlib/equality
cur/ntac/base
cur/ntac/standard)
(define-syntax hot-take (make-rename-transformer #'define-theorem))
(define-syntax unpopular-opnion (make-rename-transformer #'define-theorem))
@probonopd
probonopd / Wayland.md
Last active Jun 24, 2021
Boycott Wayland. It breaks everything!
View Wayland.md

Think twice before abandoning Xorg. Wayland breaks everything!

tl;dr: Wayland is not ready as a 1:1 compatible Xorg replacement just yet, and maybe never will. Hence, if you are interested in existing applications to "just work" without the need for adjustments, then you may be better of not using Wayland at this point.

Wayland solves no issues I have but breaks almost everything I need. And usually it stays broken, because the Wayland folks only seem to care about Gnome, and alienating everyone else in the process. DO NOT INSTALL WAYLAND! Let Wayland not destroy everything and then have other people fix the damage it caused. Or force more Red Hat/Gnome components (glib, Portals, Pipewire) on everyone!

Please add more examples to the list.

Wayland breaks screen recording applications

View Henk.scala
object Henk:
def removeFirst[A](v: A, t: List[A]): List[A] = t match
case Nil => Nil
case x :: xs => if x == v
then xs
else x :: removeFirst(v, xs)
enum Term:
case Var(v: String)
case Sort
@jackfoxy
jackfoxy / DecisionTables.fsx
Created Sep 18, 2020
A demo of decision tables using F# types and pattern matching
View DecisionTables.fsx
(*
Decision Table Demo
MIT License, do with this what you will
A demo of decision tables using F# types and pattern matching, inspired by https://www.hillelwayne.com/post/decision-table-patterns/
The compiler service flags problematic (incomplete) decision tables.
Requirements: