Regular expression is a group of characters or symbols which is used to find a specific pattern from a text.
A regular expression is a pattern that is matched against a subject string from left to right. The word "Regular expression" is a
const timeout = (ms) => new Promise(resolve => setTimeout(resolve, ms)) | |
function getJob(ms, id) { | |
return async function () { | |
return job(ms, id) | |
} | |
} | |
async function job(ms, id) { | |
await timeout(ms) |
upstream zen_zen-front_production_splitter { | |
keepalive 2; | |
server [2a02:06b8:0c00:3b10:0000:1452:7fb3:1e24]:80 max_fails=0 fail_timeout=60 weight=1; | |
server [2a02:06b8:0c08:f427:0000:1452:005d:5634]:80 max_fails=0 fail_timeout=60 weight=1; | |
check interval=5000 rise=2 fall=3 timeout=2000 default_down=false type=http; | |
check_http_send "GET /ok.html HTTP/1.0\r\n\r\n"; | |
check_http_expect_alive http_2xx; | |
} | |
match statusok { |
Думаю, очень круто было бы в начале предупредить, что знание тонкостей языка не так важно, | |
как умение размышлять и делать разумные предположения | |
1. Immutable strings | |
String a = "hello "; | |
String b = a; | |
a = a + "world!"; | |
System.out.println(b); |
''' | |
QuickSelect finds the kth smallest element of an array in linear time. | |
''' | |
def partition(arr): | |
left = [] | |
right = [] | |
if not arr: | |
return (left, right, None) |
''' | |
Given an array of integers containing duplicates, return the majority element in an array if present. A majority element appears more than n/2 times where n is the size of the array. | |
''' | |
def find_leader(arr): | |
''' | |
1. remove pairs of different elements from array | |
2. the element that still exists is a candidate | |
3. check majority of candidate, should be in len(arr) // 2 elements | |
''' |
CXX = g++-4.9 | |
CC = gcc-4.9 | |
DOXYGEN = doxygen | |
CFLAGS = -fdiagnostics-color=always -std=gnu11 -s -c -g3 -O3 -time | |
WARNINGS = -Werror -Wall -Wextra -pedantic-errors -Wformat=2 -Wno-import -Wimplicit -Wmain -Wchar-subscripts -Wsequence-point -Wmissing-braces -Wparentheses -Winit-self -Wswitch-enum -Wstrict-aliasing=2 -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wdisabled-optimization -Wunused-macros -Wno-unused | |
LDFLAGS = | |
LIBRARIES = -lcurl | |
SOURCES = main.c test.c | |
OBJECTS = $(SOURCES:.c=.o) | |
EXECUTABLE = test |
#!/bin/sh | |
# | |
# Automatically add branch name and branch description to every commit message except merge commit. | |
# | |
COMMIT_EDITMSG=$1 | |
addBranchName() { | |
BRANCH=$(git branch | grep '*' | sed 's/* //') | |
NAME=$(echo "$BRANCH" | sed -E 's/([A-Z]+-[0-9]+(--[A-Z]+-[0-9]+)?).*/\1/') |
package main | |
import ( | |
"flag" | |
"github.com/garyburd/redigo/redis" | |
"log" | |
"math/rand" | |
"os" | |
"time" | |
) |