Skip to content

Instantly share code, notes, and snippets.

View NigelThorne's full-sized avatar

Nigel Thorne NigelThorne

View GitHub Profile
@NigelThorne
NigelThorne / ask.sh
Last active February 5, 2025 01:40
ask-claude uses Zellij and llm to give you an AI helper in your terminal that can see what you are doing.
#!/bin/bash
# Check for newer version at gist
local_hash=$(tr -d '\r\n' < "$0" | md5sum | cut -d ' ' -f 1)
remote_hash=$(curl -s https://gist.githubusercontent.com/NigelThorne/385ebbbe2060cc16414ced49e853f12f/raw/ | tr -d '\r\n' | md5sum | cut -d ' ' -f 1)
if [ "$local_hash" != "$remote_hash" ]; then
echo "A newer version is available at: https://gist.github.com/NigelThorne/385ebbbe2060cc16414ced49e853f12f" >&2
fi
@NigelThorne
NigelThorne / bash
Created January 24, 2025 04:41
Fix HDMI audio on OSX
# I'm also using SoundSource
# Install via Homebrew
brew install sleepwatcher
# Create a .wakeup script in your home directory
echo "SwitchAudioSource -n && SwitchAudioSource -s 'SMART TV'" > ~/.wakeup
chmod +x ~/.wakeup
# Start sleepwatcher as a service
@NigelThorne
NigelThorne / infinite_cube.scad
Created July 5, 2022 00:06
An OpenScad model of an infinite cube.
$fn=40;
sz=10;
module ccube(x,y,z){
gap=0.4;
ch=(sz+gap)*0.25;
xoffset = sz * x;
yoffset = sz * y;
zoffset = sz * z;
@NigelThorne
NigelThorne / col
Last active March 1, 2022 00:34
Col returns the specified columns from each line in stdin
#!/usr/bin/bash
# Usage: col x x x
# where x is a column number or + to mean all following columns
#
# example: ls -al | col 6 7 9
# example: ls -al | col 2 7 +
# example: ls -al | col -1
# Here is a fun use... interleave lines from logs from several containers in timestamp order
# docker-compose logs --tail='all' -t | col 3 1 + | sort | col 2 +
@NigelThorne
NigelThorne / nsubl.bat
Created June 24, 2015 03:10
Use sublime text with 7zip
"%~dp0subl.exe" -n -w %1
@NigelThorne
NigelThorne / styler.css
Created March 1, 2012 22:42
WorkFlowy userscript to add css classes to nodes based on their tags
/* I use Stylish (a chome addin) to set these styles
* URLs on the domain workflowy
*/
.next-row {
border: 2px solid #46A546 !important;
border-top-left-radius:0.5em;
background-color: #CCFFCC !important;
}
@NigelThorne
NigelThorne / .gitconfig
Created August 28, 2020 09:13
AzureDevops Git aliases
[alias]
pushu = !git push --set-upstream origin `git symbolic-ref --short HEAD` && git rpr
current-branch-name = !git rev-parse --abbrev-ref HEAD
current-branch-name-escaped = !git escape-url `git current-branch-name`
escape-url = "!f() { perl -MURI::Escape -e \"print uri_escape('"$*"');\"; }; f"
current-push-url = !git remote get-url --push origin
raise-pull-request = !sh -c \"echo -e \\\" \\nRaise a pull request here: \\n `git current-push-url`/pullrequestcreate?sourceRef=`git current-branch-name-escaped`&targetRef=master\\\"\"
rpr = raise-pull-request
@NigelThorne
NigelThorne / .gitalias
Last active August 4, 2020 07:45
Git Aliases
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit
# View the current working tree status using the short format
s = status -s
# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
@NigelThorne
NigelThorne / karabiner.json
Last active June 29, 2020 02:06 — forked from ttscoff/karabiner.json
Karabiner Elements hyper key with escape
"complex_modifications": {
"rules": [
{
"manipulators": [
{
"description": "Change caps_lock to command+control+option+shift. Escape if no other key used.",
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
@NigelThorne
NigelThorne / gen_jira.rb
Last active February 17, 2020 01:05
Generate issues in Jira from a list
require 'rubygems'
require 'jira-ruby'
require 'awesome_print'
def get_jira_client()
options = {
:username => 'xxx',
:password => 'xxx',
:site => 'http://jira.xxx:80/',#'http://mydomain.atlassian.net:443/',