Skip to content

Instantly share code, notes, and snippets.

View brandon-lockaby's full-sized avatar

Brandon Lockaby brandon-lockaby

View GitHub Profile
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 / 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":
@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 / 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 / fragment.glsl
Last active September 19, 2022 07:15
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 / 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 / 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 / gist:aee809fdd547a4521b2eefae6770744d
Last active September 30, 2021 09:31
use curl to ping (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET or TFTP)
watch -n 0.5 curl --head --silent --write-out %{time_connect} google.com
watch -n 0.5 curl --head --silent --write-out %{time_connect} --output /dev/null google.com
@brandon-lockaby
brandon-lockaby / Color.js
Last active March 1, 2022 21:55
Color.js
if(typeof module !== "undefined") {
module.exports = Color;
} else {
this.Color = Color;
}
function Color() {
var r,g,b;
if(arguments.length === 1) {
var hexa = arguments[0].toLowerCase();
@brandon-lockaby
brandon-lockaby / EventEmitter.js
Created November 18, 2013 21:27
Let's make a new EventEmitter
var EventEmitter = function() {
this._events = {};
};
EventEmitter.prototype.on = function(evtn, fn) {
if(!this._events.hasOwnProperty(evtn)) this._events[evtn] = [];
this._events[evtn].push(fn);
};
EventEmitter.prototype.off = function(evtn, fn) {
if(!this._events.hasOwnProperty(evtn)) return;
var idx = this._events[evtn].indexOf(fn);