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/knife exec | |
| # A knife exec script to change chef node's name, preserving all the attributes. | |
| # | |
| # Usage: knife exec rename-node.rb old-name new-name | |
| # | |
| # Script retrieves the Node object, changes its 'name' attribute, | |
| # creates new Node object with updated name and rest of attributes | |
| # untouched. Then it deletes old Node and Client objects from | |
| # database, and logs into the server to update it: | 
  
    
      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
    
  
  
    
  | #Model | |
| @user.should have(1).error_on(:username) # Checks whether there is an error in username | |
| @user.errors[:username].should include("can't be blank") # check for the error message | |
| #Rendering | |
| response.should render_template(:index) | |
| #Redirecting | |
| response.should redirect_to(movies_path) | 
  
    
      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 | |
| # Install fake erlang packages, then the ESL package | |
| # Afterwards, installing packages that depend on erlang, like rabbitmq, | |
| # will use the ESL packaged erlang without installing the older disto ones | |
| # | |
| apt-get install equivs | |
| # Create fake erlang packages, since we are using esl-erlang instead | |
| cd /tmp | |
| apt-get install -y equivs | 
  
    
      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
    
  
  
    
  | # By Oto Brglez - <[email protected]> | |
| # Read: | |
| # http://opennlp.apache.org/documentation/1.5.2-incubating/apidocs/opennlp-tools/index.html | |
| # http://opennlp.apache.org/documentation/1.5.2-incubating/manual/opennlp.html#tools.sentdetect.detection | |
| require 'bundler/setup' | |
| require 'ruby-debug' | |
| require 'pp' | 
  
    
      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
    
  
  
    
  | -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' | 
  
    
      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 | |
| # Refuse to commit files with the string NOCOMMIT, debugger, or merge markers present. | |
| # | |
| files=$(git diff-index --name-status --cached HEAD | grep -v ^D | cut -c3-) | |
| if [ "$files" != "" ] | |
| then | |
| for f in $files | |
| do | 
  
    
      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
    
  
  
    
  | vagrant@precise64:~$ irb | |
| 1.9.3-p484 :002 > require "riemann" | |
| => true | |
| # Activate maintenance-mode: | |
| 1.9.3-p484 :010 > Riemann::Client.new << {service: "maintenance-mode", host: "precise64", state: "active", ttl: Float::INFINITY} | |
| => nil | |
| # Deactivate maintenance-mode: | |
| 1.9.3-p484 :011 > Riemann::Client.new << {service: "maintenance-mode", host: "precise64", state: nil, ttl: Float::INFINITY} | |
| => nil | 
  
    
      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
    
  
  
    
  | # this monit config goes in /etc/monit/conf.d | |
| check process puma_master | |
| with pidfile /data/myapp/current/tmp/puma.pid | |
| start program = "/etc/monit/scripts/puma start" | |
| stop program = "/etc/monit/scripts/puma stop" | |
| group myapp | |
| check process puma_worker_0 | |
| with pidfile /data/myapp/current/tmp/puma_worker_0.pid | 
  
    
      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
    
  
  
    
  | (require 'riemann.common) | |
| (require 'clojure.pprint) | |
| (let [host "0.0.0.0"] | |
| (graphite-server :host host | |
| :port 5559) | |
| (tcp-server :host host) | |
| (udp-server :host host | |
| :max-size 65000) | |
| (repl-server :host host) | 
  
    
      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 RequestMacros | |
| def login_user(user = nil) | |
| user = create(:user, password: 'password') unless user | |
| # ensure password is valid when `user` is provided | |
| expect(user.valid_password?('password')).to be(true) | |
| # ensure user is confirmed | |
| user.confirm! |