Eric Black elebertus

View gist:8624691
1 2 3 4 5 6 7 8 9 10
from datetime import date
import tornado.ioloop
import tornado.web
 
class VersionHandler(tornado.web.RequestHandler):
def get(self):
response = {
'version': '1.0.0',
'last_build': date.today().isoformat()
}
View gist:7036876
1 2 3 4 5 6 7 8 9 10
# attributes/default.rb
default[:foo] = "bar"
# chef environment
{
"override_attributes": {
"foo": nil
}
}
 
if node[:foo].nil?
View gist:6783856
1 2 3 4 5 6 7 8 9 10
module(load="omelasticsearch")
 
# this is for index names to be like: logstash-YYYY.MM.DD
template(name="logstash-index" type="list") {
constant(value="logstash-")
property(name="timereported" dateFormat="rfc3339" position.from="1" position.to="4")
constant(value=".")
property(name="timereported" dateFormat="rfc3339" position.from="6" position.to="7")
constant(value=".")
property(name="timereported" dateFormat="rfc3339" position.from="9" position.to="10")
View gist:5835498
1 2 3 4 5 6 7 8 9
def post(term)
uri = URI("http://api.urbandictionary.com/v0/define?")
params = {:term => term }
uri.query = URI.encode_www_form(params)
res = Net::HTTP.get_response(uri)
data = res.body
result = JSON.parse(data)
pp result['list'][1]['definition']
end
View gist:5725696
1 2 3 4 5 6 7 8 9
#eureka_connect.conf
{
"eureka_connect": {
"url": "http://33.33.33.20:8080/eureka/v2/apps/EUREKA-VAGRANT-001",
"get_header": "'Accept': 'application/json'",
"post_header": "'Content-Type': 'application/json'",
"timeout": 3
}
}
View gist:5224939
1 2 3 4 5 6 7 8 9 10
?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
 
<!-- Console Appender -->
<appender name="stdout-appender" class="org.apache.log4j.ConsoleAppender">
 
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%-5p | %d{MM-dd-yyyy HH:mm:ss.SSS} | %t | %c(0) - %m%n"/>
</layout>
View gist:4631070
1 2 3 4 5 6 7 8 9 10
action :sqlite3_gem do
begin
require 'sqlite3'
rescue LoadError
package "sqlite-devel" do
action :install
end
 
gem "sqlite3" do
action :install
View gist:4092734
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env ruby
require 'sqlite3'
db = SQLite3::Database.new( "test.db")
begin
db.query("SELECT * from dashboard_dashboard")
rescue
puts "dashboard_dashboard not found\nCreating table dashboard_dashboard\n"
db.execute("CREATE TABLE \"dashboard_dashboard\" (
\"name\" varchar(128) NOT NULL PRIMARY KEY,
\"state\" text NOT NULL);"
View gist:4083850
1 2 3 4 5 6 7 8 9 10
# LAX -> linode
[root@eblack-vagrant01 mtr-0.82]# mtr brofist.net --report-cycles 30 --report
HOST: eblack-vagrant01 Loss% Snt Last Avg Best Wrst StDev
1.|-- 10.0.2.2 0.0% 30 0.4 2.1 0.2 42.3 7.7
2.|-- 1-1-12-12.attalascom.net 0.0% 30 4.2 3.1 1.1 32.5 5.7
3.|-- cpe-76-173-0-1.socal.res. 0.0% 30 33.9 33.9 22.9 62.2 8.9
4.|-- tge7-1.wlvgcabn-cer02.soc 0.0% 30 17.6 15.5 11.5 32.5 5.0
5.|-- tge0-8-0-8.vnnycajz-ccr01 3.3% 30 23.5 27.4 18.5 78.6 13.1
6.|-- 72.129.13.0 0.0% 30 19.0 25.1 17.5 51.9 7.6
7.|-- 107.14.19.32 0.0% 30 21.6 24.3 16.7 52.7 7.0
View gist:4036273
1 2 3 4 5 6 7 8 9 10
action :start_stop do
begin
@new_resource.start_service(node[:service_status][:state])
rescue
Chef::Log.warn("----------")
Chef::Log.warn("Application default state is missing. Defaulting to start the service. If this cluster or service should not automatically start defined node[:service_status][:state]")
Chef::Log.warn("----------")
@new_resource.start_service("start")
@new_resource.env_state("start")
Something went wrong with that request. Please try again.