Skip to content

Instantly share code, notes, and snippets.

View brandonhilkert's full-sized avatar

Brandon Hilkert brandonhilkert

View GitHub Profile
class MegaLotto
NUMBERS = 5
def draw
NUMBERS.times.inject([]) do |arr, i|
arr << single_draw
end
end
private
require 'sinatra/base'
class FakeGitHub < Sinatra::Base
def simulate_error!
@@simulate_error = true
end
def reset!
@@simulate_error = false
end
#!/bin/bash
count=$(ls -l $1 | wc -l)
if test $count -gt 20
then
echo "Too many mails!"
exit 1
else
exit 0
# Usage: redis-cli publish message hello
require 'sinatra'
require 'redis'
conns = []
get '/' do
erb :index
end
#This is the /etc/init.d/mydaemon file
#!/usr/local/bin/bootup_ruby
APP_NAME = 'MyScript'
APP_PATH = '/my/daemon/file'
case ARGV.first
when 'start'
puts "Starting #{APP_NAME}..."
system(APP_PATH, 'start')
when 'stop'
- name: install service
shell: cd "{{ code_dir }}" && foreman export upstart /etc/init --app pipelinedeals --user {{ user }}
executable=/bin/bash
sudo: yes
failed: [ec2-50-19-17-38.compute-1.amazonaws.com] => {"changed": true, "cmd": "cd \"{{code_dir}}\" && foreman export upstart /etc/init --app pipelinedeals --user {{user}} ", "delta": "0:00:00.006165", "end": "2013-09-04 11:29:59.155728", "item": "", "rc": 1, "start": "2013-09-04 11:29:59.149563"}
stderr: /bin/bash: line 0: cd: {{code_dir}}: No such file or directory
- name: install service
shell: foreman export upstart /etc/init --app pipelinedeals --user {{ user }}
# I have a role called "app", here is the main.yml
---
- include: build_tools.yml
- include: source_code.yml
- include: service.yml
# source_code.yml
- name: bundle install
- name: get local time
shell: date +"%y-%m-%d-%H-%M"
register: local_time
# Launch 1 instances with the following parameters. Register the output.
- name: Launch instance
ec2: key_name={{ keypair }} group={{ security_group }}
instance_type={{ instance_type }} image={{ image }}
instance_tags='{"Name":"app-server-{{ local_time }}", "role":"ansible-app-server"}'
wait=yes count=1 id={{ machine_name }}
require 'formula'
class Ansible < Formula
homepage 'http://ansible.github.com/'
head 'https://github.com/ansible/ansible.git', :using => :git
url 'https://github.com/ansible/ansible/archive/v1.2.tar.gz'
depends_on 'python'
depends_on 'paramiko' => :python
depends_on 'jinja2' => :python
test:
override:
- case $CIRCLE_NODE_INDEX in 0) bundle exec spec spec/controllers ;; 1) bundle exec spec spec/models specs/processors ;; 3) bundle exec spec/lib spec/integration/integration spec/processors ;; esac:
parallel: true