280篇 Default中的文章

flask: serve static file

Send a file from a given directory with :func:send_file. This
is a secure way to quickly expose static files from an upload folder or something similar.

from flask import Flask, request, send_from_directory

# set the project root directory as the static folder, you can set others.
app = Flask(__name__, static_url_path='')

@app.route('/js/<path:path>')
def send_js(path):
    return send_from_directory('js', path)

if __name__ == "__main__":
    app.run()
More ~

iTerm2批量删除主题

一次导入太多主题了,试了又用不上,想删了界面只提供单个删除。

还好装Xcode了,可以open ~/Library/Preferences/com.googlecode.iterm2.plist 用Xcode打开,定位到Custom Color Presets下面的主题名称上,长按住删除键即可很快删完。

20210112224451.png

More ~

git reset password

git pull 时提示Authentication failed ,需要重置密码,执行这个即可

git config --system --unset credential.helper
More ~

macbook扩展坞连上后为什么wifi断开了

买来扩展坞连接上后,我的WiFi连接不上了!
家里的WiFI是用一台带有WiFi功能的电信光猫作为路由,发射的2.4G信号,没有5G。

折腾一番后找了些资料了解到是USB3.0发射的无线信号在2.4G HZ左右,会干扰无线路由的2.4G。

20210110115424.jpg

More ~

SSE (Server-sent events) 技术详解

SSE ( Server-sent Events )是 WebSocket 的一种轻量代替方案,使用 HTTP 协议。

严格地说,HTTP 协议是没有办法做服务器推送的,但是当服务器向客户端声明接下来要发送流信息时,客户端就会保持连接打开,SSE 使用的就是这种原理。

More ~

git记住密码

是不是每次git pull时都要输入密码?就让它记住密码吧

git config --global credential.helper store
More ~