docker volume rm $(docker volume ls -qf dangling=true)
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
logging.basicConfig(filename=logname, | |
filemode='a', | |
format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s', | |
datefmt='%H:%M:%S', | |
level=logging.DEBUG) | |
logging.basicConfig(format='%(asctime)s,%(msecs)d %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s', | |
datefmt='%d-%m-%Y:%H:%M:%S', | |
level=logging.DEBUG) |
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
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |
# for linux | |
ENV TZ=Asia/Shanghai | |
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |
# for alpine | |
RUN apk add --no-cache tzdata | |
ENV TZ Asia/Shanghai |
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
insert into proc_runtime (vm, procname) values ('100', 'wechat.exe') on duplicate key update vm = values(vm), procname = values(procname), day_runtime =day_runtime + values(day_runtime) |
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
# copy from https://coolshell.cn/articles/8619.html | |
#!/bin/bash | |
# Bash Menu Script Example | |
PS3='Please enter your choice: ' | |
options=("Option 1" "Option 2" "Option 3" "Quit") | |
select opt in "${options[@]}" | |
do | |
case $opt in |
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
# start proxy allow remote access | |
kubectl proxy --address=0.0.0.0 --port=80 --accept-hosts='^*$' | |
# port forward | |
kubectl --address 0.0.0.0 port-forward redis-test1-xxxx 6379:6379 | |
# check pod startup issue | |
kubectl describe pod [my-pod-name] -n [kube-system](namespace) | |
# show all pods |
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
#!/bin/bash | |
set -ex | |
ip route get 8.8.8.8 | head -1 | awk '{print $7}' |
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 logging | |
def setup_csv_logger(log_file, name='csv', level=logging.INFO): | |
handler = logging.FileHandler(log_file) | |
handler.setFormatter( | |
logging.Formatter('%(asctime)s,%(message)s', | |
datefmt='%Y-%m-%d:%H:%M:%S') | |
) | |
csvlogger = logging.getLogger(name) | |
csvlogger.setLevel(level) |
OlderNewer