Skip to content

Instantly share code, notes, and snippets.

View diamondburned's full-sized avatar

Diamond diamondburned

View GitHub Profile
@diamondburned
diamondburned / error.out
Created December 3, 2023 01:49
libacmchristmas==0.1.4 error
Traceback (most recent call last):
File "/home/diamond/Scripts/acmcsufdev/christmas-py-example/.venv/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 963, in transfer_data
message = await self.read_message()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/diamond/Scripts/acmcsufdev/christmas-py-example/.venv/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 1033, in read_message
frame = await self.read_data_frame(max_size=self.max_size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/diamond/Scripts/acmcsufdev/christmas-py-example/.venv/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 1108, in read_data_frame
frame = await self.read_frame(max_size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@diamondburned
diamondburned / shell.nix
Created September 12, 2023 01:11
Git Nix shell
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = with pkgs; [ git ];
}

Lazer

Lazer is a Python library that provides a convenient way to expose Python functions as schemas for OpenAI chat models.

Installation

To install Lazer, simply run:

pip install lazer
@diamondburned
diamondburned / schema.docs.graphql
Created May 18, 2023 09:01
GitHub GraphQL schema snapshot at 2023-05-18T02:01:18-07:00
This file has been truncated, but you can view the full file.
directive @requiredCapabilities(
requiredCapabilities: [String!]
) on ARGUMENT_DEFINITION | ENUM | ENUM_VALUE | FIELD_DEFINITION | INPUT_FIELD_DEFINITION | INPUT_OBJECT | INTERFACE | OBJECT | SCALAR | UNION
"""
Marks an element of a GraphQL schema as only available via a preview header
"""
directive @preview(
"""
The identifier of the API preview that toggles this field.
#!/usr/bin/env python3
import itertools
def dfa2sat(E: list[tuple[int, int, str]], q: int, F: list[int]):
"""
Convert DFA to SAT.
Arguments:
- E: list of edges (source, target, label)
@diamondburned
diamondburned / caddyfile.nix
Last active April 5, 2023 07:36
Caddyfile for GitHub redirection with Go modules support
{ config, lib, pkgs, ... }:
let
user = "diamondburned";
go-get-html = pkgs.writeTextFile {
name = "libdb.so-go-get";
text = ''
<!DOCTYPE html>
{{ $path := .OriginalReq.URL.Path }}
{{ $name := $path | splitList "/" | rest | first }}
@diamondburned
diamondburned / ordmap.go
Created December 1, 2022 09:04
Ordered map for JSON unmarshaling
package ordmap
import (
"bytes"
"encoding/json"
"fmt"
"log"
"strings"
)
@diamondburned
diamondburned / Makefile
Last active October 19, 2022 21:30
atod implementation in x86 nasm compiled from C
atod.asm: _atod.c
gcc -Wall -Os -s -c ./_atod.c
objconv -fnasm _atod.o
# Sanitize the output.
dos2unix _atod.asm
sed -i \
-e 's/;.*$$//' \
-e 's/\.\(LC[0-9]*\)/\1/g' \
-e 's/^default rel//g' \
-e 's/^SECTION \(\.\w*\).*$$/section \1/g' \
{ pkgs }:
let gtkcord4 = {
src = pkgs.fetchFromGitHub {
owner = "diamondburned";
repo = "gtkcord4";
rev = "0ac19003b75865378b8a36781cb9106741bc603f";
hash = "sha256:13wvbqqskrrczk3q2az18wmj6a7k79alrsnz0v7cijvm1bi1lrvk";
};
bin = pkgs.fetchzip {
@diamondburned
diamondburned / main.go
Created December 5, 2021 09:52
Script to parse CGOWRAP_PROFILE
package main
import (
"encoding/csv"
"errors"
"io"
"log"
"os"
"strconv"
)