Skip to content

Instantly share code, notes, and snippets.

View krismuniz's full-sized avatar
🇵🇷
¡Wepa!

Kristian Muñiz krismuniz

🇵🇷
¡Wepa!
View GitHub Profile
@krismuniz
krismuniz / constrained-decoding.md
Last active March 29, 2024 18:38
A domain-specific language designed for creating dynamic content through structured decision trees, produces the fully tokenized format optimized for machine processing. In other words, I'm playing around with constrained generation for MLX

A Domain-Specific Language for Constrained Generation?

  • I want to write a domain-specific language for producing LLM constraints, to use specifically for code generation.
  • My main motivation at the moment is to write a framework for constrained generation that operates at the semantic level.
  • I am curious to see how much of a deep integration we can write between a programming language's type system.

Mechanics

This is an example program for constraining the LLM output to be one of the following alternatives:

@krismuniz
krismuniz / on-enter.md
Created December 4, 2022 02:16
Interesting Conversations with GPT

I Ask

var body: some View {
    VStack(alignment: .leading, spacing: 12) {
        Text("MacDiffusion")
            .font(.title)
            .multilineTextAlignment(.center)
        if (image != nil) {
 image
@krismuniz
krismuniz / machine.js
Created January 9, 2021 03:44
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@krismuniz
krismuniz / iconset.sh
Created December 10, 2020 03:20
Generate an iconset and .icns for a given image
# $1 = the path to your png image
imageDir=$(dirname $1);
filename=$(basename $1);
name="${filename%.*}";
# create iconset directory
iconsetDir="${imageDir}/${name}.iconset";
mkdir $iconsetDir;
# generate resized images
@krismuniz
krismuniz / quickserve.ts
Last active March 17, 2020 04:42
Minimal Deno server.
import { serve, ServerRequest, Server } from "https://deno.land/std@v0.36.0/http/server.ts";
type Handler = (req: ServerRequest) => void
export default async function (port: number, handler: Handler) {
const s: Server = serve({ port });
for await (const req of s) {
handler(req)
}
@krismuniz
krismuniz / 0.md
Last active September 1, 2021 23:10
How to add back-access syntax to JS Arrays and strings

This allows you to use back-access syntax to access items in an array or characters in a string.

In practical terms, it adds the negative integer in arr[-1] to the length of the array/string and tries to search for that property inside the object.

Examples

const arr = backAccess(['first', 'second', 'last'])
arr[-1] // => "last"
arr[-2] // => "second"
@krismuniz
krismuniz / COBOL Classwork.md
Last active July 26, 2017 22:21
Various COBOL programs for SICI4144 – Fall 2016

Various COBOL programs for SICI4144 – Fall 2016

These are a couple excersise programs for my programming languages class. In this example we learned the basics of the language, its roots, and explored the structured programming paradigm.

Programs

  • calc2000 A simple future-value calculator (prog-calc.cbl)
  • calcGPA GPA calculator (prog-calcGPA.cbl)
  • stu1000 Creates a student list report taking file as input (prog-stu1000.cbl)
@krismuniz
krismuniz / Bank.java
Last active February 2, 2018 15:14
Example: simple Java classes for a class I took
public class Bank {
public static void main (String[] args) {
BankAccount myAccount = new BankAccount(0, "Kristian");
myAccount.deposit(10.20);
myAccount.withdraw(5.10);
System.out.println("Status: " + (myAccount.getIsActive() ? "Active" : "Inactve"));
System.out.println("Owner: " + myAccount.getOwner());
System.out.println("Balance: " + myAccount.getBalance());
}