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 https://github.com/nriley/brightness
CMD = "/usr/local/bin/brightness"
# Display usage and exit
def usage(code)
View README.md

A CLI for Bunch.app by Brett Terpstra

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

CLI for Bunch.app
    -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
ttscoff / Example.bunch
Last active Jun 11, 2019
Sample .bunch file for Bunch.app
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.
Messages
@ttscoff
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')
installed_setapp_apps.map! {|app|
File.basename(app,'.app')
}
# Grab the All Apps page from Setapp to get all available apps
@ttscoff
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
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
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
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(/amazon.com/)) {
document.querySelector("#searchDropdownBox").selectedIndex = 0;
document.querySelector("#twotabsearchtextbox").select();
}
View Lucky Charms.tmTheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Lucky Charms</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@ttscoff
ttscoff / darkmode.sh
Created Sep 26, 2018
A macOS one-liner for switching Dark Mode on/off (Mojave)
View darkmode.sh
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.