Skip to content

Instantly share code, notes, and snippets.

@goofrider
goofrider / Gemfile_clean
Created September 13, 2013 23:13
Suspenders' templates/Gemfile_clean, which will be appended to the default generated projectname/Gemfile.
source 'https://rubygems.org'
gem 'airbrake'
gem 'bourbon'
gem 'coffee-rails'
gem 'delayed_job_active_record', '>= 4.0.0'
gem 'email_validator'
gem 'flutie'
gem 'high_voltage'
gem 'jquery-rails'
source 'https://rubygems.org'
# Ruby Version on Heroku
ruby '2.0.0'
# Puma (App server)
gem 'puma'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
// ==UserScript==
// @name Github Wiki Search
// @description Search wiki of the repository on Github.
// @namespace linyows
// @include https://github.com/*
// @namespace http://userscripts.org/scripts/show/129930
// @author linyows <[email protected]>
// @version 1.4.0
// ==/UserScript==
@goofrider
goofrider / multipass-tmexclude.sh
Last active September 24, 2020 19:22
Exclude VM instances and download cache in Ubuntu Multipass on Mac OS from Time Machine backup
## Exclude VM instances and download cache in Ubuntu Multipass on Mac OS from Time Machine backup
## Once you added them to the exclusion list they will show up in the Time Machine prefpane exclusion dialog.
sudo tmutil addexclusion -p /var/root/Library/Application\ Support/multipassd/vault/instances/
sudo tmutil addexclusion -p /var/root/Library/Caches/multipassd/
@goofrider
goofrider / to_json.rb
Created September 22, 2020 21:09
How to serializer Sawyer::Resource object to json?
# How to serializer Sawyer::Resource object to json?
# https://github.com/lostisland/sawyer/issues/34
require 'json'
sawyer_resource.map(&:to_h).to_json
@goofrider
goofrider / shell-one-liners.sh
Last active September 26, 2020 19:43
[shell one-liners] Some usefuel shell one-liners #shell #bash #zsh #sed
#### Remove YAML frontmatter. Requires GNU sed. OSX sed doesn't seem to work.
gsed '1 { /^---/ { :a N; /\n---/! ba; d} }
#### Remove '#' comments, empty lines and leading/trailing spaces
sed 's/#.*$//
s/[[:space:]]//g
/^$/d'
@goofrider
goofrider / brew-show-orphans.sh
Last active January 30, 2024 09:48
Show all orphaned Homebrew formulas installed on your system that are safe to uninstall
#! /bin/sh
# Homebrew doesn't remember which formulas are installed by user and
# which are installed as dependancies, and it doesn't uninstall dependancies
# when you uninstall a formula.
#
# This script will how you find orphaned formulas that were insatlled as dependecies
# but no londer needed because you've unsintalled the parent packages.
#
# Usage:
@goofrider
goofrider / jq-cheatsheet.sh
Last active September 26, 2020 19:42
[jq cheatsheet] Basic jq usage #jq #json
#### jq: sort by key value
jq '. | sort_by(.name)'
# Input
# [{name: "casey","age":54}, {"name": "Mary", "age":31}, {"name": "John", "age":20}]
# Output:
# [{"name": "John", "age": 20}, {"name": "Mary", "age":31}.{"name": "casey", "age":54}]
#### jq: filter by key value