Visualization

Matplotlib Basic Import from matplotlib import pyplot as plt Build figure fig = plt.figure(1) fig = plt.figure(1, figsize=(10,10)) # set figure size Tighten the layout fig.tight_layout() Build subplots ax = plt.subplot(111) ax = plt.subplot(211) # build two subplots and select the left one ax = plt.subplot(111, projection='polar') # build polar subplot Draw graphs ax.plot() ax.bar() ax.hist() ax.scatter() ax.plot_date() Show figure fig.show() Clear figure fig.clf() Save figure plt.savefig('path/name.png') Legend & Label & Tick & Grid # title ax.set_title('plot', fontsize=20) # label ax.set_xlabel('Threshold (m/s)') ax.set_ylabel('Strom periods (hours)') # ticks ax.set_xticks(np.arange(0, 1.1, 0.1)) ax.set_yticks(np.arange(0, 1.1, 0.1)) ax.set_xticklabels(labels, size=9, rotation=15) # axis limits plt.xlim(0, 1) # or ax.set_xlim(0, 1) # grid ax.grid(True) ax.grid(False) ax.yaxis.grid(True) # legend ax.plot(xx, yy, label='plot1') ax.legend(loc='lower left', frameon=False, fontsize=12) # or ax.legend(['line1', 'line2']) Two y-axis ...

January 1, 2000

VSCode

Shortcuts 设置-Settings: ⌘, 命令-Command Palette: ⇧⌘P Preference Color theme Git Format View Close All Editors 快速打开-Quick Open: ⌘P go to line: : 跳转-Go to Symbol: in file: ⇧⌘O in workspace: ⌘T 重命名-Rename Symbol: F2 移动到侧边栏-Move to Explorer Window: ⇧⌘E Markdown预览-Markdown Preview: ⇧⌘V Views Sidebar: ⌘B Panel: ⌘J Teminal: ⌃` Errors and Warnings: ⇧⌘M cycle through errors: F8/⇧F8 Extensions: ⇧⌘X Side by Side Editing: ⌘\ Editing Multi Cursor Selection ⌥⌘↑ or ⌥⌘↓ Option + Click / Option + Shift + Click Select All Occurences: ⇧⌘L Select Next Occurence: ⌘D Select Currnet Line: ⌘L Delete Current Line: ⇧⌘K Copy Line Up/Down: ⇧⌥↑ or ⇧⌥↓ Move Line Up/Down: ⌥↑ or ⌥↓ Shrink / Expand Selection: ⌃⇧⌘← or ⌃⇧⌘→ Rename Symbol: F2 Code Formatting: ⇧⌥F Refactor: ⌃⇧R Extract variable Extract method Goto Go to Definition F12 Cmd + Click Go to References ⇧F12 All references: ⇧⌥F12 Next Error F8 Navigate Back Ctrl + - Search Search: ⌘F Replace: ⌥⌘F Regular Expression: ⌥⌘R Self-Defined View: Toggle Maximized Panel: Ctrl+Shift+Up User View Container: Focus on Outline View: Shift+Cmd+M Project Manager: List Projects to Open in New Window: Shift+Cmd+P Commands Settings ...

January 1, 2000

Vue

Prerequisites Webpack 将 js 代码打包到一个文件中 安装:npm install webpack -g 使用:webpack <input> <output> vue cli(deprecated) Vue CLI the official webpack-based toolchain for Vue. It is now in maintenance mode and we recommend starting new projects with Vite unless you rely on specific webpack-only features. 安装:npm install -g @vue/cli 创建项目:vue create my-project # serve vue-cli-service serve --host 0.0.0.0 --port 8080 # build vue-cli-service build # lint vue-cli-service lint vite Vue.js - Tooling ...

January 1, 2000

Web Apps

Music Music for Programming Geo exping - Express anything on map NASA’s Eyes Earth Cam City Walks

January 1, 2000

Workflow

n8n Install:Self-hosting n8n docker volume create n8n_data docker run -d \ --name n8n \ --network host \ -v n8n_data:/home/node/.n8n \ -e TZ="Asia/Shanghai" \ -e N8N_SECURE_COOKIE=false \ docker.n8n.io/n8nio/n8n Triggers Mannual Form Action Send Email Gmail SMTP 配置: User:<your_email>@gmail.com Password: 设置 app passwords:https://myaccount.google.com/u/3/apppasswords Host:smtp.gmail.com Port:465 SSL/TLS:true Code Python: 不支持发送 HTTP 请求 不支持访问文件系统 不支持自己安装第三方包,只支持 Pyodide 内置的包 windmill Github - windmill Perfect Github - Perfect

January 1, 2000

Zookeeper

Zookeeper 配置 tickTime=2000 initLimit=10 syncLimit=5 dataDir=zookeeper/data dataLogDir=zookeeper/logs clientPort=2181 server.1=host1:2888:3888 server.2=host2:2888:3888 server.3=host3:2888:3888 #server.1 这个1是服务器的标识也可以是其他的数字, 表示这个是第几号服务器,用来标识服务器,这个标识要写到快照目录下面myid文件里 #host1为集群里的IP地址,第一个端口是master和slave之间的通信端口,默认是2888,第二个端口是leader选举的端口,集群刚启动的时候选举或者leader挂掉之后进行新的选举的端口默认是3888 Command Line Tools # start server bin/zkServer.sh start/start-foreground/stop/status # client bin/zkCli.sh -server 127.0.0.1:2181 create /MyFirstZNode ZNodeVal get /MyFirstZNode set /MyFirstZNode ZNodeValUpdated Maven <dependency> <groupId>org.apache.zookeeper</groupId> <artifactId>zookeeper</artifactId> <version>3.4.11</version> </dependency> Source Code Zookeeper框架设计及源码解读 References Getting Started with Java and Zookeeper Explaining Apache ZooKeeper

January 1, 2000