Skip to content

Instantly share code, notes, and snippets.

:octocat:
🤘Grokking Out 🤘

Matt Petty lodestone

:octocat:
🤘Grokking Out 🤘
View GitHub Profile
@lodestone
lodestone / appify
Created Jun 23, 2020 — forked from mathiasbynens/appify
appify — create the simplest possible Mac app from a shell script
View appify
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@lodestone
lodestone / bytes.rb
Created Jun 11, 2020 — forked from ttscoff/bytes.rb
Convert file sizes between human-readable and machine representations
View bytes.rb
#!/usr/bin/ruby
module Bytes
def to_human(n,fmt=false)
count = 0
formats = %w(B KB MB GB TB PB EB ZB YB)
while (fmt || n >= 1024) && count < 8
n /= 1024.0
@lodestone
lodestone / bulk-remove-iterm-colors.sh
Created May 5, 2020 — forked from kecebongsoft/gist:11312110
Bulk remove iTerm2 color schemes.
View bulk-remove-iterm-colors.sh
# There was a day where I have too many color schemes in iTerm2 and I want to remove them all.
# iTerm2 doesn't have "bulk remove" and it was literally painful to delete them one-by-one.
# iTerm2 save it's preference in ~/Library/Preferences/com.googlecode.iterm2.plist in a binary format
# What you need to do is basically copy that somewhere, convert to xml and remove color schemes in the xml files.
$ cd /tmp/
$ cp ~/Library/Preferences/com.googlecode.iterm2.plist .
$ plutil -convert xml1 com.googlecode.iterm2.plist
$ vi com.googlecode.iterm2.plist
@lodestone
lodestone / b.rb
Created Jan 19, 2020 — forked from junegunn/b.rb
b - browse Chrome bookmarks with fzf
View b.rb
#!/usr/bin/env bash
# vim: set filetype=ruby:
# b - browse Chrome bookmarks with fzf
[ $(uname) = Darwin ] || exit 1
which fzf > /dev/null 2>&1 || brew reinstall --HEAD fzf || exit 1
/usr/bin/ruby -x "$0" |
fzf-tmux -u 30% --ansi --multi --no-hscroll --tiebreak=begin |
awk 'BEGIN { FS = "\t" } { print $2 }' |
@lodestone
lodestone / coc_fzf.vim
Created Oct 9, 2019 — forked from RobertBuhren/coc_fzf.vim
Display coc.nvim diagnostics using FZF
View coc_fzf.vim
function! s:format_coc_diagnostic(item) abort
return (has_key(a:item,'file') ? bufname(a:item.file) : '')
\ . '|' . (a:item.lnum ? a:item.lnum : '')
\ . (a:item.col ? ' col ' . a:item.col : '')
\ . '| ' . a:item.severity
\ . ': ' . a:item.message
endfunction
function! s:get_current_diagnostics() abort
" Remove entries not belonging to the current file.
@lodestone
lodestone / rails_annotate_query.rb
Created May 2, 2019
Example of annotating a sql query from Rails
View rails_annotate_query.rb
Post.for_user(user).annotate("fetching posts for user ##{user.id}").to_sql
#=> SELECT "posts".* FROM "posts" WHERE ... /* fetching posts for user #123 */
@lodestone
lodestone / searchlink.rb
Created Mar 26, 2019 — forked from ttscoff/searchlink.rb
SearchLink creates Markdown links from automatic searches based on special syntax.
View searchlink.rb
@lodestone
lodestone / HOWTO-Dissassociate-Xcode-From-All-File-Types.md
Created Feb 15, 2019
HOWTO: Dissassociate/Unassociate Xcode from ALL file types in one fell swoop!
View HOWTO-Dissassociate-Xcode-From-All-File-Types.md

HOWTO: Disassociate/Unassociate File Types From a Mac App

I got super tired of Xcode opening everything: .rb, .sh, etc etc etc....

Here is how to stop Xcode from opening everything!

NOTE: It may be helpful to know that I found the lsregister command right here:

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Versions/Current/Support/lsregister
@lodestone
lodestone / .zshrc
Created Oct 4, 2018
My zshrc FZF environment variables
View .zshrc
export FZF_DEFAULT_COMMAND='fd --type file --color never'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_DEFAULT_OPTS='--height 50% --min-height=20 --prompt="◉ " --header="⌯⌯⌯⌯⌯⌯⌯⌯⌯⌯⌯⌯⌯⌯⌯⌯⌯⌯⌯⌯⌯⌯⌯⌯" --tabstop=2 --color="dark,fg:#fafafa,info:#555555,prompt:#ff4488,header:#9769c5,info:#8f94fa,border:#5a7ada,pointer:#b143c2,bg+:-1,hl+:#ff00ff,hl:#bc9fec"'
@lodestone
lodestone / Tip-2018-08-27.vim
Created Aug 27, 2018
Vim Tip 'o the Day 2018-08-27
View Tip-2018-08-27.vim
" Make backspace do something useful in normal mode:
" - Switch to previous buffer quickly
nnoremap <bs> :b#<CR>
" Make tab do something useful in normal mode:
" - Switch focus to next window.
nnoremap <tab> <c-w><c-w>
You can’t perform that action at this time.