This file contains 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 deque #deque是一个实现了双端栈的list,popleft和appendleft。 | |
def battle(bf, l=None, r=None): | |
# print('====================') | |
l = l or deque() | |
r = r or deque() | |
temp = deque() | |
i = 0 | |
_len = len(bf) |
This file contains 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 run --rm -ti bitnami/kafka bash | |
ZOOKEEPER_SERVER=localhost:2181 | |
BOOTSTRAP_SERVER=localhost:9092 | |
TOPIC_NAME=test | |
# 列出Topic | |
kafka-topics.sh --zookeeper $ZOOKEEPER_SERVER --list | |
kafka-topics.sh --zookeeper z-1.deleteme2.uhawi6.c3.kafka.cn-northwest-1.amazonaws.com.cn:2181 --list |
This file contains 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 aws_cdk import ( | |
aws_ec2, | |
aws_iam, | |
aws_eks, | |
aws_elasticache, | |
aws_msk, | |
core, | |
) | |
import os |
This file contains 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
# 清除所有REPOSITORY和TAG都为<none>的镜像 | |
docker image prune | |
# 清除所有TAG为<none>的镜像 | |
docker rmi $(docker images | grep ' <none>' | awk '{print $3}') |
This file contains 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 os | |
import boto3 | |
import json | |
import traceback | |
client = boto3.client('ssm') | |
def get(name): | |
value = os.environ.get(name, '') | |
if value.find('ssm:') != 0: |
This file contains 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 | |
TEMPLATE=docker-compose.template.yaml | |
OUTPUT=result.yaml | |
cat $TEMPLATE | | |
sed "s/[ '\"#]/\\\\&/g" | # 为各类控制字符加反斜杠前缀 | |
sed 's/ /\\ \\ /g' | # 为两个连续空格加反斜杠前缀。这是为了避免给单引号包裹的单个空格也加上反斜杠 | |
while read -r line;do | |
eval echo "${line}" |