Skip to content

Instantly share code, notes, and snippets.

Brett Terpstra ttscoff

Block or report user

Report or block ttscoff

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View brightness.rb
#!/usr/bin/env ruby
# Brett Terpstra 2019
# This script adds the ability to increment/decrement display brightness
# levels to the nriley/brightness CLI (Copyright (c) 2014-2019, Nicholas Riley)
# Requires CLI installation: `brew install brightness`
# See
CMD = "/usr/local/bin/brightness"
# Display usage and exit
def usage(code)

A CLI for by Brett Terpstra

Save the file below as bunch in your path. Run bunch -h for help.

CLI for
    -h, --help                       Display this screen
    -f, --force-refresh              Force refresh cached preferences
    -l, --list                       List available Bunches
    -o, --open                       Open Bunch ignoring "Toggle Bunches" preference
ttscoff / Example.bunch
Last active Jun 11, 2019
Sample .bunch file for
View Example.bunch
# Comments start with a hash symbol, blank lines are ignored
# Use @@ to hide all visible apps. Usually used at the top of the file
# before launching the rest of the bunch
# Apps to launch start at the beginning of a line, no
# need to quote or escape.
ttscoff / onsetapp.rb
Last active Aug 19, 2019
Check which Setapp Apps you could be using
View onsetapp.rb
#!/usr/bin/env ruby
# encoding: utf-8
# Read /Applications/Setapp to get apps already installed
installed_setapp_apps = Dir.glob('/Applications/Setapp/*.app')! {|app|
# Grab the All Apps page from Setapp to get all available apps
ttscoff / macsymbols.rb
Created Apr 19, 2019
Convert liquid-style tags for Mac symbols into HTML entities
View macsymbols.rb
class String
def replace_with_entity
case self.downcase
when /apple/
when /(comm(and)?|cmd|clover)/
when /(cont(rol)?|ctl|ctrl)/
when /(opt(ion)?|alt)/
ttscoff / sizes.rb
Last active Sep 10, 2019
sizes: Calculate and sort all filesizes for current folder
View sizes.rb
#!/usr/bin/env ruby
# Sizes - Calculate and sort all filesizes for current folder
# Includes directory sizes, colorized output
# Brett Terpstra 2019 WTF License
VERSION = "1.0.0"
require 'shellwords'
# Just including term-ansicolor by @flori and avoiding all the
# rigamarole of requiring multiple files when it's not a gem... - Brett
ttscoff / buildhelp.rb
Created Mar 29, 2019
A little tool for parsing build notes in my projects
View buildhelp.rb
#!/usr/bin/env ruby
# encoding: utf-8
require 'optparse'
filename = nil
# Check for a build note file in the current folder. Filename must start
# with "build" and have an extension of txt, md, or markdown.
Dir.glob('*.{txt,md,markdown}').each {|f|
if f.downcase =~ /^build/
ttscoff / amazon_all_departments.js
Created Dec 16, 2018
A snippet for use with a browser shortcut manager to focus the amazon search field and set the department to all departments. Because it's got dam annoying that there's no keyboard shortcut for that.
View amazon_all_departments.js
if (document.location.href.match(/ {
document.querySelector("#searchDropdownBox").selectedIndex = 0;
View Lucky Charms.tmTheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>Lucky Charms</string>
ttscoff /
Created Sep 26, 2018
A macOS one-liner for switching Dark Mode on/off (Mojave)
osascript -e 'tell app "System Events" to tell appearance preferences to set dark mode to not dark mode'
You can’t perform that action at this time.