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
a = [('a', 'etwrfb', 'casdf'), ('1', 2, '35235')] | |
res = '\n'.join(','.join(map(str, i)) for i in a) | |
# 'a,etwrfb,casdf\n1,2,35235' |
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://stackoverflow.com/questions/32658679/how-to-create-a-mysql-connection-pool-or-any-better-way-to-initialize-the-multip | |
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import time | |
import mysql.connector.pooling | |
dbconfig = { | |
"host":"127.0.0.1", |
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
[Unit] | |
Description=containerd container runtime | |
Documentation=https://containerd.io | |
After=network.target | |
[Service] | |
ExecStartPre=/sbin/modprobe overlay | |
ExecStart=/usr/bin/docker-containerd | |
KillMode=process | |
Delegate=yes |
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
mysql+pymysql://root:xxxx@localhost:3306/qin?charset=utf8 |
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 | |
containers=$(docker ps -a -q --filter status=exited) | |
if [[ ! -z ${containers} ]]; then | |
docker rm -f -v ${containers} | |
fi |
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 | |
if [[ "$1" =~ ^[0-9]+$ ]]; then | |
echo "yes" | |
else | |
echo "no" | |
fi |
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 | |
sleep_time=5 | |
regex_name='server1.py' | |
cmd="python ${regex_name} &>> logs/test.log &" | |
bash -c "${cmd}" |
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 | |
yum install -y git gcc gcc-c++ | |
yum install -y zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel | |
yum install -y zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel \ | |
openssl-devel xz xz-devel libffi-devel | |
# curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash |
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
# https://zh-google-styleguide.readthedocs.io/en/latest/google-shell-styleguide/environment/ | |
err() { | |
echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $@" >&2 | |
} | |
if ! do_something; then | |
err "Unable to do_something" | |
exit "${E_DID_NOTHING}" | |
fi |
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
# labelencoder 和 onehotencoder 处理测试集中未出现的样本会报错,需要进行处理 | |
import pandas as pd | |
df1 = pd.read_csv("data/xxx.csv", encoding = 'utf-8', error_bad_lines=False, warn_bad_lines=False) | |
df1 = df1.iloc[:, :-1] | |
df1 = df1.drop(['xxx', 'aaa'], axis=1) | |
df1 = df1.fillna('0') | |
# 下面的代码可以直接将 整个 df labelencoder | |
from collections import defaultdict | |
d = defaultdict(LabelEncoder) |