Skip to content

Instantly share code, notes, and snippets.

@YohannParis
YohannParis / transcribe.py
Created June 13, 2025 13:05 — forked from scpedicini/transcribe.py
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)
/* From Mike Bostock
* https://x.com/mbostock/status/1765222176641437859
*/
c=new AudioContext(),g=c.createGain(),o=c.createOscillator(),G=g.gain,of=o.frequency,g.connect(c.destination),G.value=0.1,G.linearRampToValueAtTime(0,1),o.connect(g),o.type="square",of.setValueAtTime(988,0),of.setValueAtTime(1319,0.08),o.start(),o.stop(1)
@YohannParis
YohannParis / recover-deleted-branch.sh
Created February 21, 2024 14:00 — forked from umayr/recover-deleted-branch.sh
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}
@YohannParis
YohannParis / github_to_things.sh
Created November 10, 2023 20:39
Bash script to synchronize GitHub task to Things.app
#!/bin/bash
# Script to sync GitHub tasks with Things locally
# Run this script with a cron job every hour on weekdays from 8 AM to 6 PM.
# Commands to make it happen:
# > brew install jq
# > chmod +x script.sh
# > crontab -e
# > 0 8-18 * * 1-5 /path/to/github_to_things.sh
// Core assets
let coreAssets = [];
// On install, cache core assets
self.addEventListener('install', function (event) {
// Cache core assets
event.waitUntil(caches.open(coreID).then(function (cache) {
for (let asset of coreAssets) {
cache.add(new Request(asset));
# Really simple using ffmeg
ffmpeg -i video.mov -filter_complex "[0:v] fps=12,scale=960:-1,split [a][b];[a] palettegen [p];[b][p] paletteuse" -f gif video.gif
const cities = [
[-79.41, 43.66], // Toronto
[-73.58, 45.5], // Montreal
[-114.08, 51.08], // Calgary
[-75.7, 45.41], // Ottawa
[-63.6, 44.65], // Halifax
[-64.79, 46.09], // Moncton
[-123.13, 49.25], // Vancouver
[-63.13, 46.23], // Charlottetown
[-106.66, 52.13], // Saskatoon
@YohannParis
YohannParis / canada-postalCode-regEx.txt
Created September 10, 2019 17:29
[regex] Canada postal code, strict.
/**
* Regular expression to test string is a proper Canadian postal code.
* H0H H0H, H0H0H0, H0H-H0H, and h0h0h0 formats are valid.
*/
/^[ABCEGHJ-NPRSTVXY][0-9][ABCEGHJ-NPRSTV-Z][ -]?[0-9][ABCEGHJ-NPRSTV-Z][0-9]$/i
@YohannParis
YohannParis / [regex] find orphans
Last active July 30, 2019 20:34
Regular Expression to find orphans at the end of paragraphs
([\w,]+) ([$\w]{1,7}[.!:\?”…"']*)</(.*)>\n
// Analytics
dataLayer.push({
'event': 'Interactive',
'category': 'Interactive',
'action': 'ACTION',
'label': 'LABEL'
});