This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
require 'json' | |
# Usage in a BetterTouchTool Shell Script Widget | |
# | |
# For a Stream Deck widget: | |
# /path/to/bunch_status.rb sd title "Bunch Name" | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
# String color helpers | |
class ::String | |
ESCAPE_REGEX = /(?<=\[)(?:(?:(?:[349]|10)[0-9]|[0-9])?;?)+(?=m)/.freeze | |
# Get the calculated ANSI color at the end of the string | |
# | |
# If you want to inject a colored string into another |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
# 256-color hex interpretation for terminal colorization | |
# | |
# Usage | |
# "text".color256(foreground, background) | |
# | |
# print "Colorize this".color256('#f7921e', '#666') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @ttscoff's version of @max-sixty's revision of @aluxian's | |
# fish translation of @junegunn's fzf git keybindings | |
# https://gist.github.com/junegunn/8b572b8d4b5eddd8b85e5f4d40f17236 | |
# https://gist.github.com/aluxian/9c6f97557b7971c32fdff2f2b1da8209 | |
# | |
# 2021-12-23: | |
# - Fix hash returned by *git_log being truncated | |
# - Allow multiple selections for git_status | |
# - Allow multiple selections for git_log, insert HASH[1].. HASH[-1] range | |
# - bind ctrl-a for select all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mdfind -onlyin /Applications '(((kMDItemContentTypeTree == "com.apple.application"cd && (kMDItemUsedDates >= "$time.today(-30d)" && kMDItemUsedDates < "$time.today(+1d)"))))' 2> /dev/null | grep -vE '/(Dock|Finder|Music|Messages|System Preferences|Activity Monitor|Calendar).app' | awk -F/ '{sub(/\.app$/, ""); print "- ["$NF"](!s)"}' | awk '!x[$0]++' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Namecheap DDNS updater for Synology | |
## Brett Terpstra <https://brettterpstra.com> | |
PASSWORD="$2" | |
DOMAIN="$3" | |
IP="$4" | |
PARTS=$(echo $DOMAIN | awk 'BEGIN{FS="."} {print NF?NF-1:0}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check spelling of all Markdown files in current git repo using aspell | |
for file in $(git ls-files|grep -v -E '(/|^)_'|grep -iE '\.(md|markdown)$'); do | |
aspell -M --lang=en --dont-backup --home-dir=$HOME --personal=$HOME/aspell.txt check "$file" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Turn Do Not Disturb on or off | |
/// Only handles on and off, no schedules | |
/// @param enabled true on, false off | |
- (void)setDND:(BOOL)enabled { | |
NSLog(@"Turning Do Not Disturb %@", (enabled ? @"on" : @"off")); | |
if (@available(macOS 11.0, *)) { | |
NSUserDefaults * defaults = [[NSUserDefaults alloc] initWithSuiteName:@"com.apple.ncprefs"]; | |
NSData * subPlistData = [defaults objectForKey:@"dnd_prefs"]; | |
NSMutableDictionary * propertyListDict = [[NSPropertyListSerialization propertyListWithData:subPlistData options:0 format:nil error:nil] mutableCopy]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bookmarklet for [Pins.app](https://get-pins.app/) (requires version 1.6+) | |
// Removes Google Analytics strings | |
// Removes Product Hunt query string | |
// Prefers canonical url if defined | |
// Uses selected text for description, falling back to meta description | |
// Removes pipes (|) from title | |
// To allow use on any website in Firefox, go to about:config and set security.external_protocol_requires_permission to false | |
// Copy this to your URL bar: | |
javascript:!function(){function e(e){var n="pins://launch?screen=newPost&",i=o();""===i&&(i=r()),n+="url="+encodeURIComponent(e),n+="&",n+="title="+encodeURIComponent(t()),n+="&",n+="description="+encodeURIComponent(i),document.location.href=n}function t(){var e=document.title;return e.replace(/\|/g,"-")}function n(){for(var e=document.getElementsByTagName("link"),t=0;t<e.length;t++)if(e[t].attributes.hasOwnProperty("rel")&&"canonical"===e[t].attributes.rel.textContent.toLowerCase())return e[t].attributes.href.textContent;var n,o=document.location.href.split(/[?&]([^&]+)/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
# Memory and CPU stats formatted to use in a BetterTouchTool touch bar script widget | |
# Also works in menu bar (Other Triggers), but be sure to select "Use mono space font" | |
require 'optparse' | |
# Settings | |
settings = { | |
chart_width: 8, # character width of chart, > 2 | |
# Colors for level indicator, can be hex or rgb(a) |