Skip to content

Instantly share code, notes, and snippets.

@cabecada
cabecada / Gemfile
Created July 20, 2016 18:44 — forked from ctalkington/Gemfile
Nginx, Sinatra, and Puma.
source :rubygems
gem "puma"
gem "sinatra"
@cabecada
cabecada / spec.rb
Created September 1, 2016 19:35
example spec
root@ubuntu1404-4:/var/tmp/serverspec# cat spec/localhost/sample_spec.rb
require 'spec_helper'
describe package('sensu') do
it { should be_installed }
end
describe package('sensu-plugin') do
it { should be_installed.by('gem').with_version('1.3.1') }
end
@cabecada
cabecada / .rb
Last active September 17, 2016 20:27
stash_to_silencing
#!/opt/sensu/embedded/bin/ruby
require 'net/http'
require 'json'
def get_uri(url)
URI(url)
end
@cabecada
cabecada / .rb
Created September 22, 2016 13:22
stash_to_silenced_migrate
#!/opt/sensu/embedded/bin/ruby
require 'net/http'
require 'json'
module Sensu
class Api
attr_reader :server, :port
def initialize(server='localhost', port=4567)
@cabecada
cabecada / update.rb
Last active October 20, 2016 04:44
update client subscriptions
#!/opt/sensu/embedded/bin/ruby
require 'net/http'
require 'json'
require 'optparse'
module Sensu
class Api
attr_reader :server, :port
def initialize(server='localhost', port=4567)
#!/opt/sensu/embedded/bin/ruby
require 'net/http'
require 'json'
require 'optparse'
module Sensu
class Api
attr_reader :server, :port
def initialize(server='localhost', port=4567)
@cabecada
cabecada / gist:9c73fa47fdad31ce97d333315cda946b
Created January 13, 2017 18:26 — forked from Atem18/gist:4696071
Tutorial to seting up a django website in production.

******************************************************************** Set up Django, Nginx and Gunicorn in a Virtualenv controled by Supervisor********************************************************************

Steps with explanations to set up a server using:

  • Virtualenv
  • Virtualenvwrapper
  • Django
  • Gunicorn
@cabecada
cabecada / gist:d6940042b1bb9f5ede3df4438f1e65e3
Created January 25, 2017 15:00
Puppet erb converts int to str in yaml dump
root@master:/etc/puppet# cat /tmp/modules/foo/templates/foo
<%-
def yaml_indent(conds)
return_val = []
tmp_val = conds.to_yaml.split("\n")
tmp_val.delete('---')
tmp_val.each do |val|
return_val << " " + val
end
return_val.join("\n")
@cabecada
cabecada / mongodb_3.2.x_sharding.md
Created January 30, 2017 09:54 — forked from leommoore/mongodb_3.2.x_sharding.md
MongoDB 3.2.x Sharding

#MongoDB 3.2.x Sharding Sharding is used when the database is too large to run on a single server and you need to spread the load across multiple servers. The name itself refers to the breaking (sharding) of the data into seperate groups of data which will reside on different servers.

##Configuration Server Start the server on your server (myserver0)

mongod --configsvr --dbpath /data

On myserver1 start the shard giving the configuration server as the --configdb option

input {
beats {
port => 5144
codec => json
}
}
filter {