Skip to content

Instantly share code, notes, and snippets.

View bgrins's full-sized avatar

Brian Grinstead bgrins

View GitHub Profile
var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13;
function objectConverter(columns) {
return new Function("d", "return {" + columns.map(function(name, i) {
return JSON.stringify(name) + ": d[" + i + '] || ""';
}).join(",") + "}");
}
function customConverter(columns, f) {
var object = objectConverter(columns);
return function(row, i) {
return f(object(row), i, columns);
function zoomOnMarkers(marker1, marker2) {
const zeroAt = selectors.profile.getZeroAt(getState());
dispatch(actions.commitRange(marker1.start - zeroAt, marker2.start - zeroAt));
}
function resetRange() {
dispatch(actions.popCommittedRanges(0));
}
function findRanges(suiteName) {
#!/bin/bash
# First install whisper.cpp:
# xcode-select --install # if necessary
# git clone https://github.com/ggerganov/whisper.cpp.git
# cd whisper.cpp && make && cd models && bash ./download-ggml-model.sh small
# Next, install ffmpeg if necessary (`brew install ffmpeg`)
if [[ ! -f $1 ]]; then
echo "$1 is not a file."

Create the project

If you don't already have one npm create vite@latest, and cd into the directory. Then:

git init
git add .
git commit -m "first-commit"
git branch -M main
@bgrins
bgrins / open-url.md
Last active January 20, 2023 20:19
Open URL in current iOS simulator

First open a simulator:

open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app

Then open a given URL in mobile Safari:

/Applications/Xcode.app/Contents/Developer/usr/bin/simctl openurl `/Applications/Xcode.app/Contents/Developer/usr/bin/simctl list | grep Booted | perl -ne'/\(([A-Z,0-9,-]+)\)/ && print "$1"'` "http://localhost:3000"
# Automatically restart datasette when a db file changes
sh -c '$PWD/scripts/restart-datasette.sh &' && fswatch -o fixtures.db | xargs -n1 -I{} sh -c '$PWD/scripts/restart-datasette.sh &'
deno eval 'let nanoid=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e>62?"-":"_"),"");console.log(nanoid())'
import { parse } from "https://deno.land/std/flags/mod.ts";
import { DB } from "https://deno.land/x/sqlite/mod.ts";
import { faker } from "https://esm.sh/@faker-js/[email protected]?dts";
// deno run --allow-read --allow-write fake-db.js --seed=1 --locale=fr --file=fake-data.db
const args = parse(Deno.args, {
default: {
seed: null,
locale: "en",
file: "fake-data.db",

For some reason just using datasette when in the venv described at https://docs.datasette.io/en/0.62/contributing.html didn't work, so use this instead

./venv/bin/datasette --reload -p 8002 fixtures.db

Full command to build the codemirror bundle and re-run:

node_modules/.bin/rollup datasette/static/cm-editor-6.0.1.js -f iife -n cm -o datasette/static/cm-editor-6.0.1.bundle.js -p @rollup/plugin-node-resolve -p @rollup/plugin-terser &amp;&amp; ./venv/bin/datasette --reload -p 8002 fixtures.db