Skip to content

Instantly share code, notes, and snippets.

View justdoit0823's full-sized avatar

余森彬 justdoit0823

View GitHub Profile
@justdoit0823
justdoit0823 / protobuf_default_values.md
Created March 8, 2018 08:18
Default values in protobuf 3.

Default values

  • strings

The default value is the empty string, ''.

  • bytes
@justdoit0823
justdoit0823 / wuhan_commercial_residential_building_presell_license_query.sh
Last active March 14, 2018 08:21
Query wuhan commercial residential building presell license.
# The argument xmmc is residential building name
http -f post http://202.103.39.35:9083/WebService1.asmx/SPF_XMMC_KFGSMC_ZH xmmc=万科翡翠玖玺 pag=1|awk '/<string/ {split($0, a, "<\/string>"); idx = index(a[1], "{"); print substr(a[1], idx, length(a[1]) - idx + 1)}'|jq '.head'
@justdoit0823
justdoit0823 / terminology_list.md
Last active March 28, 2018 04:45
A collection of backend application middleware terminologies.

RabbitMQ

primitive

  • producer

  • connection

@justdoit0823
justdoit0823 / wechat_message.md
Created March 30, 2018 04:21
A collection of wechat message data format.
  • 表情
{'MsgId': '3972014947580763222', 'FromUserName': '@da06134cdb32d33e51e0d195955b87f4', 'ToUserName': '@2705e44eba961beba3387579416b14c83b9d5eba6483c3b5cc69c4404d424115', 'MsgType': 47, 'Content': '', 'Status': 3, 'ImgStatus': 2, 'CreateTime': 1498547602, 'VoiceLength': 0, 'PlayLength': 0, 'FileName': '', 'FileSize': '', 'MediaId': '', 'Url': '', 'AppMsgType': 0, 'StatusNotifyCode': 0, 'StatusNotifyUserName': '', 'RecommendInfo': {'UserName': '', 'NickName': '', 'QQNum': 0, 'Province': '', 'City': '', 'Content': '', 'Signature': '', 'Alias': '', 'Scene': 0, 'VerifyFlag': 0, 'AttrStatus': 0, 'Sex': 0, 'Ticket': '', 'OpCode': 0}, 'ForwardFlag': 0, 'AppInfo': {'AppID': '', 'Type': 0}, 'HasProductId': 1, 'Ticket': '', 'ImgHeight': 240, 'ImgWidth': 240, 'SubMsgType': 0, 'NewMsgId': 3972014947580763222, 'OriContent': ''}

{'MsgId': '3391545678501479158', 'FromUserName': '@da06134cdb32d33e51e0d195955b87f4', 'ToUserName': '@2705e44eba961beba3387579416b14c83b9d5eba6483c3b5cc69c4404d424115', 'MsgType': 47, 'C
@justdoit0823
justdoit0823 / oneof_type_in_protocol_buffers.md
Last active April 6, 2018 14:45
How oneof type works in protocol buffers.

If you have a message with many fields and where at most one field will be set at the same time, you can enforce this behavior and save memory by using the oneof feature.

Oneof fields are like regular fields except all the fields in a oneof share memory, and at most one field can be set at the same time. Setting any member of the oneof automatically clears all the other members. You can check which value in a oneof is set (if any) using a special case() or WhichOneof() method, depending on your chosen language.

This type may have no any fields, and can't have exact one field.

@justdoit0823
justdoit0823 / style_guide_in_protocol_buffers.md
Created April 6, 2018 14:51
Style guide in protocol buffers.

Message Name

CamelCase.

Field Name

@justdoit0823
justdoit0823 / parallel_execution_in_python.md
Last active April 7, 2018 10:51
How to parallel execution in Python.

multiprocessing

builtin Python module.

parallel level

@justdoit0823
justdoit0823 / package_python_project.md
Created April 9, 2018 03:16
How to package python project.
  • cookiecutter

Install cookiecutter to initialize project structure.

  • setup.py

Update setup.py file according to your project.

  • package