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
| //Invert a binary tree. | |
| // | |
| // Example: | |
| // | |
| // Input: | |
| // | |
| // | |
| // 4 | |
| // / \ | |
| // 2 7 |
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
| //Given a string s containing just the characters '(', ')', '{', '}', '[' and '] | |
| //', determine if the input string is valid. | |
| // | |
| // An input string is valid if: | |
| // | |
| // | |
| // Open brackets must be closed by the same type of brackets. | |
| // Open brackets must be closed in the correct order. | |
| // | |
| // |
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
| let count = (s) => { | |
| return Array(s.length) | |
| .fill(0) | |
| .reduce((accu, _, i) => { | |
| const c = s[i]; | |
| if (!accu[c]) { | |
| accu[c] = 1; | |
| } else { | |
| accu[c] += 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
| version: "3.5" | |
| services: | |
| es: | |
| image: docker.elastic.co/elasticsearch/elasticsearch:6.5.1 | |
| container_name: es | |
| ports: | |
| - 9200:9200 | |
| - 9300:9300 | |
| environment: | |
| - discovery.type=single-node |
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
| DROP TABLE k; | |
| CREATE TABLE k | |
| ( | |
| a varchar, | |
| b varchar, | |
| role varchar, | |
| UNIQUE (a, b) | |
| ); | |
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
| DROP TABLE IF EXISTS act; | |
| CREATE TABLE act | |
| ( | |
| id serial PRIMARY KEY, | |
| ranges int8range | |
| ); | |
| INSERT INTO act(ranges) |
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
| "use strict"; | |
| Object.defineProperty(exports, "__esModule", { | |
| value: true | |
| }); | |
| exports.default = void 0; | |
| var _pg = _interopRequireDefault(require("pg")); | |
| var _serializeError = _interopRequireDefault(require("serialize-error")); |
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
| -- https://www.postgresql.org/docs/11/interactive/rangetypes.html | |
| DROP TABLE IF EXISTS act; | |
| CREATE TABLE act | |
| ( | |
| id serial PRIMARY KEY, | |
| ranges int8range[] | |
| ); |
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
| -- https://www.postgresql.org/docs/11/interactive/rangetypes.html | |
| DROP TABLE IF EXISTS act; | |
| CREATE TABLE act | |
| ( | |
| id serial PRIMARY KEY, | |
| ranges int8range[] | |
| ); |
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
| #!/usr/bin/env bash | |
| function get_ip { | |
| host=$(echo $1 | perl -wne '/(^.+\/\/)?(.+)/ and print $2') | |
| ip=$(dig +short ${host}) | |
| echo $ip | |
| } | |
| function verify_site_url { | |
| site_ip=$(get_ip $1) |