['-']% curl -X PUT -d 'bar' http://127.0.0.1:8500/v1/kv/foo
true
['-']%
['-']%
['-']% curl -s http://127.0.0.1:8500/v1/kv/foo | jq .
[
{
"CreateIndex": 538,
"ModifyIndex": 538,
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
#!/usr/bin/env ruby | |
require "poppler" | |
require 'pp' | |
file = ARGV[0] | |
document = Poppler::Document.new(file) | |
document.each do |d| | |
puts d.get_text |
-
command
./consul-template_0.6.0_linux_amd64/consul-template -consul 127.0.0.1:8500 -template "/etc/hosts.ctmpl:/etc/hosts:service dnsmasq restart &"
-
/etc/hosts.ctmpl
# node{{ range nodes }}
{{.Address}} {{.Node}}{{ end }}
# service{{range $tag, $services := service "echo" | byTag}}
{{range $services}}{{.Address}} {{$tag}}.{{.Name}}{{end}}{{end}}
- /etc/hosts.ctmpl
{{range services}}
{{range service .Name}}
{{.Address}} {{.Name}}{{end}}{{end}}
- /etc/hosts
def database_configuration
path = paths["config/database"].existent.first
yaml = Pathname.new(path) if 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
#!/usr/bin/env ruby | |
require 'benchmark' | |
# Struct | |
s = Struct.new(:foo, :bar, :baz) | |
s = s.new(nil, nil, nil) | |
# Hash | |
h = {foo: nil, bar: nil, baz: nil} |
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
module Ruboty | |
module Handlers | |
class Test < Base | |
on( | |
/test\z/i, # "@ellen ping"に反応して | |
name: "test", # #pingメソッドが呼ばれる | |
description: "TTT" # これは"@ellen help"でhelpを表示したとき説明文として表示される | |
) | |
def test(message) |
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
#include <stdio.h> | |
int main() | |
{ | |
char str_a[20]; | |
str_a[0] = 'H'; | |
str_a[1] = 'e'; | |
str_a[2] = 'l'; | |
str_a[3] = 'l'; | |
str_a[4] = 'o'; | |
str_a[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
#include <stdio.h> | |
int main() | |
{ | |
char str_a[20]; | |
str_a[0] = 'H'; | |
str_a[1] = 'e'; | |
str_a[2] = 'l'; | |
str_a[3] = 'l'; | |
str_a[4] = 'o'; | |
str_a[5] = 0; |