终于吧 blog 的自动构建 pipeline 配置好了
目前博客是基于 pelican 的 static-site generator,一个 python 模块本地渲染成静态文件然后通过 github pages 发布。
源码放在 bitbucket,之前比较懒都是本地跑,一直 …
Posted
stdout
This blog is rated R⃣ , viewer discretion is advised
目前博客是基于 pelican 的 static-site generator,一个 python 模块本地渲染成静态文件然后通过 github pages 发布。
源码放在 bitbucket,之前比较懒都是本地跑,一直 …
Posted
stdout
搜了下,2020年3月14日,在中国工业与应用数学学会举办的网络科普活动中,中国科学院院士袁亚湘带 …
Posted
stdout
A simple trick to add additional bytes prepending Flask's stream_with_context
from flask_admin.contrib.sqla import ModelView
from itertools import chain
class MyAdminView(ModelView):
can_export = True
column_export_list = ['field1', 'field2']
def _export_csv(self, return_url):
r = super(MyAdminView, self)._export_csv(return_url)
r.response = chain((b'\xef\xbb\xbf',), r.response)
return r
I …
Posted
stdout
牛津树 Oxford Reading Tree 是被国内咪蒙妈妈们吹得油爆爆的来自英国的少儿学习体系,Good English/典范英语 是中青出版社的部分摘录英 …
Posted
stdout
先抬一张地图出来,
鲁苏豫皖四省,如果让你选一个最乱的地,你可能选哪里呢?
说起来,徐州对我的印象,只是《三国演义》上一 …
Posted
stdout
今天的第一个收获,Victor Sierra这个搜救图案
来自 Why This Zig-Zag Coast Guard Search Pattern is Actually Genius - Smarter Every Day 268,是美国 coast guard 标准化的水面搜救路线之一。这种图案覆盖的 …
Posted
stdout
PhoenixDB 居然是基于 requests + pb2 做的传输层协议。连接的是 queryserver 的 http 接口
看 avatica/client.py 源码 可以得知这玩意默认是不支持设置read timeout的。强行hack一个 …
Posted
stdout
$ curl -H "User-Agent: User-Agent: Mozilla/5" -kvs 'http://www.microsoft.com'
* Trying 118.123.102.107...
* TCP_NODELAY set
* Connected to www.microsoft.com (118.123.102.107) port 80 (#0)
> GET / HTTP/1.1
> Host: www.microsoft.com
> Accept: */*
> User-Agent: User-Agent: Mozilla/5
>
< HTTP/1.1 403 Forbidden
< Server: GHost …
Posted
stdout
不折腾不舒服。继之前 Edge调教 之后记录一下 Chrome V70怎么阉割。
下载:
上面的链接已经年久失修了,对比了一下获取最新版本的脚 …
Posted
stdout
都说 xmas eve 是洋节,我们就来数一数到底有哪些洋节
Posted
stdout
首先在本地安装 pip install tuna
然后跑个分,需要 CPython >= 3.7
,输入
PYTHONPROFILEIMPORTTIME=1 python3 myscript.py 2>1.log
然后 tuna 1.log
,会自动打开浏览器围观 import
耗时分布 …
Posted
stdout
FastAPI 官方支持 from fastapi.staticfiles import StaticFiles
充当一个静态文件服务器
其实实现是 starlette。这玩意可以在 directory
下放一个 404.html
,恰好单页应用也需要用 …
Posted
stdout
有没有好奇为什么 Flask 配置必须要求一个 SECRET_KEY,然后就可以在浏览器保存一个 session 状态读写数据。
这里记一下它的底层实现,其 …
Posted
stdout
No module named '_ctypes'
报错 Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/python3/lib/python3.9/site-packages/setuptools/__init__.py", line 18, in <module>
from setuptools.dist import Distribution
File "/usr/local/python3/lib/python3 …
Posted
stdout
之前一直用的chrome v70,为什么呢?
第一是这个老版本允许 --proxy-pac-url="file:///Users/me/1.pac
这样设置,但是Chromium项目的大爷们觉得你本地的.pac不够安全,要网上的.pac才安全,所以一刀切 …
Posted
stdout
The BLOB, TEXT, and JSON columns cannot be assigned a default value.
虽然 MySQL 5.7 也是这么说的:
A JSON column cannot have a non-NULL default value.
但是 MySQL …
Posted
stdout
看到 V站有人问这个,随手一记
可以参考源码里的注释文档
Like --host-rules
but these rules only apply to the host resolver.
A comma-separated list of rules that control how hostnames are mapped.
For example:
- MAP * 127.0 …
Posted
stdout
People are still using FastCGI, and it's hard. I used uWSGI to convert FCGI traffic to regular http/1.0 so I can keep my existing http service running without apache mod_fcgi shit.
This is some ancient knowledge, better keep them noted
KEY | description |
---|---|
AUTH_TYPE | ignore this … |
Posted
stdout
总结一些没用的知识
淘宝/阿里账号,可以一个手机最多绑定6个账号。淘宝注册的时候点击「企业注册」然后用邮箱注册,最后用同 …
Posted
stdout
群里闲聊起究竟生男好还是生女好,就想起了这首诗
Posted
stdout
Request indexing webpage with Google used to be fun and simple, now it's a tedious task especially when you have tons of old pages ready to be crawled yet Google is reluctant to move.
Here is a simple script to speed up the stacks of page you have click in …
Posted
stdout
一觉醒来,打开浏览器,各种连不上,调试了一下发现说lets encrypt 的 acme https证书错误
仿佛记得V站讨论过这个事,以为和自己无关,结果也中招了。DST …
Posted
stdout
看到个讲 Solar Roof 视频
他们家的 filtered tap water 测出来 TDS 为 358ppm
tap water 测出来 TDS 是 435 ppm,
说加州的市政供水很硬,有大量的钙、镁离子。都不 …
Posted
stdout
MySQL的
> select VERSION()
+-----------+
| VERSION() |
+-----------+
| 8.0.15-6 |
+-----------+
> select NOW() > '';
+------------+
| NOW() > '' |
+------------+
| 1 |
+------------+
> show warnings;
+---------+------+----------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------+
| Warning | 1292 | Truncated incorrect datetime value: '' |
+---------+------+----------------------------------------+
TiDB:
> select VERSION()
+--------------------+
| VERSION() |
+--------------------+
| 5.7.25-TiDB-v5.1.0 |
+--------------------+
1 row in set
> select NOW() > '';
+------------+
| NOW() > '' |
+------------+
| <null> |
+------------+
> show warnings;
+---------+------+------------------------------+
| Level | Code | Message |
+---------+------+------------------------------+
| Warning | 1292 | Incorrect datetime value: '' |
+---------+------+------------------------------+
1 …
Posted
stdout
I always thought restart gnicorn is as easy as kill -HUP <pid>
, but there are two pitfalls:
First of all the code might be loaded in master process then fork'ed into workers, so the HUP
signal won't reload the source code, only gunicorn config is updated.
Then there might be …
Posted
stdout
多年的疑惑今天居然被偶然解开了。
由于墙内糟糕的网络环境,而且ISP甚至wifi内还有墙中墙,所以很多域名是打不开的。
每次看浏览器在傻乎乎 …
Posted
stdout
A simple function to upsert something atomically into MySQL
def upsert(val1, val2, **kwargs):
"""upsert val1-val2 pair into mysql and return the pk"""
from sqlalchemy.dialects.mysql import insert
from sqlalchemy.sql.expression import func
# this val1-val2 pair should have UNIQUE KEY constraint in MySQL table.
stmt = insert(MyModel.__table__ …
Posted
stdout
断断续续把买的古墓丽影9打完了。这款2013年的游戏放在今天看也很不错。
唯一的巨大问题就是3D头晕。网上找了一些办法。
虽然故事和镜头都 …
Posted
stdout
手上有几个行车记录仪
Posted
stdout
Win10启动后,锁屏界面有一些每天更新的漂亮的墙纸,但是每个用户进去却只能看到默认的墙纸,不能自动切换。很是遗憾,于是搞了 …
Posted
stdout
记录一下,Mac OS X 10.6.8 或更高版本:
mdls -name kMDItemDurationSeconds -name kMDItemFSName 1.mp4
这命令有一个很神经病的一点,同一个 .mp4 文件,获取只读的 TF 卡上的 …
Posted
stdout
因为某些拉垮的业务需要,不得不在代码里去反向代理别的 HTTP API
一般格式如下:
@app.get('/other/{other_path:path}')
@app.post('/other/{other_path:path}')
async def other_api(other_path: str, req: Request …
Posted
stdout
首先得有公网 IP (废话),然后你得 OpenWRT 路由器桥接直拨。
这个方法的核心是通过 ifstatus wan | jsonfilter -e '@["ipv4-address"][0].address'
命令得到本机 WAN 的公网 IP。
根 …
Posted
stdout
新年第一贴!
Run the command before connect to PPPoE or as cronjob
添加一个重启的定时任务,在重启之间执行一个命令:
uci set network.wan.mac_addr=$(hexdump -n3 -e'1/3 "8c:8d:8e" 3 …
Posted
stdout
nsq is a lightweight message queue like Kafka/RabbitMQ/RocketMQ/RedisQueue/Celery.
For python bindings there ware three libraries out there:
tornado
select()
based, but compatible with gevent …Posted
stdout
同步发帖在 v2ex
今天发现 Intl 这个 ECMAscript 内置对象,可以一句话算农历。
new Date().toLocaleString('zh-CN-u-ca-chinese').replace(/(\d+)\s*?年/, (_,y)=>"甲乙丙丁戊己庚辛壬癸".charAt((y-4)%10) + "子 …
Posted
stdout
There was a not-so-interesting article on reddit that says China's Race For AI Dominance Depends On Math
The arguments looks flawed in several ways.
First of all, yes Chinese students do performs well in math, but only in one narrow specific branch of math: alrithmetics. Once they graduate into college …
Posted
stdout
Posted
stdout
因为现在 zhihu 要绑手机才能回答,所以还是写自己 blog 上吧。
对「为什么会有数学家反对对无穷集合使用排中律 」这个问题,我有 …
Posted
stdout
发现 blog 越来越喜欢记录一些哲学问题。。。
记录一些重要问题的答案,有些是自己想出来的,有些是网上抄别人的,有些是被别 …
Posted
stdout
Paladins is one of the F2P games on Steam. It's called 枪火游侠 in Chinese market with Tencent as its Partner operator.
To play it on Steam:
jQuery …
Posted
stdout
最近播音737两次空难闹得全球沸沸扬扬,中国民航局敢为天下先直接停飞,FAA 最后也只能跟进然后全球停飞,风暴的中心就是波音公司。看到一篇报道 …
Posted
stdout
Chinese companies have very little presence online and many people may believe that Chinese are reluctant to engage in open source projects.
Last year, @filmaj used the GitHub REST API to pull public profile information from all 2,060,011 GitHub users who were active in 2017 (10+ commits to …
Posted
stdout
从 https://www.thoughtworks.com/cn/radar 看到的一个新概念,Wardley mapping
其实也不新了,2014年就出来了。见:
Simon Wardley OSCON 2014 Keynote: "Introduction to Value Chain Mapping"
如果你觉得各种软件工程 和 商业 diagram …
Posted
stdout
记录一下
https://github.com/pallets/jinja/issues/169
https://github.com/pallets/jinja/issues/243
开发这个主题 https://github.com/est/aether-pelican 时候遇到的。
btw 还有好多 css 问题需要改。有问题可以 …
Posted
stdout