Skip to content

Instantly share code, notes, and snippets.

View ufo22940268's full-sized avatar
🎯
Focusing

Chao Cheng ufo22940268

🎯
Focusing
View GitHub Profile
//Invert a binary tree.
//
// Example:
//
// Input:
//
//
// 4
// / \
// 2 7
//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.
//
//
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;
}
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
DROP TABLE k;
CREATE TABLE k
(
a varchar,
b varchar,
role varchar,
UNIQUE (a, b)
);
DROP TABLE IF EXISTS act;
CREATE TABLE act
(
id serial PRIMARY KEY,
ranges int8range
);
INSERT INTO act(ranges)
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _pg = _interopRequireDefault(require("pg"));
var _serializeError = _interopRequireDefault(require("serialize-error"));
-- https://www.postgresql.org/docs/11/interactive/rangetypes.html
DROP TABLE IF EXISTS act;
CREATE TABLE act
(
id serial PRIMARY KEY,
ranges int8range[]
);
-- https://www.postgresql.org/docs/11/interactive/rangetypes.html
DROP TABLE IF EXISTS act;
CREATE TABLE act
(
id serial PRIMARY KEY,
ranges int8range[]
);
@ufo22940268
ufo22940268 / verify_site.sh
Created February 11, 2020 22:41
verify site url
#!/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)