Skip to content

Instantly share code, notes, and snippets.

View brandon-lockaby's full-sized avatar

Brandon Lockaby brandon-lockaby

View GitHub Profile
@brandon-lockaby
brandon-lockaby / openclipboard.sh
Last active October 19, 2021 07:11
screenshot/clipboard hotkey scripts
#!/bin/bash
now=$(date +"%Y %m-%d %T ns%N")
xclip -selection clipboard -t TARGETS -o | (while IFS= read -r line; do
echo $line
if [[ $line = image/* ]]
then
notify-send "Opening ${line} with feh" -a "(•ิ_•ิ)?" -t 2000
xclip -selection clipboard -t image/png -o | feh -
break
fi
@brandon-lockaby
brandon-lockaby / test-sound.py
Created October 28, 2021 11:21
aud in blender
import aud
device = aud.Device()
sound = aud.Sound.sawtooth(400)
sound2 = aud.Sound.buffer(np.array([1,2,3], dtype="float32"), 44100)
handle = device.play(sound);
handle.stop();
@brandon-lockaby
brandon-lockaby / fragment.glsl
Last active April 12, 2025 05:55
threejs shaderlib physical
//FRAGMENT
#define STANDARD
#ifdef PHYSICAL
#define IOR
#define SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
@brandon-lockaby
brandon-lockaby / sizes of datablocks.py
Created December 9, 2022 05:49
Trying to infer datablock sizes from pointers
import bpy
from itertools import chain
import math
def convert_size(size_bytes):
if size_bytes == 0:
return "0B"
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
i = int(math.floor(math.log(size_bytes, 1024)))
p = math.pow(1024, i)
@brandon-lockaby
brandon-lockaby / rec.sh
Created January 5, 2023 11:03
make a record of loud noise
#!/bin/bash
# Set the threshold, duration (in seconds), and recording directory
threshold=0.2
duration=10
recording_dir="/mnt/tera/audio/NOISE2"
# Set output options
output_to_console=true
output_to_log=true
@brandon-lockaby
brandon-lockaby / gist:6bd43f1488de62e4e3d90680f126c3b9
Created April 26, 2023 07:00
the openai streaming chat completions responses
{"id":"chatcmpl-79TNYGf2QniAFeerg2taVUVkouz3H","object":"chat.completion.chunk","created":1682492240,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"role":"assistant"},"index":0,"finish_reason":null}]}
{"id":"chatcmpl-79TNYGf2QniAFeerg2taVUVkouz3H","object":"chat.completion.chunk","created":1682492240,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"As"},"index":0,"finish_reason":null}]}
{"id":"chatcmpl-79TNYGf2QniAFeerg2taVUVkouz3H","object":"chat.completion.chunk","created":1682492240,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":" an"},"index":0,"finish_reason":null}]}
{"id":"chatcmpl-79TNYGf2QniAFeerg2taVUVkouz3H","object":"chat.completion.chunk","created":1682492240,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":" AI"},"index":0,"finish_reason":null}]}
{"id":"chatcmpl-79TNYGf2QniAFeerg2taVUVkouz3H","object":"chat.completion.chunk","created":1682492240,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":" language"},"index":0,"finish_reason":null}]}
{"id":
from exllama.model import ExLlama, ExLlamaCache, ExLlamaConfig
from exllama.lora import ExLlamaLora
from exllama.tokenizer import ExLlamaTokenizer
from exllama.generator import ExLlamaGenerator
from exllama import model_init
import argparse
import torch
import sys
import os
#import glob
@brandon-lockaby
brandon-lockaby / test-phi3.py
Last active May 7, 2024 22:33
MultiClassifier
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
DEV = "cuda"
# I want a base model and this is instruct-tuned, but it will fit on my gpu
model_path = "microsoft/Phi-3-mini-128k-instruct"
model = AutoModelForCausalLM.from_pretrained(
model_path,
@brandon-lockaby
brandon-lockaby / logit-chart.ipynb
Created June 10, 2024 02:56
logit chart notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.