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
| function getMaxPrefixAndSuffix(P) { | |
| let i = 0; | |
| let len = 0; | |
| for (let i = P.length - 1; i >= 0; --i) { | |
| if (P.slice(0, i) === P.slice(-i)) { | |
| return i; | |
| } | |
| } |
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
| modprobe br_netfilter | |
| modprobe ip6_udp_tunnel | |
| modprobe ip_set | |
| modprobe ip_set_hash_ip | |
| modprobe ip_set_hash_net | |
| modprobe iptable_filter | |
| modprobe iptable_nat | |
| modprobe iptable_mangle | |
| modprobe iptable_raw | |
| modprobe nf_conntrack_netlink |
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
| apiVersion: networking.istio.io/v1alpha3 | |
| kind: VirtualService | |
| metadata: | |
| name: reviews | |
| spec: | |
| hosts: | |
| - reviews | |
| http: | |
| - route: | |
| - destination: |
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
| set -xeo pipefail | |
| apt-get update -y | |
| apt-get install -y \ | |
| apt-transport-https \ | |
| ca-certificates \ | |
| curl \ | |
| software-properties-common | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - |
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
| docker rm -f $(sudo docker ps -aq); | |
| docker volume rm $(sudo docker volume ls -q); | |
| rm -rf /etc/ceph \ | |
| /etc/cni \ | |
| /etc/kubernetes \ | |
| /opt/cni \ | |
| /opt/rke \ | |
| /run/secrets/kubernetes.io \ | |
| /run/calico \ |
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
| #!/bin/bash | |
| echo "Container Linux installation script" | |
| echo "This will install:" | |
| echo " - Docker Community Edition" | |
| echo " - Docker Compose" | |
| echo " - Kubernetes: kubeadm, kubelet and kubectl" | |
| echo "" | |
| set -xeo pipefail |
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
| const shouldSizeMatch = compact( | |
| itShouldProp('width', large(20), always('width should large 20')), | |
| itShouldProp('height', large(20), always('height should large 20')) | |
| ); | |
| of({ width: 10, height: 30}) | |
| .map(shouldSizeMatch) | |
| .validate((success, reason) => { | |
| // reuse rules | |
| }) |
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
| function imageMatch(file) { | |
| return readImageAsPromise(file).then(image => { | |
| return of(image).map(itShouldProp('width', large(10), always('image width should large 10, now is ' + image.width))) | |
| }) | |
| } | |
| of({ filename: 'c:/fakepath/file.txt'}) | |
| .map(itShould(imageMatch, always('image not exists'))) | |
| .validate(( success, reason) => { | |
| // async validation just fun |
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 { of, always } from 'OverAssert'; | |
| function asyncCheckValidate(value) { | |
| return new Promise((resolve, reject) => { | |
| setTimeout(() => { | |
| if (value > 10) { | |
| resolve(); | |
| } else { | |
| reject(); | |
| } |
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 { of, itShouldPath, itShouldProp, equals, allPass, large, less, always } from 'OverAssert'; | |
| const data = { | |
| user: { | |
| name: 'Alice', | |
| id: 200 | |
| }, | |
| expireTime: 200, | |
NewerOlder