Skip to content

Instantly share code, notes, and snippets.

View faun's full-sized avatar
🌵

Faun faun

🌵
View GitHub Profile
@faun
faun / pre-commit
Last active August 29, 2015 14:09
Pre-commit hook
#!/bin/bash
## START PRECOMMIT HOOK
# Install with:
# ln -s ../../bin/pre-commit .git/hooks/pre-commit
files_modified=`git status --porcelain | egrep "^(A |M |R ).*" | awk ' { if ($3 == "->") print $4; else print $2 } '`
for f in $files_modified; do
if [[ $f == vendor/* ]]; then
echo "skipping $f"
@faun
faun / .env.example
Created August 30, 2014 08:23
Sample .env file for zinedistro
export DEVISE_SECRET_KEY='A REALLY LONG KEY'
export SECRET_TOKEN='A REALLY LONG KEY'
export SECRET_KEY_BASE='A REALLY LONG KEY'
export CARRIERWAVE_PROVIDER='AWS'
export CARRIERWAVE_AWS_ACCESS_KEY_ID='A REALLY LONG KEY'
export CARRIERWAVE_AWS_SECRET_ACCESS_KEY='A REALLY LONG KEY'
export CARRIERWAVE_REGION='us-west-1'
export CARRIERWAVE_ENDPOINT='https://s3-us-west-1.amazonaws.com/'
export CARRIERWAVE_HOST='https://s3.amazonaws.com'
export CARRIERWAVE_ASSET_HOST='http://assets.zinedistro.org'
@faun
faun / keybase.md
Created June 14, 2014 04:55
Keybase Verification

Keybase proof

I hereby claim:

  • I am faun on github.
  • I am faun (https://keybase.io/faun) on keybase.
  • I have a public key whose fingerprint is D4C9 FFB9 F1DC EF35 9E0A 3D0D 92D9 A892 2212 44C4

To claim this, I am signing this object:

@faun
faun / install_nokogiri_with_homebrew
Last active October 2, 2018 06:50
Install Nokogiri with Homebrew
#! /bin/sh
set -e
BREW_PREFIX="$(brew --prefix)"
BREW_CELLAR="${BREW_PREFIX}/Cellar"
function libxslt_version()
{
brew list --versions libxslt | awk '{ print $2 }'
}
@faun
faun / Gemfile
Last active August 29, 2015 14:01
Issue with Rails 4.1 has_many uniq through and order
source 'https://rubygems.org'
# gem 'activerecord', '4.0.5'
gem 'activerecord', '4.1.1'
gem 'pg'
@faun
faun / decrypt_pdfs_service.sh
Created April 29, 2014 09:15
Service to decrypt all selected PDFs. This script is intended for use in an automator workflow. Files and folders selected should be passed in as arguments.
#! /bin/sh
password=$(security 2> /dev/null find-generic-password -a login -s decrypt_pdfs -D "application password" -w)
set -e
decrypt_file () {
source_file="$1"
filename="$(basename "$source_file")"
directory="$(dirname "$source_file")/decrypted"
@faun
faun / decrypt_pdfs
Last active August 29, 2015 14:00
Decrypt all PDFs in a directory using the given password and optionally store the password in the Mac OS system keychain
#! /bin/sh
# Check if qpdf is installed
installed=$(which qpdf &> /dev/null)
if [ $? -eq 1 ]; then
echo >&2 "Please install qpdf first (brew install qpdf)"
exit 1
fi
# Fetch the password from the keychain
@faun
faun / steal.sh
Last active August 29, 2015 13:57 — forked from mislav/steal.sh
Download videos from youtube and add them to iTunes
#!/bin/sh
# Usage: steal <YOUTUBE-URL>
# Requirements: youtube-dl, ffmpeg
set -e
# strip the YouTube playlist
url="${1%%&*}"
if [ -z "$url" ]; then
echo "no URL given" >&2
@faun
faun / Gemfile
Last active January 1, 2016 04:28
Outdated gist related to https://github.com/rails/rails/issues/13304. Move along.
source 'https://rubygems.org'
gem 'activerecord', github: 'rails/rails'
gem 'sqlite3'
gem 'minitest', '~> 5.1'
@faun
faun / vim.rb
Created October 22, 2013 04:38 — forked from mgrouchy/vim.rb
Install with: brew install https://gist.github.com/faun/7095304/raw/1a08f9403196f9e493d8b7a037acff5ed9992348/vim.rb --enable-interp=python,ruby --with-features=big
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'https://vim.googlecode.com/hg/', :revision => '6c318419e331'
version '7.3.515'
def features; %w(tiny small normal big huge) end
def interp; %w(lua mzscheme perl python python3 tcl ruby) end