Skip to content

Instantly share code, notes, and snippets.

View Everfighting's full-sized avatar
😁
I may be slow to respond.

蔡大锅 Everfighting

😁
I may be slow to respond.
View GitHub Profile
pip3 install -i https://mirrors.ustc.edu.cn/pypi/web/simple pyinstaller
root@ip-172-31-7-24:/web/hushanbin# docker system prune
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all build cache
Are you sure you want to continue? [y/N] N
@Everfighting
Everfighting / see_command
Created July 10, 2018 02:07
See full command of running/stopped container in Docker
docker inspect -f "{{.Name}} {{.Config.Cmd}}" $(docker ps -a -q)
@Everfighting
Everfighting / defaultdict_demo.py
Created April 17, 2018 00:48
defaultdict用法
# defaultdict Examples
# Using list as the default_factory, it is easy to group a sequence of key-value pairs into a dictionary of lists:
s = [('yellow', 1), ('blue', 2), ('yellow', 3), ('blue', 4), ('red', 1)]
d = defaultdict(list)
for k, v in s:
d[k].append(v)
sorted(d.items())
@Everfighting
Everfighting / write_line
Last active March 19, 2018 07:22
write line with csv
import csv
row1 = [1,2,3,4,5]
row2 = [1,2,3,4,5]
row3 = [1,2,3,4,5]
rows = [row1,row2,row3]
with open(csv_name,"w") as csvfile:
writer = csv.writer(csvfile)
#先写入columns_name
writer.writerow(["bottom", "left", "right", "top", "value"])
@Everfighting
Everfighting / count_character.py
Created February 2, 2018 01:58
count the every character in string
>>> string = 'hello world'
>>> { a:string.count(a) for a in set(string.replace(' ','')) }
{'h': 1, 'e': 1, 'w': 1, 'l': 3, 'o': 2, 'd': 1, 'r': 1}
@Everfighting
Everfighting / .gitignore
Last active April 3, 2019 01:45
.gitignore settings
# gitignore
.*.swp
*.idea
*.xls
*.txt
*.pdf
*.csv
*.xml
nohup.out
*.xls
# -*- coding: utf-8 -*-
import pip
from subprocess import call
for dist in pip.get_installed_distributions():
call("pip install --upgrade " + dist.project_name, shell=True)
@Everfighting
Everfighting / drop_duplicate_merge.py
Last active December 5, 2017 08:37
将同一借据号对应的两条紧急联系人信息组装成一条记录
#!/usr/bin/env python3
#encoding:utf-8
import pandas as pd
import numpy as np
# 读取excel
df = pd.read_excel('m020171205.xlsx')
# 只保留第一项,并修改列名
df_first = df.drop_duplicates(['借据号'],keep='first')
@Everfighting
Everfighting / query_bigdata.py
Created November 29, 2017 07:17
在数据库内部查询大批量数据,条件uid来自多超多行csv文件。
#!/usr/bin/env python
# encoding: utf-8
import pandas as pd
import psycopg2
conn_dv = psycopg2.connect(database="", user="", password="")
def read_csv(filename):
usr_list = pd.read_csv(filename)
res = []