Skip to content

Instantly share code, notes, and snippets.

@scpedicini
scpedicini / transcribe.py
Last active October 2, 2024 09:30
Python Dictation Transcription Application
# This script will transcribe an audio file (mp3, wav, etc.) to text and then clean the text using a local LLM model via Ollama. Technically, this script will work with any LLM that supports the standard OpenAI bindings with minor adjustments.
# GETTING STARTED:
# 1. Install required python packages (pip install openai python-dotenv)
# 2. Git clone a copy of ggerganov/whisper (https://github.com/ggerganov/whisper.cpp)
# 3. Build the whisper binary (see the whisper.cpp README for instructions)
# 4. Download one of the whisper models (largev2 is the most accurate for all languages, though the base model works reasonably well for English).
# 5. Install ffmpeg (brew install ffmpeg on macOS, apt-get install ffmpeg)
# 6. Install ollama (https://ollama.com/download)
# 7. Download an LLM model (https://ollama.com/library)
@scpedicini
scpedicini / brew.md
Created September 3, 2022 22:18 — forked from pudquick/brew.md
Lightly "sandboxed" homebrew on macOS

brew is a bad neighbor

This isn't a guide about locking down homebrew so that it can't touch the rest of your system security-wise.

This guide doesn't fix the inherent security issues of a package management system that will literally yell at you if you try to do something about "huh, maybe it's not great my executables are writeable by my account without requiring authorization first".

But it absolutely is a guide about shoving it into its own little corner so that you can take it or leave it as you see fit, instead of just letting the project do what it likes like completely taking over permissions and ownership of a directory that might be in use by other software on your Mac and stomping all over their contents.

By following this guide you will:

  • Never have to run sudo to forcefully change permissions of some directory to be owned by your account
@scpedicini
scpedicini / logger.js
Last active September 19, 2021 22:18
Sqlite3 Winston Logger
// requirements
const winston = require('winston');
const winstonSqlite3Transport = require('./winston-sqlite3-transport');
class Logger {
winstonLogger;
constructor(db_file) {
this.winstonLogger = winston.createLogger({
level: 'debug',
@scpedicini
scpedicini / safeparse.js
Created December 20, 2020 18:12
Convert a JSON string into a standard javascript object
/**
* Convert a JSON string into a standard Javascript Object
* @param x - JSON string
* @returns {{}} - Deserialized object or empty object
*/
static SafeParse(x) {
let obj = { };
try
{
if(x !== null && x !== undefined)
@scpedicini
scpedicini / block.js
Last active December 20, 2020 18:06
Block CPU
/**
* Simple CPU-bound blocking operation for testing purposes
* @param baseNumber - higher the value, the longer the operation will block
*/
static blockCPU(baseNumber) {
console.time('blockCPU');
let result = 0;
for (let i = Math.pow(baseNumber, 7); i >= 0; i--) {
result += Math.atan(i) * Math.tan(i);
}