Skip to content

Instantly share code, notes, and snippets.

View mchowning's full-sized avatar

Matt Chowning mchowning

View GitHub Profile
@montasaurus
montasaurus / llmc.sh
Last active February 18, 2025 21:43
AI Shell Command Generator
llmc() {
local system_prompt='Output a command that I can run in a ZSH terminal on macOS to accomplish the following task. Try to make the command self-documenting, using the long version of flags where possible. Output the command first enclosed in a "```zsh" codeblock followed by a concise explanation of how it accomplishes it.'
local temp_file=$(mktemp)
local capturing=true
local command_buffer=""
local first_line=true
local cleaned_up=false # Flag to indicate whether cleanup has been run
cleanup() {
# Only run cleanup if it hasn't been done yet
@hypest
hypest / redux-store_index.js
Last active May 17, 2022 14:40
Gutenberg Redux action logger
function createSimpleLogger( storeName ) {
return ( store ) => ( next ) => ( action ) => {
const result = next( action );
console.log( {
storeName,
action,
result,
} );
return result;
};
@SirensOfTitan
SirensOfTitan / title-override.el
Created July 14, 2021 19:38
Org-roam titles that denote daily
(defun sirensoftitan/org-roam--is-daily-note (path)
"Determine if note at PATH is a daily note."
(when org-roam-dailies-directory
(string-prefix-p
(expand-file-name org-roam-dailies-directory)
(expand-file-name path))))
(defun sirensoftitan/org-roam--map-title (item)
"Map ITEM to a local title name."
(let* ((file-path (nth 1 item))
@geriux
geriux / patch.diff
Created June 24, 2021 13:04
Add redux logger
diff --git a/package.json b/package.json
index 5ca465469c..9596f57c16 100644
--- a/package.json
+++ b/package.json
@@ -80,7 +80,8 @@
"@wordpress/viewport": "file:packages/viewport",
"@wordpress/warning": "file:packages/warning",
"@wordpress/widgets": "file:packages/widgets",
- "@wordpress/wordcount": "file:packages/wordcount"
+ "@wordpress/wordcount": "file:packages/wordcount",
@alshakero
alshakero / tampermonkey-copy-text-fragment-url.user.js
Created May 27, 2020 15:02
Adds a context menu option to copy the text fragment URL
// ==UserScript==
// @name Copy text fragment URL
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Copies the text fragment URL for you
// @author Omar Alshaker (@alshakero)
// @include *
// @grant GM.setClipboard
// @run-at context-menu
// ==/UserScript==
@watofundefined
watofundefined / syncthing-git-backup.md
Last active July 18, 2024 15:12
Syncthing git backup recipe

Syncthing has awesome docs - start there if you haven't read them already. This is just a recipe to show how I set it up to have a git-versioned backup on Raspberry Pi.

Once machines are talking to each other via Syncthing add the folder through GUI, share it with another device, switch to that device and accept the incoming folder.

Let's say that the folder is ~/org.

On the 'backup' device in Syncthing GUI, go to Folder settings > File Versioning, choose "External File Versioning" and in Command input fill in: git-backup-org %FOLDER_PATH% %FILE_PATH%.

On the 'backup' device create the backup folder and initialize a git repository:

@ChrisPenner
ChrisPenner / Optics Cheatsheet.md
Last active February 16, 2025 02:11
Optics Cheatsheet
# If you, like me, have all of your various source-code-like projects in ~/src/
# this is how to give yourself per-project shell history.
#
# I wish I'd done this years ago.
#
# First, in your .bashrc file, you redefine the cd, pushd and popd builtins to be "do the builtin bit,
# then do one other thing (set_src_history.sh, below) like so:
cd () {
@snoyberg
snoyberg / README.md
Last active August 27, 2018 05:57
Miniature Haskell interactive environment for my kids to play around with
@brookisme
brookisme / gcloud-gpu-setup.sh
Last active February 24, 2018 05:01
Google Cloud GPU Setup: Instructions & bash-script
#!/bin/bash
cd ~/
### CUDA
echo "\n\nChecking for CUDA and installing."
if ! dpkg-query -W cuda; then
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
sudo dpkg -i ./cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
sudo apt-get update
sudo apt-get install cuda -y