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 | |
PIDS=$(ps | grep $1 | awk '{print $1}') | |
echo PIDS: $PIDS | |
for p in $PIDS | |
do | |
echo Killing pid $p | |
kill -9 $p |
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
check process resque_worker | |
with pidfile /home/USER_NAME/dp20/current/tmp/pids/resque_worker.pid | |
start program = "/usr/bin/env HOME=/home/USER_NAME RACK_ENV=production PATH=/usr/local/bin:/usr/local/ruby/bin:/usr/bin:/bin:$PATH /bin/sh -l -c 'cd /home/USER_NAME/dp20/current; nohup bundle exec rake environment resque:work RAILS_ENV=production QUEUES=record_event,update_counter_cache VERBOSE=1 PIDFILE=tmp/pids/resque_worker.pid & >> log/resque_worker.log 2>&1'" as uid USER_NAME and gid USER_NAME | |
stop program = "/bin/sh -c 'cd /home/USER_NAME/dp20/current && kill -9 $(cat tmp/pids/resque_worker.pid) && rm -f tmp/pids/resque_worker.pid; exit 0;'" | |
if totalmem is greater than 300 MB for 10 cycles then restart # eating up memory? | |
group resque_workers |
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 my_quicksort(array) | |
left = 0 | |
right = array.length - 1 | |
quicksort(array, left, right) | |
end | |
def quicksort(array, left, right) | |
if left < right | |
pivot_index = ((right + left).to_f / 2).ceil |
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
(use '[clojure.contrib.math :as math]) | |
(defn my_quicksort [array] | |
; Create a new mutable data structure | |
(def transientArray (transient array)) | |
(quicksort transientArray 0 (- (count array) 1)) | |
; Return an immutable data structure | |
(persistent! transientArray) |
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
RUBY_CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl` --with-readline-dir=`brew --prefix readline`" rbenv install 2.0.0-p195 |
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
# Complete the "my_each" method. | |
def my_each | |
end | |
describe "my_each" do | |
it "should let us iterate over a collection of objects and do stuff" do | |
students = [ | |
{ name: 'Rachael' }, | |
{ name: 'Josephina'}, |
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
# Complete the "my_each" method. | |
def my_each(collection) | |
length = collection.length | |
i = 0 | |
while i < length | |
yield(collection[i]) | |
i = i + 1 | |
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
require_relative './jukebox' | |
RSpec.configure do |config| | |
config.color_enabled = true | |
config.tty = true | |
# Use the specified formatter | |
config.formatter = :documentation # :progress, :html, :textmate | |
end | |
def capture_stdout(&block) |
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 'rspec' | |
# # Binary Secret Handshake | |
# > There are 10 types of people in the world: Those who understand binary, and those who don't. | |
# You and your fellow flatirons are of those in the "know" when it comes to binary decide to come up with a secret "handshake". | |
# ``` | |
# 1 = wink | |
# 10 = double blink |
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
@after_blocks = [] | |
def after_bundler(&block); @after_blocks << block; end | |
gem_group :development, :test do | |
gem "rspec-rails" | |
gem "factory_girl_rails" | |
gem "pry" | |
end | |
after_bundler do |
OlderNewer