Skip to content

Instantly share code, notes, and snippets.

View mwolson's full-sized avatar

Mike Olson mwolson

View GitHub Profile
@mwolson
mwolson / README.md
Last active January 24, 2025 08:32
gptel-manual-complete.el

gptel-manual-complete.el

This is an example of how the existing gptel-rewrite.el file can be used to perform completion on an entire function, replacing what's already written so far in that function.

Setup

To use:

@mwolson
mwolson / gradio-ui.py
Created January 10, 2025 01:02
local llm UI example
# taken from https://mer.vin/2024/07/codestral-mamba-code/
import gradio as gr
import openai
import os
import sys
openai.api_key = "-"
openai.base_url = sys.argv[1]
def chat_with_mistral(user_input):
@mwolson
mwolson / README.md
Last active January 7, 2025 16:11
Ghostty + tmux uniform copy and paste

Ghostty + tmux uniform copy and paste

Explanation

This set of configuration changes achieves the following:

  • Disable automatic copying to clipboard while using the mouse to select text. Instead, the selection is copied when the user types either Ctrl+Shift+c or Super+c (on macOS only) after using the mouse to select text.
  • The Super+c keybinding works by remapping it to Ctrl+Shift+c in ghostty.
  • Ghostty will ignore those keybindings so that tmux can handle them. This allows tmux to copy text cleanly even
@mwolson
mwolson / index.css
Created March 20, 2019 23:31
zoom image into a box preserving aspect ratio
.tc-ConversationItem[class] .tc-ConversationItem__avatar .tc-AvatarImage {
// modify these with something like calc(200%), or manual width/height "box" around the image
// which then gets zoomed to fit
width: 52px;
height: 52px;
}
.tc-AvatarImage[class].tc-AvatarImage--size--fit {
display: block;
width: 100%;
@mwolson
mwolson / pyramid.md
Created March 22, 2017 22:13
Test pyramid

Test pyramid

We want more of the (faster and/or easier to write) things at the bottom of the pyramid, and less of the (slower and/or harder to write) things at the top of the pyramid.

                        /\
                       /  \
                      /    \
 / security analysis
@mwolson
mwolson / updating-man-database.md
Created October 21, 2016 01:30
Updating man database (for man -k) on OS X

After installing new packages, the M-x man command might not list the new manpages for those packages, because the whatis DB used by man gets updated weekly via a cron job. Further, any manpages for programs that are part of the XCode Commandline Tools will never get installed because the cron job inexplicably excludes them. To make force them to be generated, run the following:

sudo /etc/periodic/weekly/320.whatis
sudo /usr/libexec/makewhatis /Applications/Xcode.app/Contents/Developer/usr/share/man
# Before
$ wrk -c 20 -t 6 -d 50s http://localhost:8181/health/healthcheck
Running 50s test @ http://localhost:8181/health/healthcheck
6 threads and 20 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 73.58ms 112.85ms 375.41ms 87.91%
Req/Sec 138.11 97.30 348.00 66.52%
41179 requests in 50.00s, 10.76MB read
Requests/sec: 823.57
Transfer/sec: 220.37KB
@mwolson
mwolson / local-node.sh
Created March 14, 2014 15:08
Run local compiled version of node.js in a shell, or execute some code with it
#!/bin/bash
export NODE_EXEC=/proj/helpers/node/node
export V8_PATH=/proj/helpers/node/deps/v8/out/native
if test -z "$1"; then
export PATH=/proj/helpers/node:"$PATH"
echo "Now using node $(which node); Ctrl+D to exit"
$SHELL
else
@mwolson
mwolson / swank-js-init.el
Last active December 15, 2015 01:19
Attaching to a swank-js node.js server using SLIME and Emacs
;; Improved Javascript support
(add-to-list 'load-path (concat my-emacs-path "/elisp/js2-mode"))
(autoload 'js2-mode "js2-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
;; Node REPL using SLIME
(add-to-list 'load-path (concat my-emacs-path "/elisp/slime"))
(add-to-list 'load-path (concat my-emacs-path "/elisp/slime/contrib"))
(require 'slime)
(autoload 'slime-js-minor-mode "slime-js" nil t)