Skip to content

Instantly share code, notes, and snippets.

View bobbicodes's full-sized avatar
💭
Moved to bobbicodes on Codeberg

Bobbi Towers bobbicodes

💭
Moved to bobbicodes on Codeberg
View GitHub Profile
@bobbicodes
bobbicodes / asm6502.pegjs
Created September 29, 2024 06:43
Parsing expression grammar for 6502 assembly
start = line*
line = (_* @(instruction / label / directive
/ expression / comment)+ comment? '\n'?) / _* '\n'
instruction = opcode (_ @argument)?
directive = d:('.' name) _? a:argumentlist? {
return {directive: d.join(''), args: a}
}
expression = l:(name / number) _? o:operator _?
r:(name / number) {
return {operator: o, left: l, right: r}
@bobbicodes
bobbicodes / primer.md
Created September 11, 2024 15:59
Lisp-MML Language Guide
  • Gentle intro to Lisp-MML syntax

  • Lisp lists

  • Lisp is characterized by its use of parenthesized lists and prefix notation:
  • (+ 1 2 3 4)
  • Prefix notation means the first element of the list is the operator, which is the + function in the expression above.
  • The Lisp dialect used by Lisp-MML is based on the Clojure language, which supplements these lists with other built-in data structure literals, namely vectors (array-like, sequential collections) surrounded with square brackets ([]), and maps (key/value pairs) surrounded with curly braces ({}).
  • I should have started this earlier, I'm already on season 5.
  • Okay, going back to the beginning! So... this is gonna be slightly weird because I've just seen them all, so seasons 1-4 won't be genuine reactions, but more like "oh yeah, I liked this one", or whatever.
  • Concept (1958)

    • I haven't seen this yet! It's called the Time Element, which aired on Desilu.
    • This was amazing! Almost better than the actual show! Long show, too, 51 minutes.
  • Season 1

    • Where is everybody? - This has the original pitch on it, which I skipped last time! And I'm watching it realizing that I don't remember it that much! Probably because I don't pay very close attention... can't, in fact. Which causes me to believe I catch more than I really do. It's always fun when an episode only has one character for most or all of the show. logseq.order-list-type:: number

Damn, I just found this amazing channel by a teacher who uses TZ in the classroom: {{video(https://www.youtube.com/watch?v=iyGg_6TVxVE)}}

@bobbicodes
bobbicodes / nsfDriver.js
Last active March 2, 2024 17:57
NSF Driver - Assembles an NES ROM from music data
const nsfFormat = [0x4e, 0x45, 0x53, 0x4d, 0x1a]
const version = 1
let totalSongs = 1
let startingSong = 1
const loadAdr = [0x00, 0x80]
const initAdr = [0x00, 0x80]
const playAdr = [0x09, 0x80]
function pad32(string) {
let name = []
@bobbicodes
bobbicodes / notes.md
Last active June 26, 2023 05:07
Inline evaluation design notes
  • Trying to implement eval-top-level-form is harder than I thought.
    • It seems so simple... just find the form the cursor is in and evaluate it.
    • I can think of 2 ways:
      • use the clojure reader to pop each form off that doesn't have the cursor in it.
        • Where this gets tricky is keeping track of where the cursor is when we are chopping off code, we could count the forms as they are removed and reposition the cursor, but then we have to deal with whitespace and seems like a mess
      • begin at the cursor and expand outward in both directions until we have the entire form
    • I like the second one, it avoids needing to use the reader, feels like it could be done more functionally, and also matches the problem more intuitively I think. Meaning, we look at the cursor and expand outwards.
    • Hold on... I think that doesn't even make sense! The only way we really know that the form is top level is that its enclosing form is the document itself. So we really have to look at the whole thing.
    • So I have this:
@bobbicodes
bobbicodes / lecture-1.md
Last active May 28, 2023 22:36
Micrograd lecture

Intro

hello my name is andre and i've been training deep neural networks for a bit more than a decade and in this lecture i'd like to show you what neural network training looks like under the hood so in particular we are going to start with a blank jupiter notebook and by the end of this lecture we will define and train in neural net and you'll get to see everything that goes on under the hood and exactly sort of how that works on an intuitive level

micrograd overview

now specifically what i would like to do is i would like to take you through building of micrograd now micrograd is this library that i released on github about two years ago but at the time i only uploaded the source code and you'd have to go in by yourself and really figure out how it works so in this lecture i will take you through it step by step and kind of comment on all the pieces of it

@bobbicodes
bobbicodes / exercism-clojure-2.md
Last active April 29, 2023 20:42
Clojurists Together project update #2

Inline evaluation via SCI

I'm very excited about this feature because it transforms the online editor into a proper interactive Clojure environment. When the track was first launched in 2021 we received some valuable feedback from fellow Clojurists, who said that the online editor was quite lacking to someone familiar with using an editor connected REPL. I too consider this an inseparable part of the Clojure development experience, so this is something I've wanted to do for a long time.

Once I prototyped the desired behavior using Nextjournal's clojure-mode, the next task was to figure out how to best integrate it into the existing Ruby on Rails/React application while making as minimal impact on the codebase as possible. The first thing I tried was to use scittle to load SCI via the `

@bobbicodes
bobbicodes / codemirror.cljs
Last active April 16, 2023 11:40
Inline eval with Codemirror 6 and scittle
(require '[clojure.string :as str])
(declare cm)
(defn eval-string [s]
(when-some [code (not-empty (str/trim s))]
(try {:result (js/scittle.core.eval_string code)}
(catch js/Error e
{:error (str (.-message e))}))))
@bobbicodes
bobbicodes / graph.clj
Last active April 3, 2023 05:13
Clojure syllabus concept graph
(ns server.core
(:require [ring.adapter.jetty :as jetty]
[ring.middleware.resource :refer [wrap-resource]]
[com.phronemophobic.clj-graphviz :refer [render-graph]]
[hiccup.page :refer [html5]]
[clojure.data.json :as json]
[clojure.pprint :as pp]))
(def exercises (:concept (:exercises (json/read-str (slurp "https://raw.githubusercontent.com/exercism/clojure/main/config.json") :key-fn keyword))))
@bobbicodes
bobbicodes / core.clj
Last active March 27, 2023 09:26
bobbi.codes server
(ns ring-app.core
(:require [clojure.java.shell :as sh]
[ring.adapter.jetty :as jetty]
[ring.util.response :as response]
[ring.middleware.resource :as resource]
[clojure.pprint :as pprint]))
(defonce server (atom nil))
(defn cents