Skip to content

Instantly share code, notes, and snippets.

document.addEventListener('DOMContentLoaded', function() {
let mediaRecorder;
let audioChunks = [];
let isRecording = false;
const recordBtn = document.getElementById('recordBtn');
const transcriptionEl = document.getElementById('transcription');
let token = localStorage.getItem('apiToken');
if (!token) {
token = prompt('Please enter your OpenAI API token:');
@mbrock
mbrock / hole-mode.el
Last active February 16, 2024 14:01
hole mode for emacs
;;; hole-mode.el --- fill holes with GPT-4 -*- lexical-binding: t -*-
;; Author: Mikael Brockman <mikael@brockman.se>
;; Version: 1.0
;;; Commentary:
;; This package provides a minor mode for filling holes in code with AI.
;;
;; It is designed to work with the `llm' command-line tool, which is a
@mbrock
mbrock / swash.js
Created October 26, 2023 11:03
swa.sh
// swa.sh - a tool, for naught
// Copyright (C) 2023 Mikael Brockman
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@mbrock
mbrock / roam-telegram.js
Last active September 21, 2021 18:21
Roam Telegram integration PoC
// I made this in like one hour while baby was napping.
// It's a proof of concept, but I hope to improve it soon.
// In particular, I really want to grab photos from Telegram.
//
// Make a page in your Roam called [[Telegram Bot]].
//
// Put two nodes in there:
//
// API Key:: <key you get from Telegram's bot system>
// Last Update ID::
{-# Language DataKinds #-}
{-# Language FlexibleContexts #-}
{-# Language FlexibleInstances #-}
{-# Language KindSignatures #-}
{-# Language ScopedTypeVariables #-}
{-# Language TypeApplications #-}
{-# Language ViewPatterns #-}
module Tax where
FROM ubuntu
RUN apt update && apt install -y sudo && \
mkdir -p /home/user && groupadd -r user && \
useradd -r -g user -d /home/user -s /sbin/nologin -c "User" user && \
echo "user ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/user && \
chmod 0440 /etc/sudoers.d/user
ENV HOME=/home/user
RUN chown user:user /home/user
RUN apt install -y curl bzip2
USER user
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p bash
true
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p nix-prefetch-scripts curl jshon jq
set -e
json="{}"
add() { json=$(jshon "$@" <<<"$json"); }
rm -rf overlay/upstream
mkdir -p overlay/upstream
GET() {

Keybase proof

I hereby claim:

  • I am mbrock on github.
  • I am mbrock (https://keybase.io/mbrock) on keybase.
  • I have a public key ASBYWz5glW-ksfNNPzhmsTlZVH-rpyk6rKyLHC1WghPddAo

To claim this, I am signing this object:

# Put this expression right in your systemPackages
(pkgs.writeScriptBin "foo" ''
#! ${stdenv.shell}
echo foo
'')