Skip to content

Instantly share code, notes, and snippets.

View valstu's full-sized avatar

Valtteri Karesto valstu

View GitHub Profile
@ttunguz
ttunguz / gist:686bb1e28f2df4e66373cdf57bf61627
Created December 15, 2023 05:50
Dictation with Whisper.cpp
from pynput.keyboard import Key, Listener, Controller
import sounddevice as sd
import numpy as np
from scipy.io.wavfile import write
import subprocess
import os
import re
import datetime
# Set the sample rate to 16 kHz
@paulshen
paulshen / natto-eval.js
Created April 13, 2021 16:11
natto.dev eval pseudocode
const f = useMemo(() => {
try {
return new Function('inputs', `return ${expression}`);
} catch (e) {
return [e];
}
}, [expresssion]);
// input atoms
@kitze
kitze / store.js
Created January 24, 2018 13:14
simplified redux
import produce from 'immer';
import {createStore} from 'redux';
const handleActions = (actionsMap, defaultState) => (
state = defaultState,
{type, payload}
) =>
produce(state, draft => {
const action = actionsMap[type];
action && action(draft, payload);
@laurenfazah
laurenfazah / express_postgress_knex.md
Last active November 26, 2022 13:19
Cheat Sheet: Setting up Express with Postgres via Knex

Express & Postgres via Knex

Note: <example> is meant to denote text replaced by you (including brackets).

Setup

// global dependencies
npm install -g knex
@lukehedger
lukehedger / ffmpeg-compress-mp4
Last active May 12, 2024 19:12
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4