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/ruby | |
# | |
# This scipt is designed to work with mock 1.2.0+ | |
require 'uri' | |
require 'shellwords' | |
class Mock | |
attr_reader :root | |
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
## drop this in the new file /etc/sudoers.d/sudoers-vagrant | |
## add add your user to the vagrant group | |
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports | |
Cmnd_Alias VAGRANT_NFSD_CHECK = /usr/bin/systemctl status nfs-server | |
Cmnd_Alias VAGRANT_NFSD_START = /usr/bin/systemctl start nfs-server | |
Cmnd_Alias VAGRANT_NFSD_APPLY = /usr/sbin/exportfs -ar | |
Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /bin/sed -r -e * d -ibak /etc/exports | |
%vagrant ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_NFSD_CHECK, VAGRANT_NFSD_START, VAGRANT_NFSD_APPLY, VAGRANT_EXPORTS_REMOVE |
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
# Change devise encryption strategy to match your existing authentication | |
# https://github.com/plataformatec/devise/tree/master/lib/devise/encryptors | |
class MigrateUsers < ActiveRecord::Migration | |
def self.up | |
rename_column :users, :crypted_password, :encrypted_password | |
add_column :users, :confirmation_token, :string, :limit => 255 | |
add_column :users, :confirmed_at, :timestamp | |
add_column :users, :confirmation_sent_at, :timestamp |
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 | |
# Backs up the OpenShift PostgreSQL database for this application | |
# by Skye Book <skye.book@gmail.com> | |
NOW="$(date +"%Y-%m-%d")" | |
FILENAME="$OPENSHIFT_DATA_DIR/$OPENSHIFT_APP_NAME.$NOW.backup.sql.gz" | |
pg_dump $OPENSHIFT_APP_NAME | gzip > $FILENAME |
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/sh | |
# TODO: parse & pass-through sudo options from $@ | |
sudo_options="-E" | |
scls=$X_SCLS | |
#available_scls="`scl --list | tr '\n' ' ' | sed 's/ $//'`" | |
for arg in "$@" | |
do | |
case "$arg" in | |
*\'*) |
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
require 'benchmark' | |
ActiveRecord::Base.logger = nil | |
Benchmark.bmbm do |bench| | |
bench.report("SQL query") do | |
1000.times { Whatever.count } | |
end | |
bench.report("exception hit") do |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> | |
<CORSRule> | |
<AllowedOrigin>*</AllowedOrigin> | |
<AllowedMethod>GET</AllowedMethod> | |
<AllowedMethod>POST</AllowedMethod> | |
<AllowedMethod>PUT</AllowedMethod> | |
<AllowedHeader>*</AllowedHeader> | |
</CORSRule> | |
</CORSConfiguration> |
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
require 'digest/md5' | |
require 'aws/s3' | |
#set your AWS credentials | |
AWS::S3::Base.establish_connection!( | |
:access_key_id => 'XXX', | |
:secret_access_key => 'XXX' | |
) | |
#get the S3 file (object) |
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
require 'HTTParty' | |
require 'terminal-display-colors' | |
require 'json' | |
# set your endpoints! | |
endpoints = { | |
"Google" => "http://google.com", | |
"Twitter" => "http://twitter.com" | |
} | |
# seconds to sleep between pings |
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
## | |
# Parallel test Runner for Rails | |
# | |
# This is a spike implementation for multi-process parallel testing with Rails. | |
# Only works with SQLite3 right now, and doesn't clean up. | |
# | |
# Here is an example of how to use it: | |
# | |
# ```ruby | |
# require 'forking_executor' |
OlderNewer