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
package main | |
import "fmt" | |
type Point struct { | |
x float64 | |
y float64 | |
} | |
func LeastSquaresMethod(points *[]Point) (a float64, b float64){ |
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
schema_path = Rails.root.join("config/openapi.yaml").to_s | |
config.middleware.use Committee::Middleware::RequestValidation, | |
schema_path: schema_path, | |
params_key: 'action_dispatch.request.request_parameters' |
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
# frozen_string_literal: true | |
source "https://rubygems.org" | |
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } | |
gem "committee" | |
gem "sinatra" | |
gem "pry" | |
gem "pry-byebug" |
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 'benchmark' | |
require "committee" | |
COUNT = 10000 | |
noop = Proc.new {[200, {}, ["hello"]]} | |
middleware = Committee::Middleware::RequestValidation.new(noop, schema_path: 'demo.yaml') | |
# warmup | |
request = Rack::MockRequest.new(middleware) |
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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
"github.com/DATA-DOG/go-txdb" | |
"github.com/jinzhu/gorm" |
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
out = [] | |
document.getElementsByClassName("css-1dbjc4n r-1l7z4oj r-ymttw5")[0].children.forEach(c => { | |
if (c.children.length == 1) { return; } // header | |
datetime = c.children[0].innerText.split("\n")[0]; | |
s = c.children[2].innerText.split("\n"); | |
title = s[0] | |
type = s[1] | |
price = c.children[3].innerText.split("\n")[0]; | |
out.push(datetime + "," + type + "," + title + "," + price); | |
}); |
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
# return path for validation, if return nil we doesn't validation | |
def validation_path_hook(request) | |
# only | |
# request.path.start_with?('/something') ? request.path : nil | |
# except | |
# request.path.start_with?('/something') ? nil : request.path | |
# prefix option (/v1/test => /test) | |
# request.path.gsub(/^\/v1/, "") |
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
% ./alertmanager --log.level=debug | |
level=info ts=2019-10-05T12:41:23.678Z caller=main.go:217 msg="Starting Alertmanager" version="(version=0.19.0, branch=HEAD, revision=7aa5d19fea3f58e3d27dbdeb0f2883037168914a)" | |
level=info ts=2019-10-05T12:41:23.678Z caller=main.go:218 build_context="(go=go1.12.8, user=root@587d0268f963, date=20190903-15:04:14)" | |
level=debug ts=2019-10-05T12:41:23.678Z caller=cluster.go:149 component=cluster msg="resolved peers to following addresses" peers= | |
level=info ts=2019-10-05T12:41:23.679Z caller=cluster.go:161 component=cluster msg="setting advertise address explicitly" addr=192.168.11.8 port=9094 | |
level=debug ts=2019-10-05T12:41:23.681Z caller=delegate.go:230 component=cluster received=NotifyJoin node=01DPDZ0PYZT9KRQ6MWV5SCAFKM addr=192.168.11.8:9094 | |
level=debug ts=2019-10-05T12:41:23.681Z caller=cluster.go:233 component=cluster msg="joined cluster" peers=0 | |
level=info ts=2019-10-05T12:41:23.681Z caller=cluster.go:623 component=cluster msg="Waiting for gossip to settle..." interval=2s | |
l |
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
level=info ts=2019-10-05T12:41:33.693Z caller=cluster.go:640 component=cluster msg="gossip settled; proceeding" elapsed=10.01120645s | |
level=debug ts=2019-10-05T12:42:47.040Z caller=dispatch.go:104 component=dispatcher msg="Received alert" alert=server-status[83e172c][active] | |
level=debug ts=2019-10-05T12:42:57.045Z caller=dispatch.go:432 component=dispatcher aggrGroup="{}:{alertname=\"server-status\"}" msg=flushing alerts=[server-status[83e172c][active]] | |
level=debug ts=2019-10-05T12:43:07.048Z caller=dispatch.go:432 component=dispatcher aggrGroup="{}:{alertname=\"server-status\"}" msg=flushing alerts=[server-status[83e172c][active]] | |
level=debug ts=2019-10-05T12:43:17.050Z caller=dispatch.go:432 component=dispatcher aggrGroup="{}:{alertname=\"server-status\"}" msg=flushing alerts=[server-status[83e172c][active]] |
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
global: | |
resolve_timeout: 5m | |
slack_api_url: "https://hooks.slack.com/services/xxx" | |
route: | |
group_by: ['alertname'] | |
group_wait: 10s | |
group_interval: 10s | |
repeat_interval: 1h | |
receiver: 'slack' |
NewerOlder