This file contains hidden or 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
TerminalNotifier.notify("Awaiting input for deploy: #{filter}") | |
print 'Continue with deploy? (y/n): ' | |
res = $stdin.gets.strip | |
raise unless res == 'y' | |
# Hide input | |
print "Please enter password for #{user}: " | |
password = STDIN.noecho(&:gets).chomp |
This file contains hidden or 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
# see http://ascii-table.com/ansi-escape-sequences.php | |
def alert(str) | |
puts "\e[36;1m***** #{str}\e[0m" | |
end |
This file contains hidden or 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
$ git branch -r --merged | | |
grep origin | | |
grep -v '>' | | |
grep -v master | | |
xargs -L1 | | |
awk '{split($0,a,"/"); print a[2]}' | | |
xargs git push origin --delete |
This file contains hidden or 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
# cron | |
* * * * * ~/yard/restart_server > ~/yard/restart_server.log 2>&1 | |
# restart_servers | |
#! /usr/bin/env bash | |
echo 'Killing yard server...' | |
ps aux | grep 'yard server' | grep -v 'grep' | awk '{ print $2 }' | xargs kill | |
echo 'Pulling new code...' | |
cd /home/vagrant/yard && git pull | |
echo 'Starting yard server...' |
This file contains hidden or 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
git fetch --all -p; git branch -vv | grep ": gone]" | awk '{ print $1 }' | xargs -n 1 git branch -d |
This file contains hidden or 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
# /etc/nginx/sites-enabled/default.conf | |
upstream unicorn_server { | |
# Path to Unicorn SOCK file, as defined previously | |
server unix:/home/vagrant/buildo/tmp/sockets/unicorn.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name localhost; |
This file contains hidden or 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
require 'minitest/autorun' | |
class Minitest::Test | |
def assert_performance(current_performance) | |
self.assertions += 1 # increase Minitest assertion counter | |
benchmark_name, current_average, current_stddev = *current_performance | |
past_average, past_stddev = load_benchmark(benchmark_name) | |
save_benchmark(benchmark_name, current_average, current_stddev) |
This file contains hidden or 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
require 'benchmark' | |
def performance_benchmark(name, &block) | |
# 31 runs, we'll discard the first result | |
(0..30).each do |i| | |
# force GC in parent process to make sure we reclaim | |
# any memory taken by forking in previous run | |
GC.start | |
# fork to isolate our run |
This file contains hidden or 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
# Measures runtime, memory usage, | |
# of GC calls | |
class Measurer | |
require "json" | |
require "benchmark" | |
def self.measure(opts = {}, &block) | |
use_gc = opts.has_key?(:use_gc) ? opts[:use_gc] : true | |
if use_gc | |
# collect memory allocated during library loading |
This file contains hidden or 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
:CtrlP . | |
:CtrlP ~/.rbenv |