原创 算法-計算1的個數及python sort函數的多層排序
leetcode: 1356. Sort Integers by The Number of 1 Bits 1. 計算數字中bit1的個數 在這裏,計算1 bit 的個數使用的是 減1再 bit and的方式。 例如 9的二進制表示爲
原创 design pattern
1 adapter class Cat: def __init__(self): self.name = "cat" def mom(self): print("mom!")
原创 parameter passing
print(""" There is only one type of parameter passing in Python, which is object reference passing. In the functi
原创 collections
from collections import namedtuple from collections import deque from collections import OrderedDict def nametupl
原创 shallow copy & deep copy
import copy def shallow_n_deep_copy(): a = {'a': [1, 2, 3]} b = a.copy() print('a:', a, 'b:', b)
原创 GIL & coroutine & performance
GIL a bytecode instruction is thread safe. The following code has 3 bytecode instructions, so it’s not thread saf
原创 exception
‘docs.python.org’ about ‘exception’ def exception_example(): a = 0 try: a = 1/0 except Except
原创 jenkins
use this plugin to store the parameters of your last build. https://wiki.jenkins.io/display/JENKINS/Persistent+Parame
原创 Create an ubuntu&python&ssh environment by docker
參考文章 You can get the saved docker image by: docker pull ahope2019/ubuntu_python3_tool Following are the steps I did
原创 yqzj接口文檔
2019.8.6. 微信公衆號接口: http://18.220.98.204/wx_flask 目前只支持文本消息 輸入"每日一句: 獲取一句中文 輸入"答案: 獲取一句對應的英文 輸入"debug“: 這個是調試用
原创 報文數據的txt文件 轉換成wireshark可以識別的k12文件
implement a python app which can covert hex raw packet data to k12 file. Wireshark can open the k12 file and parse the
原创 vscode install
vscode install https://blog.csdn.net/bat67/article/details/76095813
原创 axure design
axure design https://www.axureshop.com/ https://www.iconfont.cn/
原创 command模式(c語言實現)
2014年寫過一篇實現,重讀一遍《設計模式》,參考網上的一篇文章,又重新寫了一遍。 我體會到,c++的類在c語言裏面用struct代替之後,c++的this指針可以通過傳入struct本身的指針來完成。 而在command模式裏的Comm
原创 適配器模式(c語言實現)
在這裏用c實現了類似於java的接口。 #include <stdio.h> #include <stdlib.h> #include <cassert> typedef struct _Duck { void (*