Skip to content

Instantly share code, notes, and snippets.

View lgastako's full-sized avatar

John lgastako

  • Francon & Heyer
  • Milky Way Galaxy, Third Rock from the Sun
View GitHub Profile
@radarroark
radarroark / datascript+xitdb.md
Last active January 16, 2026 12:49
Datascript + xitdb: your humble, single-file, mini Datomic

xitdb-clj is a new immutable database for Clojure. It can time travel like Datomic, and store data in a single file like SQLite. On its own, though, it has no query language. Enter Datascript...

Datascript is normally an in-memory database, but it lets you use anything as backing storage. What if we combined them?

Datascript's storage feature doesn't tell us exactly what changed, so I added one more trick: Editscript, the diffing library. I use it to figure out how to update the database with the minimal number of changes.

The end result is a sort of mini Datomic that writes to a single file. And yet, this setup can do something Datomic can't: it can branch off of any old copy of the database. The example below reverts to an older copy of the database.

Keep in mind that all reads and writes are incremental. The database is not being loaded into memory at once, so you can use it to

@sciolizer
sciolizer / puzzle.hs
Last active December 5, 2024 20:04
A haskell puzzle about representing functions with various arities.
-- Suppose we have the following expression type for a dynamically typed language
data Value
= VNull
| VInt Int
| VString String
| VNative NativeFunction
data NativeFunction = NativeFunction Int ([Value] -> IO Value)
arity :: NativeFunction -> Int

🤖 Agent Team 🤖

This example shows how to build an Agent having multiple agents as tools. This "Agent Team" works together to answer questions.

A more basic example can be found here

Install

pip install git+https://github.com/neuml/txtai
@getaaron
getaaron / irs-get-human.md
Created April 1, 2024 23:01
Get a person at the IRS
  • Call 1-800-829-1040
  • Press 1 for English (or other language as desired)
  • Press 2 for personal tax
  • Press 1 for form / tax history
  • Press 3 for other
  • Press 2 for other
  • Ignore 2 SSN prompts till you get secret other menu
  • Press 2 for personal tax
  • Press 3 for other
  • Wait for agent!
@anka-213
anka-213 / CheckStrictness.hs
Last active January 6, 2024 10:03
A type class for statically checking if data is fully strict
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleContexts #-}
module CheckStrictness where
import GHC.Generics
@moyix
moyix / CodeGen_GPTJ_Conversion.md
Last active December 27, 2025 06:03
How to convert the SalesForce CodeGen models to GPT-J

Using Linear Algebra to Convert a Large Code Model

Background

The SalesForce CodeGen models are a family of large language models trained on a large amount of natural language data and then fine-tuned on specialized datasets of code. Models of size 350M, 2B, 6B, and 16B parameters are provided in three flavors:

  • nl, the base model trained on The Pile, a large natural language dataset compiled by EleutherAI
  • multi, which is fine-tuned from the nl model on a dataset of code in multiple languages, scraped from GitHub, and
  • mono, which is fine-tuned from the multi model on Python code only.
@lgastako
lgastako / LambdaFizzBuzz.py
Last active July 11, 2023 13:30
Finally figured out how to write fizzbuzz in python
ADD = lambda a: lambda b: \
lambda f: lambda x: b(f)(a(f)(x))
MULT = lambda a: lambda b: \
lambda f: lambda x: a(b(f))(x)
ZERO = lambda f: lambda x: x
ONE = lambda f: lambda x: f(x)
TWO = ADD(ONE)(ONE)
THREE = ADD(ONE)(TWO)
FOUR = ADD(TWO)(TWO)
@Kazark
Kazark / CurryHoward.lhs
Last active June 6, 2024 23:47
Curry-Howard Tutorial in Literate Haskell
This is a tutorial on the Curry-Howard correspondence, or the correspondence
between logic and type theory, written by Keith Pinson, who is still a learner
on this subject. If you find an error, please let me know.
This is a Bird-style literate Haskell file. Everything is a comment by default.
Lines of actual code start with `>`. I recommend that you view it in an editor
that understands such things (e.g. Emacs with `haskell-mode`). References will
also be made to Scala, for programmers less familiar with Haskell.
We will need to turn on some language extensions. This is not an essay on good
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Fizz where
import Protolude
fizzBuzz :: IO ()
fizzBuzz = run fizzBuzzRules

Monads and delimited control are very closely related, so it isn’t too hard to understand them in terms of one another. From a monadic point of view, the big idea is that if you have the computation m >>= f, then f is m’s continuation. It’s the function that is called with m’s result to continue execution after m returns.

If you have a long chain of binds, the continuation is just the composition of all of them. So, for example, if you have

m >>= f >>= g >>= h

then the continuation of m is f >=> g >=> h. Likewise, the continuation of m >>= f is g >=> h.