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 | |
set -e | |
INSTALLATION_SOURCE=instantclient_11_2 | |
ORACLE_CLIENT_VERSION=11.2.0.4.0 | |
ORACLE_INSTACLIENT_BASE=/usr/local/Oracle/product/instantclient | |
ORACLE_INSTALL_HOME=$ORACLE_INSTACLIENT_BASE/$ORACLE_CLIENT_VERSION | |
echo "Extracting..." |
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 | |
# place in .git/hooks/prepare-commit-msg | |
branch_name = `git rev-parse --abbrev-ref HEAD` | |
commit_file = ARGV.first | |
first_line = File.open(commit_file, &:readline) | |
if first_line.strip.empty? && (match = branch_name.match(/(^.*\d+)/i)) |
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
# Lets say we need to have a list of all our states | |
# we could do it like this | |
ON = 'on' | |
OFF = 'off' | |
CLOSED = 'closed' | |
STATES = [ON, OFF, CLOSED] | |
# but adding a new state means adding it in 2 places |
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
# specs and cukes results are stored in JUnit format under test-reports | |
if (grep 'failures="[^0]"' test-reports/* || grep 'errors="[^0]"' test-reports/*); then | |
curl -H "Authorization: token MY_TOKEN" --request POST --data '{"state": "failure", "description": "Failed!", "target_url": "${bamboo.buildResultsUrl}"}' https://api.github.com/repos/USER/REPO/statuses/${bamboo.repository.revision.number} > /dev/null | |
else | |
curl -H "Authorization: token MY_TOKEN" --request POST --data '{"state": "success", "description": "Success!", "target_url": "${bamboo.buildResultsUrl}"}' https://api.github.com/repos/USER/REPO/statuses/${bamboo.repository.revision.number} > /dev/null | |
fi |
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 bash | |
pacman -Syyu | |
pacman -S ruby rsync base-devel | |
gem install chef ruby-shadow --no-ri --no-rdoc --no-user-install |
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
group :production do | |
gem 'unicorn' | |
# Enable gzip compression on heroku, but don't compress images. | |
gem 'heroku-deflater' | |
# Heroku injects it if it's not in there already | |
gem 'rails_12factor' | |
end |
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 bash | |
# kill all connections to the postgres server | |
if [ -n "$1" ] ; then | |
where="where pg_stat_activity.datname = '$1'" | |
echo "killing all connections to database '$1'" | |
else | |
echo "killing all connections to database" | |
fi | |
cat <<-EOF | psql -U postgres -d postgres |
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 bash | |
apt-get -y update | |
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev htop tmux | |
cd /tmp | |
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.gz | |
tar -xvzf ruby-1.9.3-p327.tar.gz | |
cd ruby-1.9.3-p327/ | |
./configure --prefix=/usr/local | |
make | |
make install |
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
def try_all_permutations(word, dictionary, pos) | |
if word[pos].nil? | |
raise "Position #{pos} not in word list" | |
elsif pos == (word.length - 1) | |
puts word if dictionary.member? word | |
else | |
try_all_permutations(word, dictionary, pos+1) | |
for i in ((pos+1)..(word.length-1)) | |
word[i], word[pos] = word[pos], word[i] |
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 'pusher' | |
class PlayerConnection | |
attr_reader :player, :username, :web_socket, :broadcast_id | |
def initialize(player:, web_socket:) | |
@player = player | |
@web_socket = web_socket | |
end |
NewerOlder