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 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
    -l, --list                       List available Bunches
    -o, --open                       Open Bunch ignoring "Toggle Bunches" preference
    -c, --close                      Close Bunch ignoring "Toggle Bunches" preference
@ttscoff
ttscoff / Example.bunch
Created May 18, 2019
Sample .bunch file for Bunch.app
View Example.bunch
# Use @@ to hide all visible apps. Usually used at the top of the file
# before launching the rest of the bunch
@@
# Commands are surrounded by parenthesis. Only commands Bunch
# recognizes will be executed
(hide dock)
# Comments start with a hash symbol, blank lines are ignored
# Apps to launch start at the beginning of a line, no
@ttscoff
ttscoff / onsetapp.rb
Last active Apr 23, 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 May 8, 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'
View regexrx2md.rb
#!/usr/bin/env ruby
require 'fileutils'
require 'nokogiri'
require 'optparse'
require 'erb'
def class_exists?(class_name)
klass = Module.const_get(class_name)
return klass.is_a?(Class)
rescue NameError
You can’t perform that action at this time.