Mix.install([
{:explorer, "~> 0.5.0"},
{:vega_lite, "~> 0.1.4"},
{:kino_vega_lite, "~> 0.1.1"}
])
Example: "one plus two times four"
- numbers are [zero-ten]
- numbers can be negative, for example: "negative five"
- "plus" and "times" are the only supported operations natural order of operations apply, multiply before add.
- "negative" is optional string before the number and is not an operation "one minus two" is expressed as "one plus negative two"
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
# example 1: adopting default values and trying to not break things | |
def adapter(action) | |
action = action.to_sym unless action.is_a?(Symbol) | |
batch = { | |
active_products: "ProductsActive", | |
inactive_products: "ProductsInactive", | |
download_products: "ProductsDownload" | |
} | |
batch.fetch(action, "UnknownAction") | |
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
#!/usr/bin/env ruby | |
begin | |
require "bundler/inline" | |
rescue LoadError => e | |
puts "You should install bundler with >= 1.10.3 version." | |
puts "* Current Ruby: #{`ruby -v`}" | |
puts "* Current Bundler: #{`gem list bundler`}" | |
puts "* Original Exception: \"#{e.message}\"" | |
exit 1 |
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
UNIT MACHINE ACTIVE SUB | |
api_v28.web.1.service 15499c5f.../10.21.2.149 active running | |
dashboard_v34.web.1.service c98d2f7c.../10.21.1.230 active running | |
deis-builder.service 15499c5f.../10.21.2.149 activating start-post | |
deis-cache.service c98d2f7c.../10.21.1.230 active running | |
deis-controller.service 15499c5f.../10.21.2.149 active running | |
deis-database.service 25992000.../10.21.1.229 active running | |
deis-logger.service 25992000.../10.21.1.229 active running | |
deis-logspout.service 15499c5f.../10.21.2.149 active running | |
deis-logspout.service 25992000.../10.21.1.229 active running |
RubyConf 2014 - Build the Unified Logging Layer with Fluentd and Ruby by Kiyoto Tamura
Fluentd is a data collector written in Ruby to solve this problem. Unlike other log management tools that are designed for a single backend system, Fluentd aims to connect many input sources into several output systems.
This talk surveys Fluentd's architecture and shows real-world use cases of how different users extend it to do more with their logs with less code.
Skynet Project – monitor, scale and auto-heal a system in the Cloud
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 "csv" | |
require "date" | |
puts CSV::HeaderConverters.keys.inspect # => [:downcase, :symbol] | |
# Add new header converter | |
CSV::HeaderConverters[:remap] = lambda do |raw_value| | |
raw_value = raw_value.to_sym | |
case raw_value | |
when :country |
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/bash | |
URL=http://localhost:8080 | |
## Unit-Testable Shell Scripts (http://eradman.com/posts/ut-shell-scripts.html) | |
typeset -i tests_run=0 | |
function try { this="$1"; } | |
trap 'printf "$0: exit code $? on line $LINENO\nFAIL: $this\n"; exit 1' ERR | |
function assert { | |
let tests_run+=1 |
NewerOlder