Skip to content

Instantly share code, notes, and snippets.

View breadchris's full-sized avatar

Chris breadchris

View GitHub Profile
@breadchris
breadchris / main.go
Created August 17, 2024 20:32
HTML as a go library
package main
import (
"fmt"
"io"
"net/http"
)
type Node struct {
Name string
package graph
import (
"fmt"
"github.com/evanw/esbuild/pkg/api"
"testing"
)
func TestBuild(t *testing.T) {
result := api.Build(api.BuildOptions{
@breadchris
breadchris / main.go
Last active April 15, 2024 04:09
Postgres (OLTP) vs. Clickhouse (OLAP)
package main
import (
"database/sql"
"log"
"os"
"strconv"
"time"
_ "github.com/ClickHouse/clickhouse-go/v2"
@breadchris
breadchris / metaprompt.py
Created March 24, 2024 04:49
anthropic metaprompt
# @title Metaprompt Text
metaprompt = '''Today you will be writing instructions to an eager, helpful, but inexperienced and unworldly AI assistant who needs careful instruction and examples to understand how best to behave. I will explain a task to you. You will write instructions that will direct the assistant on how best to accomplish the task consistently, accurately, and correctly. Here are some examples of tasks and instructions.
<Task Instruction Example>
<Task>
Act as a polite customer success agent for Acme Dynamics. Use FAQ to answer questions.
</Task>
<Inputs>
{$FAQ}
{$QUESTION}
@breadchris
breadchris / hacker_playlist.md
Last active March 10, 2024 05:29
A collection of hackers and the music they listen to.

MCPS HSF - 8th annual high school cyber security competition. Want to help out?

Here are some bios of people who are hacking the planet. They used to be high schoolers, too, and understand how much work it is to get to where you want to be. Check out the dope stuff they listen to and are doing:

breadchris - ur so hacked If you want to know my origin story, you can read about it here. I like to hack things. Come watch my cracked stream. I am working on building an open-source app to let you build your own blog and customize it. You can build how your site looks with AI!
@breadchris
breadchris / Main.elm
Created January 26, 2024 03:22
TODO App Elm
module Main exposing (..)
import Browser
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
type alias Todo =
{ id : Int
, text : String
Every year I like to have a motto that I think about from time to time throughout the year. I find mottos more transformative than resolutions as mottos tend to influence subtly but in a profound way.
Anyways, my motto for this year is:
write every day.
Over this past year I started writing more blog posts and taking more notes and it feels incredibly rewarding. I like seeing the thoughts I have in my head in a medium where I can share with people for them to glance at or read deeply. I no longer feel the need to corner people into listening to my monologues.
Writing is incredibly liberating for my mind where ideas fly in and out constantly. I used to feel such anxiety trying to determine a purpose for writing and not wanting to publish something that isn't going to be, what I thought to be, quality writing. I was too focused on writing a post that could go viral on HackerNews that I was missing out on practice of channeling my thoughts into words.
What I have found is that having a bunch of thoughts laying a
@breadchris
breadchris / matrix.html
Created October 6, 2023 01:25
Matrix for your OBS stream
<html>
<style>
* {margin: 0; padding: 0}
canvas {display: block;}
</style>
<canvas id="canvas" width="150" height="150">The current time</canvas>
<script>
// Initialising the canvas
var canvas = document.querySelector('canvas'),
ctx = canvas.getContext('2d');
@breadchris
breadchris / split.go
Created September 15, 2023 21:15
Go Split WAV File
package main
import (
"fmt"
"github.com/go-audio/wav"
"github.com/lunabrain-ai/lunabrain/pkg/store/bucket"
"github.com/pkg/errors"
"math"
"os"
"path"
@breadchris
breadchris / hybrid.py
Last active October 21, 2024 17:55
BM25 and FAISS hybrid search example
import numpy as np
from rank_bm25 import BM25Okapi
from sentence_transformers import SentenceTransformer
import faiss
class HybridSearch:
def __init__(self, documents):
self.documents = documents
# BM25 initialization