Skip to content

Instantly share code, notes, and snippets.

View lusis's full-sized avatar

John E. Vincent lusis

View GitHub Profile
@lusis
lusis / link_header.lua
Created December 6, 2014 04:29
Parsing the Link HTTP header with lpeg
@lusis
lusis / ngx.log
Created December 11, 2014 14:48
etcd watch + nginx dynamic lbs
2014/12/11 14:45:28 [info] 11#0: [lua] etcd.lua:41: list(): 11 got initial listing, context: ngx.timer
2014/12/11 14:45:28 [info] 11#0: [lua] etcd.lua:74: wait(): 11 initial backends list: {
["/lbs/backends/node3"] = "1.1.1.4",
["/lbs/backends/node5"] = "1.1.1.5"
}, context: ngx.timer
2014/12/11 14:45:58 [info] 11#0: [lua] etcd.lua:87: wait(): 11 got an error: timeout, context: ngx.timer
2014/12/11 14:45:58 [info] 11#0: [lua] etcd.lua:92: wait(): 11 lock held for 0, context: ngx.timer
2014/12/11 14:45:58 [info] 11#0: [lua] etcd.lua:64: wait(): 11 got lock, context: ngx.timer
2014/12/11 14:46:03 [info] 11#0: [lua] etcd.lua:106: wait(): 11 got a response on watch, context: ngx.timer
2014/12/11 14:46:03 [info] 11#0: [lua] etcd.lua:109: wait(): 11 adding new backend: /lbs/backends/node6 [1.1.1.7], context: ngx.timer
» touch tmp.rb
» /opt/chefdk/embedded/bin/ruby -W2 -c tmp.rb
/opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/defaults/operating_system.rb:15: warning: method redefined; discarding old user_dir
/opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/defaults.rb:75: warning: previous definition of user_dir was here
Syntax OK
»
robot.respond /rundeck (?:ad[ -]?hoc) ([\w -_]+) ([\w-]+)/i, (msg) ->
name = msg.match[1]
params = { argString: "-nodename #{msg.match[2].trim().toLowerCase()}" }
query = "?#{querystring.stringify(params)}"
robot.authorize msg, rundeck.adminRole, ->
rundeck.jobs().run name, query, (job, results) ->
if job
@lusis
lusis / conf.toml
Created August 20, 2015 00:47
sample config file idea
[modules.aws_backup]
enabled = false
[modules.aws_backup.options]
bucket = "sp-lb-backup"
encrypt = false
encryption_key = "s3kr1t!"
region = "us-east-1"
[modules.local_backup]
enabled = false
define host {
use linux-server
host_name oio
alias oio
address oio.mydomain.int
hostgroups webs
}
objfile.each_line do |line|
if line =~ /^define/
def_start, obj_type, open_brace = line.split
next
end
unless line =~ /\}/
obj_param, obj_val =- line.split(nil,2)
# Do something
end
end
4:
- name: us-holidays
- timeperiod_name: us-holidays
- alias: U.S. Holidays
- january: 1 00:00-00:00
- monday: -1 may 00:00-00:00
- july: 4 00:00-00:00
- monday: 1 september 00:00-00:00
- thursday: -1 november 00:00-00:00
- december: 25 00:00-00:00
class String
def rsplit(delim,count)
self.reverse.split(delim, count).map(&:reverse).reverse
end
end
No compatible versions could be found for required dependencies:
Conflict on: "i18n":
* i18n (0.4.1) activated by padrino (= 0.9.10, runtime)
* i18n (~> 0.3.6, runtime) required by activesupport (>= 3.0.0beta3, runtime)
All possible versions of origin requirements conflict. Conflict on: "activesupport":
* activesupport (3.0.pre) activated by activesupport (>= 3.0.0beta3, runtime)
* activesupport (= 3.0.0.beta3, runtime) required by ripple (= 0.7.1, runtime)
All possible versions of origin requirements conflict.