Demon.Lee 2023-02-11 15:10

1、永远不要等一个东西降价或是足够便宜才去买。而是你需要的时候就应该买,买回来好好用,产生应有的价值。
2、购物时,同样的商品,不要花太多时间去比价。记住:价格永远是波动的,你不可能总买到作为「最便宜」的东西。这就好比你不可能买到最便宜的股票,然后又在最高点卖出。
3、有更高的意愿为知识而付费,而不是看不起所谓的知识付费。
4、住的地方要离工作的地方近一点。节省通勤时间,更重要的是节省精力。
5、即使在没钱的情况下,也愿意花钱买时间。你的钱是你赚到的某种社会信用,而你的时间是不可再生资源。
6、我如果经济不宽裕不意味着我做出不妥当的事情就有理(比如用盗版软件),也不要总觉得自己被歧视。
7、面子并不值钱。不要动不动就觉得伤自尊了。不要让面子问题成为自己的负资产。
8、无论现在怎么匮乏,但还是应该有一个可以长期坚持做的事情,就像储蓄一样,直到某一天,你可以打开那个「存钱罐」并且可以提取那份价值。比如说学习写作,英语,或是长期锻炼。
9、……

摘录自「小众消息」《说说我自己的「穷人心理」和「穷人生活方式」

Demon.Lee 2023-02-10 15:04

利用 curl 命令的 -w, --write-out <format> 选项,可以打印很多信息,比如处理的时长等,以下是具体用法:

# cat curl-format.txt
     \n------------------------------------\n
     time_namelookup:  %{time_namelookup}s\n
        time_connect:  %{time_connect}s\n
     time_appconnect:  %{time_appconnect}s\n
    time_pretransfer:  %{time_pretransfer}s\n
       time_redirect:  %{time_redirect}s\n
  time_starttransfer:  %{time_starttransfer}s\n
                     ----------\n
          time_total:  %{time_total}s\n
#
# curl -w "@curl-format.txt" -i http://ngx-istio:8080/
HTTP/1.1 200 OK
server: envoy
...
...
------------------------------------
     time_namelookup:  0.001505s
        time_connect:  0.001578s
     time_appconnect:  0.000000s
    time_pretransfer:  0.001603s
       time_redirect:  0.000000s
  time_starttransfer:  5.006996s
                     ----------
          time_total:  5.007136s
#

更多用法,可以通过 man curl 进一步了解。

Demon.Lee 2023-02-10 13:06

这同样适用于日常写作。

Demon.Lee 2023-02-10 10:23

在 VMware(VMware Fusion M1) vm 中,使用 chrony 配置时钟同步,但将 vm suspend 一段时间再 resume,时间不会同步,还是此前的时间。这可能是 VMware 本身的 bug,在折腾了不少时间后,终于可以正常运行,以下是配置(/etc/chrony/chrony.conf):

# Welcome to the chrony configuration file. See chrony.conf(5) for more
# information about usable directives.

# Include configuration files found in /etc/chrony/conf.d.
confdir /etc/chrony/conf.d

# This will use (up to):
# - 4 sources from ntp.ubuntu.com which some are ipv6 enabled
# - 2 sources from 2.ubuntu.pool.ntp.org which is ipv6 enabled as well
# - 1 source from [01].ubuntu.pool.ntp.org each (ipv4 only atm)
# This means by default, up to 6 dual-stack and up to 2 additional IPv4-only
# sources will be used.
# At the same time it retains some protection against one of the entries being
# down (compare to just using one of the lines). See (LP: #1754358) for the
# discussion.
#
# About using servers from the NTP Pool Project in general see (LP: #104525).
# Approved by Ubuntu Technical Board on 2011-02-08.
# See http://www.pool.ntp.org/join.html for more information.
# modify by demon, 2023.02.08
pool ntp.aliyun.com iburst minpoll 1 maxpoll 2
pool ntp1.aliyun.com iburst minpoll 1 maxpoll 2
pool ntp2.aliyun.com iburst minpoll 1 maxpoll 2
pool time1.cloud.tencent.com iburst minpoll 1 maxpoll 2
pool time2.cloud.tencent.com iburst minpoll 1 maxpoll 2
pool time3.cloud.tencent.com iburst minpoll 1 maxpoll 2
pool ntp.tuna.tsinghua.edu.cn iburst minpoll 1 maxpoll 2
pool ntp.ntsc.ac.cn iburst minpoll 1 maxpoll 2

# Use time sources from DHCP.
sourcedir /run/chrony-dhcp

# Use NTP sources found in /etc/chrony/sources.d.
sourcedir /etc/chrony/sources.d

# This directive specify the location of the file containing ID/key pairs for
# NTP authentication.
keyfile /etc/chrony/chrony.keys

# This directive specify the file into which chronyd will store the rate
# information.
driftfile /var/lib/chrony/chrony.drift

# Save NTS keys and cookies.
ntsdumpdir /var/lib/chrony

# Uncomment the following line to turn logging on.
#log tracking measurements statistics

# Log files location.
logdir /var/log/chrony

# Stop bad estimates upsetting machine clock.
maxupdateskew 100.0

# This directive enables kernel synchronisation (every 11 minutes) of the
# real-time clock. Note that it can’t be used along with the 'rtcfile' directive.
rtcsync

# Step the system clock instead of slewing it if the adjustment is larger than
# one second, but only in the first three clock updates.
#makestep 1 3
makestep 1 -1

# Get TAI-UTC offset and leap seconds from the system tz database.
# This directive must be commented out when using time sources serving
# leap-smeared time.
leapsectz right/UTC

主要改动点:
1、ntp 服务器地址,如 pool ntp.aliyun.com iburst minpoll 1 maxpoll 2
2、强制 chronyd 步进系统时钟:makestep 1 -1

其中起主要作用的是第 2 点。关于这些参数的含义,请参考官方文档

P.S. 预操作(如安装 chrony 等),以下基于 Ubuntu 22.04:

1、移除可能已经默认安装的 ntp 服务:sudo apt remove ntp -y
2、安装 chrony 服务:sudo apt install chrony -y
3、启用并启动 chrony 服务:sudo systemctl enable chrony.service && sudo systemctl start chrony.service
4、配置时间同步:sudo timedatectl set-ntp true

ubuntu-2204% timedatectl
               Local time: Fri 2023-02-10 10:45:47 CST
           Universal time: Fri 2023-02-10 02:45:47 UTC
                 RTC time: Fri 2023-02-10 02:45:48
                Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
ubuntu-2204%

相关逻辑可以通过 man timedatectlman systemd-timedated.service 了解。

Demon.Lee 2023-02-09 13:49

买电子书会员的好处之一,就是可以把书库当做字典来用。

当你想了解某个方面的知识时,可以直接打开相关的书籍学习,这可能要比看各类博客更靠谱,因为那些内容的质量没有保障,参差不齐。

你可以只翻一翻,或者看看目录,对整个知识体系有一个粗略的了解;
你也可以深入阅读某个章节,对标工作时遇到的一个难题。

同样,在某个平台上买很多网络课程,也可以这么用。

一个平台就是一个知识库,记得多用,多搜索。

Demon.Lee 2023-02-09 12:46

1、对一种事物的上瘾,是对另一种事物的逃避。
2、《断舍离》中提到三种扔不掉东西的人:

  • 逃避现实型
  • 执着过去型
  • 担忧未来型

3、我们要断舍离的不仅仅是物质垃圾,还有精神垃圾。
4、当我们想逃避现实的时候,正是空虚、孤独、无聊的时候,这些时候有一个共同点——意志力不足。这就导致我们很容易被“奶头乐”产品所吸引。一方面你的空虚寂寞冷产生了市场需求,另一方面奶头乐制造商给予你及时满足,这是一场合谋。如果我们不给自己及时干预,就会被算法操控。
5、那些我本该去阅读、跑步、陪伴家人、睡觉的时间,统统被短视频占据。猛然发现,短视频上的知识,根本不是真正的知识,它本质上是用知识拿来娱乐。当知识仅仅起到了娱乐的作用,那么它本质上和搞笑段子没有区别。
6、最容易被廉价快感吸引的人,是没有思想体系和内在秩序的人。因为不独立思考,所以就会被他人教唆;因为内心不平静,所以就会被奶头乐撩拨。
7、使用这些创造型APP的时候,你是在「主动」地使用手机,手机只是你的工具。而当你使用消费型APP的时候,你是在「被动」地接收信息,你容易被手机操控。

摘录自「楠子破圈」《手机上的廉价快感,真的得戒掉

99% 的人都在被手机 APP 消费,只有 1% 的人在创作,这就是我们为啥平庸的原因。

告诉自己,不只是当个看客,而是躬身入局,动起手来:

  • 拍点好看的照片
  • 剪辑一段视频
  • 写一篇文章
  • 录一段播客
  • 时常运动
  • 保证睡眠,不熬夜
  • ……
Demon.Lee 2023-02-08 23:43

Internet 可能是最有效率的信息工具,但同时也是最险恶的网络环境。

摘录自《Linux 网络管理员指南

Demon.Lee 2023-02-08 23:39

尘封千年,终见天日,但世间万物早已物是人非。

沧海桑田,真是令人感慨。

今天知道了一个被埋没数百年的唐朝民间诗人:王梵志

Demon.Lee 2023-02-07 12:51

人活在这个世上,每一日都有每一日的麻烦,每一日都有每一日的烦恼。当你站在每一天里面对它们,心境会随之起伏不定。但是只要把时间稍微放得长久一点,所有的细节,所有的波动都会被抚平。这两年间,我亲身经历过短视频对阅读的掠夺,眼见着阅读量一天比一天跌下去,眼见着赞赏金额去掉一半,去掉四分之三,直到公众号全盛时代的十分之一。

如果一个人有一件自己喜欢做的事,再加上自己比较傻一点,世间的纷纷扰扰,每一个当下的困难和烦恼就不会构成多大的问题—时间会像熨斗一样,把一切都熨平整。

这件事整体上就跟坚持无关,和毅力无关,只和一个人如何与他自己相处有关,如何看待时间和生命有关,如何对付困难和烦恼有关。人生中的诸多问题,哪里是可以靠坚持和毅力就能解决的?

大家各自也都在自己的路上,有些人走起来热闹,有些人走起来孤独,但是每一个人所面临的课题都是一致的,那就是应该拥有怎样的一颗心才能走远路。我说这样走就可以,这是我的走法。那么,在你知道一种可能之后,你也需要找到你自己的走法。

摘自和菜头·《连更两年》。

别说日更,我连周更都做不到,膜拜。

还是那句话,要想拥有更多的同理心,去写作,去做事,去行动。

Demon.Lee 2023-02-04 16:25

通过 awk 来分割字符串:docker images|awk '{print $1}'

但如果要对分割的字符串进行拼接呢?使用方式如下:
docker images|awk '{print $1 ":"$2}'

参考:stackoverflow.com