Skip to content

Instantly share code, notes, and snippets.

@mbostock
mbostock / .block
Last active March 30, 2024 00:26
Wilson’s Algorithm III
license: gpl-3.0
@mbostock
mbostock / .block
Last active April 18, 2024 20:31
Prim’s Algorithm III
license: gpl-3.0
@mbostock
mbostock / .block
Last active March 30, 2024 00:26
Randomized Depth-First III
license: gpl-3.0
@mattmight
mattmight / pythedral.py
Created December 2, 2014 22:48
Church Python
# Void
VOID = lambda void: void
# Booleans / Conditionals
IF = lambda c: lambda t: lambda f: c(t)(f)
@mattmight
mattmight / lambda-reduce.rkt
Created December 4, 2014 15:32
A syntactic-reduction-based interpreter for the lambda-calculus
#lang racket
; A simple CBV syntactic reduction machine for the lamda-calculus.
; + numbers
; <exp> ::= <var>
; | <num>
; | (λ (<var>) <exp>)
; | (+ <exp> <exp>)
@cqfd
cqfd / Parser.hs
Created February 10, 2015 20:49
Parser combinators up to bencoding
module Parser where
import Prelude hiding (or, take)
import qualified Prelude
import Control.Applicative (Applicative(..))
import qualified Control.Applicative as A
import Control.Monad (ap)
import Data.Char
@nasser
nasser / b64.sh
Created June 4, 2015 19:44
Data-URI dump file
#!/bin/sh
echo "data:"`file --mime-type -b $1`";base64,"
cat $1 | openssl base64
@icco
icco / scrape.rb
Last active August 29, 2015 14:22
Scrape all of unsplash.com
#! /usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
require 'net/http'
require 'typhoeus'
urls = []
(1...20).each do |i|
doc = Nokogiri::HTML(open("https://unsplash.com/grid?page=#{i}"))
@spacejam
spacejam / rr-with-rust.md
Last active March 13, 2024 18:51
using rr with rust

using rust with rr

rr is a great debugging tool. it records a trace of a program's execution, as well as the results of any syscalls it executes, so that you can "rewind" while you debug, and get deterministic forward and reverse instrumented playback. it works with rust, but by default if you try it out, it could be pretty ugly when you inspect variables. if this bothers you, configure gdb to use a rust pretty-printer

rr is probably in your system's package manager.

usage

// note : if you're on github gist and want to copy paste this code, you can click on the "Raw" button
// and then do Ctrl A, Ctrl C, Ctrl V
// (code below by Kurt Spencer, slightly modified code to run as Processing tab)
// maybe you should rather use this new (improved) version of the noise instead : https://github.com/KdotJPG/OpenSimplex2
/*
* OpenSimplex Noise in Java.
* by Kurt Spencer
*
* v1.1 (October 5, 2014)