Skip to content

Instantly share code, notes, and snippets.

@blackestwhite
blackestwhite / embeddinggemma.py
Created September 6, 2025 09:51
Ollama EmbeddingGemma (with Gemma3n:e4b) example
import ollama
import chromadb
documents = [
"Llamas are members of the camelid family meaning they're pretty closely related to vicuñas and camels",
"Llamas were first domesticated and used as pack animals 4,000 to 5,000 years ago in the Peruvian highlands",
"Llamas can grow as much as 6 feet tall though the average llama between 5 feet 6 inches and 5 feet 9 inches tall",
"Llamas weigh between 280 and 450 pounds and can carry 25 to 30 percent of their body weight",
"Llamas are vegetarians and have very efficient digestive systems",
"Llamas live to be about 20 years old, though some only live for 15 years and others live to be 30 years old",
@blackestwhite
blackestwhite / dockerfile
Created March 1, 2025 06:14
nuxt dockerfile
FROM node:23-alpine3.20 AS build
# update and install the latest dependencies for the alpine version
RUN apk update && apk upgrade
# Install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# set work dir as app
WORKDIR /app
@blackestwhite
blackestwhite / backup-minio.yml
Created January 14, 2025 18:08
a github action to save minio contents to a git repo
name: Backup All MinIO Buckets and Push to GitHub
on:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight
workflow_dispatch: # Allows manual triggering
jobs:
backup:
runs-on: ubuntu-latest
pip install --upgrade --force-reinstall "git+https://github.com/ytdl-org/youtube-dl.git"
@blackestwhite
blackestwhite / forward.sh
Created December 5, 2022 13:46
port forwarding using ip tables
#!/bin/bash
read -p "Enter your proxy server's IP: " PROXY_IP
read -p "Enter your destination server's IP: " DEST_IP
sysctl net.ipv4.ip_forward=1
iptables -t nat -A PREROUTING -p tcp --dport 22 -j DNAT --to-destination $PROXY_IP
iptables -t nat -A PREROUTING -j DNAT --to-destination $DEST_IP
iptables -t nat -A POSTROUTING -j MASQUERADE
iptables-save
@blackestwhite
blackestwhite / EnFa_conversion.js
Last active October 25, 2022 11:42
English to Persian, Persian to English digit conversion, JavaScript RegEx
const ToPersian = str => str.replace(/\d/g, idx => '۰۱۲۳۴۵۶۷۸۹'[idx])
const ToEnglish = str => str.replace(/[۰-۹]/g, d => '۰۱۲۳۴۵۶۷۸۹'.indexOf(d))
@blackestwhite
blackestwhite / abi.json
Created June 19, 2022 04:43
Golang code snippet to listen/log BUSD events on Binance Smart Chain
[{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"constant":true,"inputs":[],"name":"_decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMu

Keybase proof

I hereby claim:

  • I am blackestwhite on github.
  • I am blackestwhite (https://keybase.io/blackestwhite) on keybase.
  • I have a public key ASB2jQIEFv55bU6Dn76GzGndtkNQRwyquOu3O3zcNsdW4go

To claim this, I am signing this object: