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
; search path | |
(let ((default-directory "~/.emacs.d/")) | |
(normal-top-level-add-subdirs-to-load-path)) | |
; MELPA | |
(require 'package) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.milkbox.net/packages/") t) | |
; save desktop |
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
# First configure your models to use Amazon s3 as storage option and setup the associated S3 config. | |
# Then add the classes your want to migrate in the klasses array below. | |
# Then run rake paperclip_migration:migrate_to_s3 | |
# Should work but this is untested and may need some tweaking - but it did the job for me. | |
namespace :paperclip do | |
desc "migrate files from local filesystem to s3" | |
task :migrate_to_s3 => :environment do | |
Rails.application.eager_load! |
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
module JsonExpressionHelper | |
def either *klasses | |
Class.new(Object) do | |
@klasses = klasses | |
def self.===(other) | |
@klasses.reduce(false) { |memo, klass| memo ||= (other.class == klass) } | |
end | |
end | |
end | |
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
# USAGE: expect(some_object).to eq either(String, 5, { this: :hash }, @something_else) | |
def either *objs | |
Class.new(Object) do | |
@objs = objs | |
def self.===(other) | |
@objs.reduce(false) do |memo, obj| | |
memo ||= JsonExpressions::Matcher.new(obj).match(other) | |
end | |
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
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: oryx-batch | |
# Required-Start: $local_fs $network $named $time $syslog | |
# Required-Stop: $local_fs $network $named $time $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Description: Oryx 2 distributed lambda architecture - batch component | |
### END INIT INFO |
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
# Add postgresql repo and update apt listing | |
echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list > /dev/null | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get upgrade -y | |
sudo apt-get install postgresql-9.4 -y | |
# Stop all running postgresql servers -- needed for migration of 9.3 data to 9.4 (pg_upgrade execution) | |
sudo /etc/init.d/postgresql stop |
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
comm -23 <(rails r 'Rails.application.routes.routes.map{|r| "#{r.defaults[:controller].try(:camelize)}Controller##{r.defaults[:action]}"}.reject{|s| s == "Controller#"}.each{|s| puts s}' 2> /dev/null | sort | uniq) <(grep 'Processing by' log/test.log | sed 's/Processing by \(.*\) as .*/\1/' | sort | uniq) |
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
#!/bin/bash | |
if [ "$1" != "" ] && [ "$1" = "-h" ]; then | |
echo "Shipyard Deploy uses the following environment variables:" | |
echo " ACTION: this is the action to use (deploy, upgrade, node, remove)" | |
echo " DISCOVERY: discovery system used by Swarm" | |
echo " IMAGE: this overrides the default Shipyard image" | |
echo " PREFIX: prefix for container names" | |
echo " SHIPYARD_ARGS: these are passed to the Shipyard controller container as controller args" | |
echo " TLS_CERT_PATH: path to certs to enable TLS for Shipyard" |
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
function mycommand { | |
sleep 1 | |
} | |
PIDS=() | |
for i in $(seq 1 10); do | |
mycommand & PIDS+=($(echo $! | sed 's/^\[[0-9]*\]//')); | |
done | |
wait ${PIDS[*]} |
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
function escape_chars { | |
sed 's/"/""/g' | |
} | |
function format { | |
date=$(git log -n1 --pretty=format:%cD "$1" | escape_chars) | |
author=$(git log -n1 --pretty=format:'%aN <%aE>' "$1" | escape_chars) | |
sha=$(git log -n1 --pretty=format:%h "$1" | escape_chars) | |
message=$(git log -n1 --pretty=format:%B "$1" | escape_chars) | |
echo "\"$date\",\"$author\",\"$sha\",\"$message\"" | |
} |
OlderNewer