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
bavan@ubuntu:~$ mtr --report -n -c 10 mywifi.polkaspots.com | |
HOST: ubuntu Loss% Snt Last Avg Best Wrst StDev | |
1.|-- 10.0.1.1 0.0% 10 1.4 1.8 1.3 4.0 0.8 | |
2.|-- 10.0.4.1 0.0% 10 2.7 2.2 1.7 2.7 0.4 | |
3.|-- 46.37.56.1 0.0% 10 41.9 28.2 23.0 41.9 5.9 | |
4.|-- 46.37.32.234 0.0% 10 23.5 25.6 22.9 33.7 3.8 | |
5.|-- 93.89.94.149 10.0% 10 23.3 41.5 23.3 70.9 18.3 | |
6.|-- 93.89.91.14 0.0% 10 25.4 31.4 22.7 62.5 12.8 | |
7.|-- 212.187.200.101 20.0% 10 57.8 34.2 23.4 57.8 13.4 | |
8.|-- 4.69.139.120 0.0% 10 30.5 32.2 23.1 50.9 10.5 |
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
** Node Operations ** | |
knife node list | |
knife node delete name_of_server | |
knife node bulk delete name_of_server | |
knife node run_list add name_of_server 'recipe[nginx]' | |
knife node run_list remove name_of_server 'role[iptables]' | |
** Deploy ** |
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 | |
USER=deploy | |
APP_ROOT="/var/www/html/deploy/production/current" | |
ENV=production | |
GEM_HOME="/home/deploy/.rvm/gems/ruby-2.0.0-p247" | |
UNICORN_OPTS="-c /config/unicorn_production.rb" | |
SET_PATH="cd $APP_ROOT; export GEM_HOME=$GEM_HOME" | |
CMD="$SET_PATH; $GEM_HOME/bin/unicorn $UNICORN_OPTS" | |
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
task :reindex => :environment do | |
require 'ansi/progressbar' | |
params = {} | |
@date = Time.now.strftime '%Y%m%d%H%M%S' | |
def delete_index(index) | |
puts "[IMPORT] Deleting index '#{index.name}'" | |
index.delete | |
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
server { | |
listen 8443 default ssl; | |
server_name www.yourdomain.com; | |
ssl on; | |
ssl_certificate /etc/nginx/conf.d/cert.pem; | |
ssl_certificate_key /etc/nginx/conf.d/cert.key; | |
client_max_body_size 50M; | |
error_log /var/log/nginx/elasticsearch-errors.log; |
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
#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 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
> curl https://api.stripe.com/v1/customers \ | |
-u [apikey]: \ | |
-d "card[number]=4000000000000002" \ | |
-d "card[exp_month]=12" \ | |
-d "card[exp_year]=2015" \ | |
-d "card[cvc]=123" \ | |
> -d validate=false | |
{ | |
"object": "customer", | |
"created": 1388967139, |
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
describe "elastic search" do | |
let (:fw) {create :firmware} | |
before(:all) do ## SOMETIMES BEFORE EACH ## | |
Nas.index.delete | |
Nas.create_elasticsearch_index | |
end | |
it "should output nice json for nas session search" 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
language: ruby | |
cache: | |
bundler: true | |
apt: true | |
rvm: | |
- 2.0.0 | |
env: | |
# - TESTFOLDER=spec/models | |
# - TESTFOLDER=spec/controllers | |
# - TESTFOLDER=spec/routing |
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 "amqp" | |
error_handler = Proc.new do |settings| | |
puts "Failed to connect." | |
EM.stop | |
end | |
Thread.new { AMQP.start( | |
:port => 5672, | |
:vhost => '/', |