Skip to content

Instantly share code, notes, and snippets.

View fogus's full-sized avatar
💭
attempting to learn how to better learn

Fogus fogus

💭
attempting to learn how to better learn
View GitHub Profile
@fogus
fogus / simpl_2015_32bit_list8.ino
Created September 14, 2021 19:30 — forked from anonymous/simpl_2015_32bit_list8.ino
32bit version of SIMPL "Serial Interpreted Minimal Programming Language"
// SIMPL
// A Serial Interpreted Minimal Programming Language
// Inspired by Txtzyme - by Ward Cunningham
// Ken Boak 2013 - 2016
// Filename simpl_2015_32bit_list8
// Requires UART routines - compiles on Arduino 1.04
// This is the slim version of simpl that removes all of the Arduino specific routines
@fogus
fogus / tforth.asm
Created September 14, 2021 19:30 — forked from anonymous/tforth.asm
TinyForth for AVR by T. NAKAGAWA
; Tiny FORTH
; T. NAKAGAWA
; 2004/08/02-05
; Additional comments by Ken Boak Jan 2016
; Register
; r0: temporary
; r1-15: input buffer (terminated by 0x00, separated by 0x20)
; r16: temporary
@fogus
fogus / VTL.ino
Created September 14, 2021 19:29 — forked from monsonite/VTL.ino
VTL - A Very Tiny Language for Arduino
// Very Tiny Language T. Nakagawa 2004/05/23 2004/06/26
#include <uart.h>
#include <avr/io.h>
#define F_CPU 16000000UL // define the clock frequency as 16MHz
#define BAUD 115200*2
#include <util/setbaud.h> // Set up the Uart baud rate generator
(defn update-keys-naive
"m f => {(f k) v ...}
Given a map m and a function f of 1-argument, returns a new map whose
keys are the result of applying f to the keys of m, mapped to the
corresponding values of m.
f must return a unique key for each key of m."
{:added "1.11"}
[m f]
(let [ret (with-meta
@fogus
fogus / ded.clj
Created July 27, 2021 15:59 — forked from alandipert/ded.clj
Command-line structural data editing
(ns ded
"Structural Data EDitor for Clojure with zippers. Inspired by Interlisp: http://larry.masinter.net/interlisp-ieee.pdf"
(:require [clojure.zip :as z])
(:use [clojure.pprint :only (with-pprint-dispatch code-dispatch pprint)]
[clojure.repl :only (source-fn)]))
(defn print-hr
"Prints 30 dashes and a newline."
[c]
(println (apply str (repeat 30 c))))
<canvas id="c" width="1024" height="1024">
<script>
// https://js.do
const context = c.getContext('2d');
for (let x = 0; x < 256; x++) {
for (let y = 0; y < 256; y++) {
if ((x ^ y) % 9) {
context.fillRect(x*4, y*4, 4, 4);
}
}
@fogus
fogus / cont.clj
Created February 8, 2021 20:55 — forked from hiredman/cont.clj
(ns com.manigfeald.http2.cont)
(defn bind% [m f]
(fn [kont bundle]
(m (fn [value] ((f value) kont bundle)) bundle)))
(defmacro return% [value]
`(fn [kont# bundle#]
((try
(let [v# ~value]
(comment
;; original emit on RHS of map destructure form
(if (seq? kvs)
(clojure.lang.PersistentHashMap/create (seq kvs))
kvs)
)
(defn create-bl [& kvs]
;; replacement code for RHS of map destructure form
@fogus
fogus / endmap.clj
Last active January 26, 2021 18:29
(defn add [& {:keys [:a :b]}]
(+ a b))
(add :a 1 :b 2)
;;=> 3
(add :a)
;;= No value supplied for key: :a
(add {:a 1 :b 2})