Skip to content

Instantly share code, notes, and snippets.

View firefirer1983's full-sized avatar

fyman.zhang firefirer1983

  • China Guangdong Shenzhen
View GitHub Profile

产品设计的强大与易用的关系

强大和易用是两个无法兼容的维度. 要强大,必然难用,要易用必然不会强大.

做产品的步骤

  1. OOA的方式,先从需求的文字性描述中分析出领域模型.
  2. 从领域模型中继续派生其他的场景和功能.
@firefirer1983
firefirer1983 / 财务自由之路.md
Created April 21, 2020 02:17
财务自由之路

要达到财务自由,需要三点要求

  1. 对支出的预期
  2. 对资产和收入的了解
  3. 对寿命的期望

1,2点都可以通过复式记账方式实现.

AMPQ(Advanced Message Queuing Protocol)

高级消息队列协议, 客户端应用和消息broker中间件之间使用此协议进行通讯.

AMOQ Entities:

  1. Exchange
  2. Queue
  3. Binding

Exchanges

Default Exchange(默认交换机)

  • Is a direct exchange
@firefirer1983
firefirer1983 / RabbitMQ.md
Last active April 28, 2020 10:34
RabbitMQ

RabbitMQ

Message Queue - a message buffer that RabbitMQ keeps on behalf of the consumer.

Message Queue是RabbitMQ维护在host上的一个缓存队列

无论是发送还是接收前,都需要先queue_declare,不然会发送丢失或接收失败.

Work Queues (aka: Task Queues)

Avoid doing a resource-intensive task immediately and having to wait for it to complete.

Consumer

Consumer对Queue不是独占的,如果有多个Consumer同时消费一个Queue,会以round-robin的方式消费掉所有的消息

@firefirer1983
firefirer1983 / linux 查看端口占用.md
Last active April 28, 2020 09:40
linux 查看端口占用

linux 下查看进程占用端口:

  1. 查看程序对应的进程号: ps -ef | grep 进程名字

  2. 查看进程号所占用的端口号

  • linux:
netstat -nltp | grep  进程号
  • ubuntu:
@firefirer1983
firefirer1983 / effect_python.md
Created June 20, 2020 03:09
Effective Python

流畅的Python

魔法方法

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

@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 / 查看进程占用端口.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 / 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 / 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