最近看到国产网剧《无主之城》,感觉大有僵尸之类美剧的情节,看到第10集,江雪的电脑被入侵后,江雪在键盘上霹雳啪啦一顿狂操作,画面切到一堆黑屏的命令窗口,有点好奇是什么命令,遂暂停截了下图:

原来桌面用的黑色背景,命令窗口调用几个批处理命令打印出代码。代码的内容还是用Python的pygame库加载声音文件,设置音量。
而且几个窗口的内容是一样的!
和网络命令也不沾边,看来也就是做做效果,糊弄一下。
289篇 Default中的文章
最近看到国产网剧《无主之城》,感觉大有僵尸之类美剧的情节,看到第10集,江雪的电脑被入侵后,江雪在键盘上霹雳啪啦一顿狂操作,画面切到一堆黑屏的命令窗口,有点好奇是什么命令,遂暂停截了下图:

原来桌面用的黑色背景,命令窗口调用几个批处理命令打印出代码。代码的内容还是用Python的pygame库加载声音文件,设置音量。
而且几个窗口的内容是一样的!
和网络命令也不沾边,看来也就是做做效果,糊弄一下。
I'm not sure there are differences of WKWebView usage between iOS app and MacOS app. There I have an issue that a web view on the storyboard can not load a request. Typically there is always the white screen, implies nothing loads.
Finally, I found the solution here. In the Capabilities tab of the project target, it's App Sandbox, check the Network: Outgoing Connections (Client).

*args 和 **kwargs 均为可变参数,方便记忆可以理解为 *args是列表形式的多个参数,不过它传值不是以list, 就是func(arg1, arg2, arg3...)
**kwargs可以理解为字典形式的多组key, value键值对,不过它传值也不是字典,而是func(a=1, b=2, c=3...)。
它们同时出现在func的定义中时,*args在前, **kwargs在后
**kwargs通常用在类的初始化多个配置项参数值传递。举一个pymongo的例子:
class MongoClient(common.BaseObject):
def __init__(
self,
host=None,
port=None,
document_class=dict,
tz_aware=None,
connect=None,
type_registry=None,
**kwargs):
推导式?什么东西?我还真头一回听说这名词,以为是链表、二叉树之类的问题,面试官这样问,只能摇头不解。
回来查下推导式,原来就是常用的list的for in for,有点想笑,这么简单的列表创建问题问得让我摸不着头脑,有些术语听起来很深奥,其实就是常用的表达式,这好比你去问别人设计模式,你用过什么设计模式,什么工是工厂模式?什么是单例模式等等,虽然对术语可能一知半解或者解释不清,其实就是常常在用的。
newlist = [i for i in range(1, 100) if i%3==0]
| 名称 | DNS 服务器 IP 地址 | 备用 |
|---|---|---|
| 114 DNS | 114.114.114.114 | 114.114.115.115 |
| 阿里 AliDNS | 223.5.5.5 | 223.6.6.6 |
| 百度 BaiduDNS | 180.76.76.76 | |
| DNSPod DNS+ | 119.29.29.29 | 182.254.116.116 |
| CNNIC SDNS | 1.2.4.8 | 210.2.4.8 |
| oneDNS | 117.50.11.11 | 52.80.66.66 |
| DNS派 电信/移动/铁通 | 101.226.4.6 | 218.30.118.6 |
| DNS派 联通 | 123.125.81.6 | 140.207.198.6 |
| Cloudflare DNS | 1.1.1.1 | 1.0.0.1 |
| Google DNS | 8.8.8.8 | 8.8.4.4 |
| IBM Quad9 | 9.9.9.9 | |
| OpenDNS | 208.67.222.222 | 208.67.220.220 |
| V2EX DNS | 199.91.73.222 | 178.79.131.110 |
话说本地用docker-compose搭了个wordpress的站点,设置里site url和home都是本地地址http://localhost:8300 ,然后上线的数据库数据是导出后导入进来。
用nginx反向代理wordpress的容器地址,浏览器卡住半天自动跳转到www.xxx.com:8300, 这很诡异啊,一直在怀疑是不是nginx配错了,proxy_redirect是off的。 即使重新安装nigix也无济无事。 curl -i 看看响应头确实301跳转了

There is no docker untag command, so, the answer is find the repository which using the image and execute
docker rmi <REPOSITORY>:<TAG>
There are the commands we executed before to tag a new image with an image id
docker tag <image id> hkccr.ccs.tencentyun.com/xxx/fff:v0.1.4
And remove the tagged image
docker rmi hkccr.ccs.tencentyun.com/xxx/fff:v0.1.4
Linux的定时功能crontab同样在macos上也可以用。
起因是之前检查过有尿结石,最近小腹疼,还尿出血,感觉又有结石了,所以还是要多喝水,所以写个定时提醒来时刻提醒自己。
先写段shell脚本来设置提醒内容
文件命令为 drink.sh
title="日常提醒"
content="常喝水,常排尿,远离疾病, 爱你的亲"
subtitle="记得喝水"
sound="Pon"
cmd=$(printf 'display notification "%s" with title "%s" subtitle "%s" sound name "%s"' "$content" "$title" "$subtitle" "$sound")
osascript -e "$cmd"
say -v Ting-ting $content
需要用的工具:
osascript在macos上可以执行AppleScript, JavaScript等.
这里介绍AppleScript两个常用命令: display, say.
这个命令可以在mac上发送系统通知,macos 会在侧边栏显示这个通知消息。
AppleStript这样写 display notification "hello world!"
为了执行这条命令需要用到osascript, 并且需要-e参数,后面跟的单引号字符引用的命令
执行发送这条通知:
osascript -e 'display notification "hello world!"'

这条通知显示在屏幕右上角,3秒后消失。
事情是这样的,一个表单,我想把get和post请求放到一个方法里,但是get和post的路由不一样。
@app.route('/markdown', methods=['GET'])
@app.route('/page_create', methods=['POST'])
def create():
form = PageForm()
context = {
'form': form
}
...
<!--more-->
按理说可以这样搞,但是我希望是不同的路由进来。
@app.route('/markdown', methods=['GET', 'POST'])
def create():
form = PageForm()
context = {
'form': form
}
...
那么view里可以这样生成链接,其实就是url_for 多个参数,指定用的method
<form method="post" action="{{ url_for('markdown.create', _method='POST') }}">
但事后觉得这样写太乱了,所以最好还是将get和post请求分不同的方法来写。