Skip to content

Instantly share code, notes, and snippets.

View wilsonsilva's full-sized avatar

Wilson Silva wilsonsilva

View GitHub Profile
@wilsonsilva
wilsonsilva / ollama_prune.sh
Created October 27, 2024 08:13
Ollama prune
# Deletes all ollama model
ollama list | awk 'NR>1 {print "ollama rm " $1}' | sh
@wilsonsilva
wilsonsilva / sidekiq_retry_time.csv
Created October 22, 2024 07:26 — forked from marcotc/sidekiq_retry_time.csv
Sidekiq retry exponential backoff formula times
Retry count Retry Time Total Cumulative Time Total Cumulative Days
0 0:00:00 0:00:00 0.0
1 0:00:16 0:00:16 0.0
2 0:00:31 0:00:47 0.0
3 0:01:36 0:02:23 0.0
4 0:04:31 0:06:54 0.0
5 0:10:40 0:17:34 0.0
6 0:21:51 0:39:25 0.0
7 0:40:16 1:19:41 0.1
8 1:08:31 2:28:12 0.1
@wilsonsilva
wilsonsilva / ssl_proxying.md
Created May 26, 2024 15:40
Configuring SSL Proxying in Charles Proxy
  1. Configure SSL Proxying: Proxy -> SSL Proxying Settings...
  • Click on the + button
  • On the Host write api.unify.ai
  • On the Port write 443
  • Click on the Done buttons
  1. Enable the macOS proxy: Proxy -> macOS Proxy
  2. Install the root certificate: Help -> SSL Proxying -> Install Charles Root Certificate
  3. Trust the certificate:
  • Open Keychain Access
  • Open the tab Certificates
@wilsonsilva
wilsonsilva / ghcd.sh
Created May 23, 2024 16:52
Change directory (cd) into a local github repository
ghcd() {
if [ -z "$1" ]; then
echo "Usage: ghcd <username/repo>"
else
wd github
folder_name=$(echo "$1" | cut -d "/" -f1)
repo_name=$(echo "$1" | cut -d "/" -f2)
cd "$folder_name/$repo_name"
fi
}
@wilsonsilva
wilsonsilva / ollama_image_prompt.sh
Created April 17, 2024 09:21
Ollama image prompt
curl http://localhost:11434/api/generate -d '{
"model": "llava:v1.6",
"prompt": "What is in this picture?",
"images": ["'"$(base64 --input my_image.jpeg)"'"]
}'
curl http://localhost:11434/api/generate -d '{
"model": "llava:v1.6",
"prompt": "Extract all the text in this picture",
"stream": false,
@wilsonsilva
wilsonsilva / whisper.cpp.sh
Created March 20, 2024 13:22
whisper.cpp transcribe wav and serve wav
ffmpeg -i ~/Desktop/input.m4a -ar 16000 ~/Desktop/input.wav
pip install ane_transformers
pip install openai-whisper
pip install coremltools
gclone ggerganov/whisper.cpp
make clean
cmake -B build -DWHISPER_COREML=1
@wilsonsilva
wilsonsilva / rename.rb
Created November 24, 2023 05:47
Rename a gem
# from https://bradgessler.com/articles/rename-a-rubygem/
require 'pathname'
require 'fileutils'
class GemRename
def initialize(base_dir = ".")
@base_dir = Pathname.new(base_dir)
end
@wilsonsilva
wilsonsilva / gclone.sh
Created October 25, 2023 13:57
Clone github repo in the github folder
# Creates a directory called username in the github folder, clones the repo and cd's into the repo
# Add it to .zshrc
# requires gh, wd and a warp point called 'github'
# wd: https://github.com/mfaerevaag/wd
# gh: https://cli.github.com
# Usage: gclone username/repo
gclone() {
if [ -z "$1" ]; then
echo "Usage: gclone <username/repo>"
@wilsonsilva
wilsonsilva / build_raylib_for_sonoma.sh
Created October 23, 2023 04:11
Build raylib 4.5 dylib for macOS Sonoma
#!/bin/bash
FIXED_MINIAUDIO_URL="
https://raw.githubusercontent.com/mackron/miniaudio/fe5f17ecf3189c680855b030467bcfa9f8d26143/miniaudio.h"
curl -L $FIXED_MINIAUDIO_URL -o src/external/miniaudio.h
mkdir -p build
cd build
cmake \
@wilsonsilva
wilsonsilva / serve.sh
Created October 16, 2023 18:05
python3 -m http.server equivalent in Ruby
ruby -run -e httpd . -p 8080