Skip to content

Instantly share code, notes, and snippets.

View maxsei's full-sized avatar

Maximillian Schulte maxsei

View GitHub Profile
@maxsei
maxsei / db_test_harness.go
Last active January 26, 2024 18:31
This is a way that I can ensure that I have a test database in postgres with ephemeral state
package core
import (
"database/sql"
"errors"
"fmt"
"net"
"net/url"
"strings"
@maxsei
maxsei / main.md
Created January 24, 2024 22:35
Show behavior of deadlocking in go tests vs in main!

Given the following test in go

package main

import (
	"testing"
)

func TestMyTest(t *testing.T) {
@maxsei
maxsei / circular_queue.go
Last active January 24, 2024 23:00
"circular queue"
package core
import "sync"
func NewCircularQueue[T any](capacity int) *CircularQueue[T] {
m := &sync.Mutex{}
return &CircularQueue[T]{
data: make([]T, capacity),
Mutex: m,
cond: sync.NewCond(m),

Download mistral

$ ollama pull mistral
pulling manifest
pulling e8a35b5937a5... 100% ▕███████████████████████████████████████████████████████████████████████▏ 4.1 GB
pulling 43070e2d4e53... 100% ▕███████████████████████████████████████████████████████████████████████▏  11 KB
pulling e6836092461f... 100% ▕███████████████████████████████████████████████████████████████████████▏   42 B
pulling ed11eda7790d... 100% ▕███████████████████████████████████████████████████████████████████████▏   30 B
pulling f9b1e3196ecf... 100% ▕███████████████████████████████████████████████████████████████████████▏  483 B
verifying sha256 digest
@maxsei
maxsei / q.go
Last active January 8, 2024 16:28
Query mapper dsl prototype
package q
import (
"sql"
"github.com/google/uuid"
)
func MI(table, col string, ptr any) *MappedIdentifier {
return &MappedIdentifier{table, col, ptr}
@maxsei
maxsei / main.go
Created January 4, 2024 16:49
How can I improve this query pattern?
package main
import (
"context"
"database/sql"
_ "embed"
"fmt"
"time"
_ "github.com/mattn/go-sqlite3"
@maxsei
maxsei / main.go
Created December 5, 2023 17:47
Starter go http server that finds find a default ip address to bind to and logs it to stdout before starting the server
package main
import (
"fmt"
"log"
"net"
"net/http"
"net/url"
)
@maxsei
maxsei / main.rkt
Last active December 5, 2023 03:45
experiment to write example webapp with racket
#lang racket
(require scribble/html)
(require web-server/http)
(require web-server/servlet-env)
(require net/url)
(define (html-page-template inner-html)
(html
(head
@maxsei
maxsei / main.zig
Created December 4, 2023 15:41
throwaway aoc day one part 2 using zig because I suck at racket
const std = @import("std");
const io = std.io;
fn getmatch(x: []u8) usize {
if (std.mem.startsWith(u8, x, "1")) {
return 1;
} else if (std.mem.startsWith(u8, x, "2")) {
return 2;
} else if (std.mem.startsWith(u8, x, "3")) {
return 3;
@maxsei
maxsei / index.html
Created December 1, 2023 19:33
testing @thi.ng/associative
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body>
<script type="module">
import {mergeDeepObj} from 'https://cdn.skypack.dev/@thi.ng/associative';