Skip to content

Instantly share code, notes, and snippets.

#!/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
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
#/usr/bin/env bash
# start redis cluster using tmux
function create_redis_cluster {
mkdir cluster-test
cd cluster-test
mkdir 7001 7002 7003 7004 7005 7006 || true
# create redis cluster
for port in 7001 7002 7003 7004 7005 7006
do
echo "port $port" > $port/redis.conf
cluster:
nodes: 6
metrics:
enabled: true
extraArgs:
skip-tls-verification: "true"
password: *************
persistence:
size: 16Gi
rbac:
<users>
<!-- If user name was not specified, 'default' user is used. -->
<user_name>
<password></password>
<!-- Or -->
<password_sha256_hex></password_sha256_hex>
<access_management>1</access_management>
<networks incl="networks" replace="replace">
echo '
[credential]
helper = store
[url "git@github.com:"]
insteadOf = https://github.com/' >> ~/.gitconfig