Skip to content

Instantly share code, notes, and snippets.

@nicksherron
nicksherron / sync-libsql-cgo-files.sh
Last active June 28, 2025 00:14
Work around for using github.com/tursodatabase/go-libsql in go vendor mode. Otherwise the c files in lib/ get nuked.
#!/bin/bash
set -euo pipefail
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo -e "${GREEN}=== Syncing go-libsql C/CGO files to vendor directory ===${NC}"
-- Desc: This script will return all keys that do not have a TTL set.
-- Usage: redis-cli --eval nottlkeys.lua
local nonttl = {}
local cursor = "0"
local done = false
while not done do
repeat
local result = redis.call("SCAN", cursor, "MATCH", "*", "COUNT", 1000)
SELECT
l.* EXCEPT(total_compressed_bytes, data_compressed_bytes),
formatReadableSize(total_compressed_bytes) as total_comp
FROM (
SELECT
name,
type,
data_compressed_bytes,
sum(data_compressed_bytes) OVER (ORDER BY data_compressed_bytes DESC) AS total_compressed_bytes,
#!/bin/sh
# Wakeup Script
# This script sets the volume to 100% and plays a song from a Spotify playlist.
# It is intended to be run by a cron job.
PATH="$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin:$HOME/.cargo/bin"
#SPT="$HOME/.cargo/bin/spt"
TARGET_DEVICE="mac" # The device to play the song on
# Function to restart the Spotify daemon
#!/usr/bin/env python
import os
import sys
from groq import Groq
def main():
client = Groq(
api_key=os.environ.get("GROQ_API_KEY"),
#!/bin/bash
rm -rf /tmp/tls_tst
mkdir /tmp/tls_tst
pushd /tmp/tls_tst
# Generate a private key for the CA
openssl genrsa -out ca.key 2048
# Create a self-signed certificate for the CA
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nicksherron
nicksherron / ai.sh
Last active January 31, 2024 07:18
Openai completion api bash function
#!/usr/bin/env bash
# Description: A function to use openai's gpt-4-turbo-preview chat completions
# to generate responses to input. It uses redis to cache responses for 1 hour
# and has a flag to skip cached results.
# Usage: ai [-s|--skip-cache] [input]
function ai {
## check if we should skip cache
skip_cache=false
while true; do
3024 Day
3024 Night
Aardvark Blue
Abernathy
Adventure
AdventureTime
Afterglow
Alabaster
AlienBlood
Andromeda
@nicksherron
nicksherron / OIG.g.jpeg
Last active July 7, 2023 19:15
for testing made by dall-e
OIG.g.jpeg