Skip to content

Instantly share code, notes, and snippets.

View nulldatamap's full-sized avatar

Nulldata nulldatamap

View GitHub Profile
@nulldatamap
nulldatamap / flag.rkt
Last active July 3, 2019 17:09
Anarchist Programmer Flag
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
#!/usr/bin/env bash
INSTRUCTIONS="[<>.+]|-"
SETUP="s/^.+/@\\0|@0,|/"
ADD_OR_SUB="s/([^@]*)@([+-])([^|]*)\|(([0-9]+,)*)@([0-9]+),(([0-9]+,)*)\|(.*)/\1\2@\3|\4@\6\2,\7|\9/"
ADD_CELL_0="s/([^|]+)\|(([0-9]+,)*)@([0-9]*)0\+([0-9]*),(([0-9]+,)*)\|(.*)/\1|\2@\41\5,\6|\8/"
ADD_CELL_1="s/([^|]+)\|(([0-9]+,)*)@([0-9]*)1\+([0-9]*),(([0-9]+,)*)\|(.*)/\1|\2@\42\5,\6|\8/"
ADD_CELL_2="s/([^|]+)\|(([0-9]+,)*)@([0-9]*)2\+([0-9]*),(([0-9]+,)*)\|(.*)/\1|\2@\43\5,\6|\8/"
\usepackage{tikz}
\usetikzlibrary{calc}
% ...
\newcommand{\Compiler}[4]{
\draw (#1) -- ++(3, 0) -- ++(0, -1) -- ++(-1, 0)
-- ++(0, -1) -- ++(-1, 0) -- ++(0, 1)
-- ++(-1, 0) -- ++(0, 1);
\node at ($(#1)+(0.5, -0.5)$) {\Large #2};
⎕io←0 ⍝ 0-indexed arrays, of course
⍝ ----------- The model ----------
⍝ States are represented as their index.
⍝ Labels, as a vector where index i contains all satisfied atomics for state i.
⍝ Relations, as a vector where index i contains all transitions from state i.
⍝ A set of states is represented a boolean selection vector over S.
⍝ --------------------------------
S←⍳4 ⍝ We have four states
L←(0 1) (0 2) (⊂1) (⊂2) ⍝ Labelling, 0 is req, 1 is ready and 2 busy
R←(1 3) ( 1 3) (1 2 3) (0 1 2 3 4) ⍝ Relations, transition from each index
+⌿⍎¨⎕csv'1.txt' ⍝ Day 1 part 1
⊃p/⍨(p⍳p)≠⍳≢p←+\2E5⍴⍎¨,⎕csv'1.txt' ⍝ Day 1 part 2
×/+/2 3∘.∊{≢⍵}⌸¨,⎕csv '2.txt' ⍝ Day 2 part 1
⊃p/⍨25=≢¨p←,∘.{⍺/⍨⍺=⍵}⍨,⎕CSV'2.txt' ⍝ Day 2 part 2
  • C-?: Control and ?
  • M-?: Alt and ?

C-x basic commands:

  • C-x s save
  • C-x C-f find file (open)
  • C-x k Kill buffer
  • C-x b Select buffer (switch file)

Editing commands

@nulldatamap
nulldatamap / threading.scm
Last active February 15, 2018 03:29
Threading macros for Scheme
(define-syntax ->
(syntax-rules ()
((_ val)
val)
((_ val (f args ...) rest ...)
(-> (f val args ...)
rest ...))
((_ val f rest ...)
(-> (f val)
rest ...))))
import Data.Vect
import Data.Vect.Views
%default total
data SortedList : Nat -> Type where
SInit : (a : Nat) -> SortedList a
SCons : (a : Nat) -> {auto prf : LTE a b} -> SortedList b -> SortedList a
sortedToList : SortedList a -> List Nat
namespace FSharpTest
open UnityEngine
type WorkerState =
| Idle
| GotoMineral of GameObject
| Mine of float32
type Worker() =
#!/bin/bash
HEAD_LENGTH=5
TAIL_LENGTH=134
declare -A db
db[version]="0.0.6" # Database values
db[navn]="Marco"
db[kage]="sandt"