Skip to content

Instantly share code, notes, and snippets.

@krtx
krtx / imgcat
Created November 27, 2016 02:48
fix imgcat to be able to display images on tmux https://gitlab.com/gnachman/iterm2/issues/3898#note_14097715
#!/bin/bash
# tmux requires unrecognized OSC sequences to be wrapped with DCS tmux;
# <sequence> ST, and for all ESCs in <sequence> to be replaced with ESC ESC. It
# only accepts ESC backslash for ST.
function print_osc() {
if [[ -n $TERM ]] ; then
printf "\033Ptmux;\033\033]"
else
printf "\033]"
module EvalContML1 where
open import Data.Nat as N using (ℕ)
open import Data.Bool as B using (Bool; false; true)
open import Relation.Binary.PropositionalEquality
data Value : Set where
int : Value
bool : Bool Value
module Demo where
open import Relation.Binary.PropositionalEquality
data : Set where
zero :
suc :
infixl 5 _+_
infixl 6 _*_
@krtx
krtx / ping.go
Last active September 17, 2020 15:58
practice
package main
import (
"errors"
"fmt"
"math/rand"
"net"
"os"
"os/signal"
"strconv"
module Z3 = ZZ3.Make (struct let ctx = Z3.mk_context [] end)
open Z3
let solve board =
let cells =
Array.init 9 (fun i ->
Array.init 9 (fun j ->
Symbol.declare Int (Printf.sprintf "%d%d" i j)))
@krtx
krtx / 5f.agda
Last active October 26, 2015 08:28
module 5f where
postulate
A : Set
B : Set
postulate
a′ : A
b′ : B
module implicationallogic where
module Example where
postulate
Person : Set
john : Person
mary : Person
IsStudent : Person Set
@krtx
krtx / classic.agda
Last active August 29, 2015 14:10
classical logic
module classic where
open import Level
open import Relation.Nullary
open import Data.Empty
open import Data.Sum
open import Data.Product
-- peirce : ∀ {a b} (P : Set a) (Q : Set b) → Set (a ⊔ b)
@krtx
krtx / Ackerman.agda
Created November 3, 2014 02:45
SICP Exercise 1.10.
module Ackerman where
open import Data.Empty
open import Data.Nat
open import Relation.Binary.PropositionalEquality
open ≡-Reasoning
A :
A _ 0 = 0
@krtx
krtx / test-ex1.3.scm
Created October 20, 2014 01:28
test for ex 1.3
(use gauche.test)
(test-start "test")
;; insert here
(define target PROGRAM-NAME)
(define (right a b c)
(let ((l (sort (list a b c) >)))
(let ((x (list-ref l 0))