This file contains hidden or 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 | |
| # https://www.haproxy.com/blog/multithreading-in-haproxy/ | |
| # https://thisinterestsme.com/speeding-up-haproxy-ssl-with-multiple-cpu-processes/ | |
| nbproc 1 | |
| nbthread 4 | |
| cpu-map auto:1/1-4 0-3 | |
| maxconn 1000 | |
| # SSL configurations |
This file contains hidden or 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
| // coin change kata | |
| fun largestCoin(coins: IntArray, amount: Int): Int? = | |
| try { | |
| coins.first { coin -> coin <= amount } | |
| } catch (_: NoSuchElementException) { | |
| null | |
| } | |
| fun coinChange(coins: IntArray, amount: Int): Int { |
This file contains hidden or 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
| kafka-connect: | |
| image: confluentinc/cp-kafka-connect | |
| depends_on: | |
| - zookeeper | |
| - kafka | |
| - schema-registry | |
| ports: | |
| - 8083:8083 | |
| - 8084:8084 | |
| volumes: |
This file contains hidden or 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 Error string | |
| func (e Error) Error() string { return string(e) } |
This file contains hidden or 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
| 2018-01-17 10:11:51 +0000 [info]: reading config file path="/etc/td-agent/td-agent.conf" | |
| 2018-01-17 10:11:51 +0000 [info]: starting fluentd-0.14.11 pid=1743 | |
| 2018-01-17 10:11:51 +0000 [info]: spawn command to main: cmdline=["/opt/td-agent/embedded/bin/ruby", "-Eascii-8bit:ascii-8bit", "/usr/sbin/td-agent", "--log", "/var/log/td-agent/td-agent.log", "--use-v1-config", "--group", "td-agent", "--daemon", "/var/run/td-agent/td-agent.pid", "--under-supervisor"] | |
| 2018-01-17 10:11:51 +0000 [info]: reading config file path="/etc/td-agent/td-agent.conf" | |
| 2018-01-17 10:11:51 +0000 [info]: starting fluentd-0.14.11 without supervision pid=1753 | |
| 2018-01-17 10:11:52 +0000 [info]: gem 'fluent-mixin-plaintextformatter' version '0.2.6' | |
| 2018-01-17 10:11:52 +0000 [info]: gem 'fluent-plugin-kafka' version '0.6.1' | |
| 2018-01-17 10:11:52 +0000 [info]: gem 'fluent-plugin-mongo' version '0.8.1' | |
| 2018-01-17 10:11:52 +0000 [info]: gem 'fluent-plugin-prometheus' version '1.0.0' | |
| 2018-01-17 10:11:52 +0000 [info]: gem 'fluent-plugin-prometheus' |
This file contains hidden or 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
| from collections import defaultdict | |
| def valid(L): | |
| d = defaultdict(int) | |
| for v in L: | |
| if d[v]: | |
| return False | |
| else: | |
| d[v] += 1 |
This file contains hidden or 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
| import math | |
| def coordinates(n): | |
| d = math.floor(0.5 * (math.sqrt(n - 1) + 1)) | |
| nsig = n - (4 * d ** 2 + 1) | |
| if nsig <= -2* d: | |
| return(d, 3*d+nsig) | |
| elif -2*d <= nsig <= 0: |
This file contains hidden or 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
| resource "aws_alb_target_group" "test" { | |
| name = "test-alb" | |
| port = 443 | |
| protocol = "HTTPS" | |
| vpc_id = "${aws_vpc.test.id}" | |
| deregistration_delay = 200 | |
| stickiness { | |
| type = "lb_cookie" | |
| cookie_duration = 10000 | |
| } |
This file contains hidden or 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
| def transform(input): | |
| return [int(x) for x in input] | |
| def consecutive(L): | |
| for prev, n in zip(L, L[1:] + L[:1]): | |
| if prev == n: | |
| yield n | |
| for v in [ "1122", "1111", "1234", "91212129"]: | |
| print(sum(transform(consecutive(v)))) |
This file contains hidden or 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
| version: "3" | |
| services: | |
| alertmanager: | |
| image: prom/alertmanager | |
| ports: ["9093:9093"] | |
| command: [ "-config.file=/etc/alertmanager/config.yml", "-storage.path=/alertmanager" ] | |
| networks: | |
| - backend |
NewerOlder