Skip to content

Instantly share code, notes, and snippets.

View serialhex's full-sized avatar
😸
Pondering language design...

serialhex

😸
Pondering language design...
View GitHub Profile
@chaitanyagupta
chaitanyagupta / _reader-macros.md
Last active March 29, 2024 19:56
Reader Macros in Common Lisp

Reader Macros in Common Lisp

This post also appears on lisper.in.

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.

@brunobord
brunobord / roll-for-shoes.md
Last active December 3, 2023 07:01
Roll for shoes

taken from

The system

The minisystem goes like this:

  • Say what you do and roll a number of d6s.
  • If the sum of your roll is higher than the opposing roll (either another player or the DM), the thing you wanted to happen, happens.
  • The number of the d6s you roll is determined by the level of skill you have.
@coolaj86
coolaj86 / ubuntu-install-media.sh
Last active December 11, 2015 22:39
An installer for all the things that aren't included in Ubuntu for legal reasons, but are necessary for normal computer use - Adobe Reader, MP3, DVD, Blu-Ray, fonts, etc.
#!/bin/bash
# Usage: sudo apt-get install -yqq curl; curl -L -s https://raw.github.com/gist/4671312/ubuntu-install-media.sh | sudo bash
#alias sagi="apt-get install --yes --quiet" # normall sudo apt-get, but this is already root
#alias sagid="apt-get install --yes --quiet --download-only" # same as above
#STDOUT=/dev/stdout
#STDERR=/dev/stderr
STDOUT=/dev/null
STDERR=/dev/null
@arvearve
arvearve / gist:4158578
Created November 28, 2012 02:01
Mathematics: What do grad students in math do all day?

Mathematics: What do grad students in math do all day?

by Yasha Berchenko-Kogan

A lot of math grad school is reading books and papers and trying to understand what's going on. The difficulty is that reading math is not like reading a mystery thriller, and it's not even like reading a history book or a New York Times article.

The main issue is that, by the time you get to the frontiers of math, the words to describe the concepts don't really exist yet. Communicating these ideas is a bit like trying to explain a vacuum cleaner to someone who has never seen one, except you're only allowed to use words that are four letters long or shorter.

What can you say?

@swannodette
swannodette / gist:3217582
Created July 31, 2012 14:52
sudoku_compact.clj
;; based on core.logic 0.8-alpha2 or core.logic master branch
(ns sudoku
(:refer-clojure :exclude [==])
(:use clojure.core.logic))
(defn get-square [rows x y]
(for [x (range x (+ x 3))
y (range y (+ y 3))]
(get-in rows [x y])))
@jboner
jboner / latency.txt
Last active April 25, 2024 11:20
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@rampion
rampion / RedBlackTree.hs
Created May 11, 2012 13:55
red-black trees in haskell, using GADTs and Zippers
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE StandaloneDeriving #-}
module RedBlackTree where
data Zero
data Succ n
type One = Succ Zero
data Black

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@wridgers
wridgers / .tmux.conf
Created February 7, 2012 16:05
tmux config file
# Make it use C-a, similar to screen..
unbind C-b
unbind l
set -g prefix C-a
bind-key C-a last-window
# Reload key
bind r source-file ~/.tmux.conf
set -g history-limit 1000
@rawbitrec
rawbitrec / HelloWorld.cpp
Last active September 27, 2015 06:48
Ye Olde Sea Pluss Pluss!
//created by Eliot Lash and Robert Muller on 10/3/10
//copyright Eliot Lash and Robert Muller 2011
//Welcome to Ye Olde Sea Pluss Pluss!
#include <iostream>
#include <string>
#include "olde.h"
#define normal