View safe_exit.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// Catches the SIGTERM given by ^C and waits until the end of the loop to quit. | |
import ( | |
"fmt" | |
"os" | |
"os/signal" | |
"syscall" | |
"time" |
View git-prompt.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bash/zsh git prompt support | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org> | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# This script allows you to see repository status in your prompt. | |
# | |
# To enable: | |
# | |
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh). |
View lbcf.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title":"The London Baptist Confession of Faith", | |
"year":1689, | |
"chapters":{ | |
"1":{ | |
"title":"Of the Holy Scriptures", | |
"paragraphs":{ | |
"1":"The Holy Scripture is the only sufficient, certain, and infallible rule of all saving Knowledge, Faith and Obedience; Although the light of Nature, and the works of Creation and Providence do so far manifest the goodness, wisdom and power of God, as to leave men unexcusable; yet are they not sufficient to give that knowledge of God and His will, which is necessary unto Salvation. Therefore it pleased the Lord at sundry times, and in divers manners, to reveal himself, and to declare that His will unto his Church; and afterward for the better preserving, and propagating of the Truth, and for the more sure Establishment, and Comfort of the Church against the corruption of the flesh, and the malice of Satan, and of the World, to commit the same wholly unto writing; which maketh the Holy Scriptures to be most necessary, those former ways of Gods revealing his will |
View book.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
BOOKS = ['Genesis', 'Exodus', 'Leviticus', 'Numbers', 'Deuteronomy', 'Joshua', 'Judges', 'Ruth', '1 Samuel', '2 Samuel', '1 Kings', '2 Kings', '1 Chronicles', '2 Chronicles', 'Ezra', 'Nehemiah', 'Esther', 'Job', 'Psalms', 'Proverbs', 'Ecclesiastes', 'Song of Solomon', 'Isaiah', 'Jeremiah', 'Lamentations', 'Ezekiel', 'Daniel', 'Hosea', 'Joel', 'Amos', 'Obadiah', 'Jonah', 'Micah', 'Nahum', 'Habakkuk', 'Zephaniah', 'Haggai', 'Zechariah', 'Malachi', 'Matthew', 'Mark', 'Luke', 'John', 'Acts', 'Romans', '1 Corinthians', '2 Corinthians', 'Galatians', 'Ephesians', 'Philippians', 'Colossians', '1 Thessalonians', '2 Thessalonians', '1 Timothy', '2 Timothy', 'Titus', 'Philemon', 'Hebrews', 'James', '1 Peter', '2 Peter', '1 John', '2 John', '3 John', 'Jude', 'Revelation'].freeze | |
books = BOOKS.map{ |b| b.gsub(' ', '') }.sort | |
partials = {} | |
shortest = {} | |
i = 0 |
View remove_trailing_whitespace.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git diff --cached --no-color > stage.diff && \ | |
git apply --index -R stage.diff && \ | |
git apply --index --whitespace=fix stage.diff &> log.txt && \ | |
removals=$(egrep -v '(stage.diff:|warning:)' log.txt | wc -l | tr -d '[[:space:]]') && \ | |
echo "whitespace removed from $removals line$([ $removals -ne 1 ] && echo 's')" && \ | |
rm -f stage.diff log.txt |
View jira-prepare-commit-msg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
=begin | |
# Git "Prepare Commit Message" Hook Script | |
# Description | |
This script will automatically add the correct JIRA task ID to the | |
beginning of each commit message when the branch name has the JIRA task ID. | |
It can be overridden if specified in the message. |
View pivotal-prepare-commit-msg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
=begin | |
# Git "Prepare Commit Message" Hook Script | |
# Description | |
This script will automatically add the correct Pivotal Story ID to the | |
beginning of each commit message when the branch name has the Pivotal Story ID. | |
It can be overridden if specified in the message. |
View is_livable.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Setup: | |
# * Put this file in lib | |
# * Put `require 'is_livable'` in an initializer | |
# | |
# Usage: | |
# * Within a class like Post, do something like | |
# `is_livable :released_at, status: APPROVED` | |
# * Then you can do | |
# `Post.live, Post.not_live, Post.first.live?` |
View itunes-artists-with-one-song.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use v5.10; | |
use Mac::iTunes::Library; | |
use Mac::iTunes::Library::XML; | |
use Mac::iTunes::Library::Playlist; | |
my $library = Mac::iTunes::Library::XML->parse(@ARGV[0]); | |
my %results; | |
my %items = $library->items(); |
View git-blame-colored
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Colorize string | |
class String | |
def colorize(color_code) | |
"\e[#{color_code}m#{self}\e[0m" | |
end | |
end | |
class Colors |