Skip to content

Instantly share code, notes, and snippets.

View modille's full-sized avatar

Matt Odille modille

  • Pittsburgh, PA
  • 04:37 (UTC -04:00)
View GitHub Profile
@modille
modille / pinup.sh
Created December 20, 2018 18:18
Install and pin an older version of a homebrew formula
# Find and install an OLD version of a homebrew formula
# and PIN it to prevent upgrading.
# Choose formula
formula=kubernetes-cli
# View homebrew-core git log to find a commit
git clone git@github.com:Homebrew/homebrew-core.git
cd homebrew-core
git log master -- "Formula/$formula.rb"
@modille
modille / bundle_list_dash_install.sh
Last active October 18, 2021 15:34
Install Ruby docset for every gem included by a bundle
#!/usr/bin/env bash
# Adapted from:
# https://twitter.com/kapeli/status/649852908025040896
bundle list \
| awk -F'[ ()]+' '$2 == "*" {system("sleep 3"); print "dash-install://repo_name=Ruby%20Docsets&entry_name=" $3 "&version=" $4;}' \
| xargs open
@modille
modille / yinzer.zsh
Created November 15, 2018 18:40
docker-compose dahn
# example usage: docker-compose dahn --remove-orphans
docker-compose_dahn() {
command docker-compose down "$@"
}
docker-compose() {
local cmd=$1; shift
if command -v "docker-compose_$cmd" >/dev/null 2>/dev/null; then
"docker-compose_$cmd" "$@"
else
command docker-compose "$cmd" "$@"
@modille
modille / base16-solarized-light.vim
Created November 15, 2018 16:05
Fix vim-indent-guides for base16-solarized-light
" Indent Guides highlighting
" https://github.com/nathanaelkane/vim-indent-guides/issues/38
" https://github.com/nathanaelkane/vim-indent-guides/issues/109
" Taken from 1) :set background=light 2) :hi IndentGuidesEven
hi IndentGuidesEven guifg=#E3DDCC guibg=#CCC6B7
" Taken from 1) :set background=light 2) :hi IndentGuidesOdd
hi IndentGuidesOdd guifg=#CCC6B7 guibg=#E3DDCC
@modille
modille / build.gradle
Created October 23, 2018 17:55
Log failures in an error format that vim and other tooling can use
test {
// Log failures in an error format that vim and other tooling can use
// Something like:
// FILENAME:LINE_NUMBER failed: MESSAGE
// For example:
// src/test/java/TestFoo.java:42 failed: junit.framework.ComparisonFailure: null expected:<[b]ar> but was:<[B]ar>
afterTest { desc, result ->
if (result.resultType == TestResult.ResultType.FAILURE) {
result.getException().each { e ->
e.getStackTrace().each { el ->
@modille
modille / StartWindowRecording.applescript
Last active July 11, 2017 20:54
HOW TO: Record macOS screencast as animated GIF
set theProcessName to "Safari"
set theWindowNumber to 1
tell application "System Events"
tell process theProcessName
activate
tell window theWindowNumber
set thePosition to position
set theSize to size
end tell
@modille
modille / alfred-terminal-iterm2.applescript
Created April 11, 2017 16:31
Use iTerm2 for the Terminal/Shell feature in Alfred
on alfred_script(q)
tell application "iTerm2"
activate
tell current window
create tab with default profile
select
tell current session
write text q
end tell
end tell
@modille
modille / grep_xlsx_files.sh
Created March 6, 2017 17:00
Recursively find and grep through multiple Excel spreadsheets
# convert *.xlsx to *.xlsx.csv using https://github.com/dilshod/xlsx2csv
pip install xlsx2csv
# (shell-fu from http://stackoverflow.com/a/12965604)
find . -iname "*.xlsx" -exec sh -c 'xlsx2csv "$1" > "$1.csv"' x {} \;
# grep .csv files
brew install ripgrep
rg -i -g "*.csv" "waldo"
# ...or plain ole grep
@modille
modille / local.mk
Last active March 19, 2018 18:36
Custom Makefile to rebuild Neovim
all:
rebuild:
make distclean && make clean && make CMAKE_BUILD_TYPE=Release
sudo make install
pip2 install --user --upgrade neovim
pip3 install --user --upgrade neovim
gem update neovim
@modille
modille / ctags_chefdk.sh
Last active August 10, 2016 21:25
Generate ctags for ChefDK Ruby
ctags -R --languages=ruby --exclude=.git \
/opt/chefdk/embedded/lib/ruby/2.1.0 \
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/* \
~/.chefdk/gem/ruby/2.1.0/gems/* \
.