>>> arr=[1,2,3,4]
>>> first,*mid,last = arr
>>> first
>>> mid
[2, 3]
>>> last
>>> first, *the_rest = arr
>>> first
>>> the_rest
[2, 3, 4]

fixed length array (only keep last n items)

>>> from collections import deque
>>> q = deque(maxlen=3)
>>> for i in range(0,10):
… q.append(i) …

A overview how python allocate/release memory

Small object ( <512 bytes) allocate use 3 structure to manage — arena , pool and block

Large object use standard c allocator


Each block is a chunk of memory increase by 8 bytes range from 8 to 512 .


Pool is a collection of blocks(each pool linked by double…

nginx config

upstream backend{server;server;}server {listen 81 default_server;listen [::]:81 default_server;location / {proxy_pass http://backend;}}

flask sample server to test

s1.py (simulate server 1)

from flask import Flaskapp = Flask(__name__)@app.route('/')def helloIndex():    return 'Hello World from server1'app.run(host='', port=90)

s2.py (simulate server 2)

This article will cover 4 Cases of Import:

  1. Everything from module in package

2. Certain functions from py file in package

3. py file at same level (relative import)

4. using __all__ with import *

Create a folder structure as below

first_pkg is the module to import , there are 2 services inside and 1 lib…

Why we practice algorithm? (not just for interview)

Solving Algorithm problems could help train our mind be used to useful datastructure and algorithms, be ready to use them to solve issues .

instead of CRUD works ,the leetcode problems usually requires good understanding of data structures like tree, graph, heap, even though most of them are unlikely being…


Software Developer/Technical Writer&Author/body builder

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store