View toot.rb
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 -W1 | |
# frozen_string_literal: true | |
# This script scans an RSS feed for the latest post, and if | |
# it hasn't already been posted to Mastodon, creates a new | |
# toot with a link to it. | |
require 'json' | |
require 'optparse' | |
require 'rss' |
View md_to_bike.rb
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 | |
# This script takes simple Markdown lists and converts them for use in | |
# Bike (https://www.hogbaysoftware.com/bike/), a Mac outliner app from | |
# Hog Bay Software. | |
# | |
# It doesn't handle nested code blocks or any non-list Markdown. It just | |
# turns simple lists into text Bike will recognize when it's pasted into | |
# a Bike document. Multiple paragraphs in a list item become additional |
View lexers.rb
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 'optparse' | |
# Have you ever been adding code to a Markdown post and | |
# wondered what syntax label would give you the right | |
# highlighting for your fenced code block? This script can | |
# take either a file extension or a common name of a language | |
# and let you know what lexers are supported for it, as well |
View hugo_youtube_textexpander.js
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
var url = TextExpander.pasteboardText; | |
var youtubeRx = /(?:youtu\.be\/|youtube\.com\/watch\?v=)([a-z0-9_\-]+)$/i | |
if (youtubeRx.test(url)) { | |
var id = youtubeRx.exec(url)[1]; | |
TextExpander.appendOutput(`{< youtube ${id}>}`); | |
} |
View rouge_bunch.rb
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
# This "hook" is executed right before the site's pages are rendered | |
Jekyll::Hooks.register :site, :pre_render do |site| | |
require "rouge" | |
module Rouge | |
module Lexers | |
class BunchLexer < RegexLexer | |
title 'Bunch' | |
desc "Bunch.app File" |
View btt_indigo.rb
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 | |
# Indigo control for BetterTouchTool | |
# | |
# Usage: | |
# | |
# To query a device status | |
# /path/to/btt_indigo.rb status "Device Name" | |
# | |
# To toggle a device: | |
# /path/to/btt_indigo.rb toggle "Device Name to Query for state" "Action On Group Name" "Action Off Group Name" |
View bunch_status.rb
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" | |
# |
View lastcolor.rb
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 |
View 256color.rb
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') |
View git_fzf.fish
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 |
NewerOlder