Skip to content

Instantly share code, notes, and snippets.

View mikeesto's full-sized avatar
🙂

Michael Esteban mikeesto

🙂
View GitHub Profile
@mikeesto
mikeesto / whisper-benchmarks.txt
Created August 15, 2024 04:22
Rough whisper benchmarks
MBP M3 Pro 36GB
Transcribing 39:00 min video
1:30 - MLX with distil-large-v3-ggml
1:44 - whisper.cpp with ggml-small.en and flash attention flag (-fa)
1:45 - whisper.cpp with ggml-small.en
@mikeesto
mikeesto / route.js
Created May 25, 2024 08:47
Fal.ai hide prompt nextjs
// app/api/fal/proxy/route.js
import { route } from "@fal-ai/serverless-proxy/nextjs";
export const POST = async (req) => {
const body = await req.json();
const modifiedBody = {
...body,
prompt: `an illustration of a ${body.input} in the style of Vincent van Gogh`,
@mikeesto
mikeesto / hotspot.md
Last active April 19, 2023 07:47
Create a local WiFi hotspot with a Raspberry Pi with custom routing

Create a local WiFi hotspot with custom routing on the Raspberry Pi

This setup lets you:

  • SSH into the Pi directly (e.g. ssh pi@raspberrypi)
  • Access things running on the Pi (e.g. a web server)
  • Set up fun domains that only exist within the local network, and can route to your services running on the Pi
  • Prevents any access to the internet which can be useful if you are running the Pi as a tech demo, or for teaching etc

This is a modified/shorter version from the official Pi docs.

@mikeesto
mikeesto / csv2bib.py
Created March 29, 2023 23:22
Convert CSV file to BibTeX
import csv
def generate_bibtex_key(authors, year):
"""Generate a BibTeX key from the first author's last name and the year"""
last_names = authors.split(",")[0].split()
last_name = last_names[-1] if len(last_names) > 0 else ""
return f"{last_name.lower()}{year}"
def convert_csv_to_bibtex(csv_file, bibtex_file):
"""Convert a CSV file to BibTeX format"""
@mikeesto
mikeesto / script.sh
Created October 24, 2022 03:30
Run Python scripts on boot with PM2
pm2 start script.py --interpreter python3
@mikeesto
mikeesto / cors.js
Last active October 4, 2022 17:45
Set CORS for Cloudflare R2
import aws from "aws-sdk";
const s3 = new aws.S3({
endpoint: `https://${process.env.CLOUDFLARE_ACCOUNT_ID}.r2.cloudflarestorage.com`,
accessKeyId: process.env.CLOUDFLARE_ACCESS_KEY,
secretAccessKey: process.env.CLOUDFLARE_SECRET_ACCESS_KEY,
signatureVersion: "v4",
});
const config = {
@mikeesto
mikeesto / docker.sh
Created September 21, 2022 04:28
Run a docker container and access the shell
docker run -i --entrypoint=/bin/sh ...
@mikeesto
mikeesto / docker.sh
Created September 21, 2022 04:26
Build x86_64 Docker image on M1/M2 architecture
docker buildx build --platform=linux/amd64 -t myimage .
@mikeesto
mikeesto / install.sh
Created January 5, 2022 12:44
Install Tensorflow 2 on a Raspberry Pi
# a fresh start
sudo apt-get -y update
sudo apt-get -y upgrade
# remove old versions, if not placed in a virtual environment (let pip search for them)
sudo pip uninstall tensorflow
sudo pip3 uninstall tensorflow
# install the dependencies (if not already onboard)
sudo apt-get install -y gfortran
sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev
sudo apt-get install -y libatlas-base-dev libopenblas-dev libblas-dev
@mikeesto
mikeesto / get_line.js
Created November 1, 2021 23:22
Bresenham's Line Algorithm - Produces a list of points from start to end
function get_line(start, end) {
let [x1, y1] = start;
let [x2, y2] = end;
let dx = x2 - x1;
let dy = y2 - y1;
const is_steep = Math.abs(dy) > Math.abs(dx);
// Rotate line