Skip to content

Instantly share code, notes, and snippets.

View firefirer1983's full-sized avatar

fyman.zhang firefirer1983

  • China Guangdong Shenzhen
View GitHub Profile
@firefirer1983
firefirer1983 / PIP install from local source.md
Created March 20, 2021 05:42
[PIP install local package]

如果需要安装本地的: pip install file:///home/xy/repo/python/zolo#egg=zolo

@firefirer1983
firefirer1983 / git使用记录.md
Created February 1, 2021 03:16
git使用记录

git使用记录

迁移项目

git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
git remote rm origin
git remote add origin git@github.com:firefirer1983/pytrade-sfa.git

git push --all origin

@firefirer1983
firefirer1983 / dont_wirte_classes.md
Last active December 3, 2020 15:09
[Don't write classes] 不要写类 #编程原则

Don't write classes

  1. We ship features, not code.

  2. We want as little code as possible

  3. readibility counts 优先级是(从高到低): 交付功能,不交付代码,

    目标驱动,不忘初心.

    越少代码越好 > 没有代码,是最好的代码

MYSQL命令

MYSQL增添用户 增添权限

CREATE USER 'xy'@'%' IDENTIFIED BY '123456';
GRANT ALL ON sfa.* TO 'xy'@'%';

MYSQL 数据导入导出

sudo apt-get install mysql-client
@firefirer1983
firefirer1983 / docker_console_log_size_limit.md
Last active September 22, 2020 08:12
Docker console log file size limit

docker会自动保存console log,这样可能会导致磁盘爆掉,通过/etc/docker/daemon.json,配置log:

docker-compose配置Log

查看docker container占用空间:

docker system df -v
du -sh /var/lib/docker/containers/*
@firefirer1983
firefirer1983 / nodejs安装.md
Last active July 30, 2020 09:20
nodejs安装

nodejs安装

摘自:https://tecadmin.net

sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install nodejs
node -v
npm -v
@firefirer1983
firefirer1983 / Docker安装.md
Last active November 17, 2020 05:39
Docker安装

Docker 安装

安装

摘自:https://docs.docker.com

sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
@firefirer1983
firefirer1983 / 查看进程占用端口.md
Created July 29, 2020 03:59
查看进程占用端口
# sudo lsof -i:8000
COMMAND   PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
nodejs  26993 root   10u  IPv4 37999514      0t0  TCP *:8000 (LISTEN)


netstat -tunlp | grep 8000

- -t(tcp) 仅显示tcp相关
- -u(udp) 仅显示udp相关
@firefirer1983
firefirer1983 / python_tricks.md
Last active June 22, 2020 08:13
python_tricks

Python Tricks

property,做装饰器,或做函数来定义属性访问器

class Demo:
	idx = property(get_idx, set_idx)

class Demo:
  @property
  def idx(self):
 return self.get_idx()
@firefirer1983
firefirer1983 / effect_python.md
Created June 20, 2020 03:09
Effective Python

流畅的Python

魔法方法

不管在哪种框架下写程序,都会花费大量时间去实现那些会被框架本身调用的方法, Python 也不例外。Python 解释器碰到特殊的句法时,会使用特殊方法去激活一些基本的对象操作