跳到主要内容

博客

代码人生:编织技术与生活的博客之旅

sudo apt install rdfind
rdfind -deleteduplicates true /media/faonecze/资料存档/

windows 用 DoubleKiller.exe 还挺方便的

编程阅读需 1 分钟

自己喜欢啥,总要一遍一遍和朋友介绍,感觉比较麻烦,这样汇总一下,方便朋友一次性安利。

ps. 每个工具其实在 B 站都有视屏科普,大佬们也可以上 B 站看看。

硬件

键盘: Anne pro 2

  • 全键自定义
  • tap key: 支持轻触方向键
  • magic key: CaspLk 也可以自定义设置为 FN 键
  • 键盘宏
  • 自定义 rgb
  • type-C 充电
  • USB + 蓝牙双模
  • 四蓝牙连接
  • 带电量显示:Fn2 + 8

缺点是没有静音版本,选了红轴默认不按到底,勉勉强强声音不大。
有个注意点是,当线连接电脑,没关掉蓝牙的话,默认还是蓝牙输入输出,线支持充电。


鼠标:罗技 M590

静音,用电久,自定义鼠标滚轮左右方向,双蓝牙,多设备支持 Logitech Flow,缺点是不好看。

鼠标:罗技 M720

同上款,自定义按键更多,据说有二三十个。缺点是不静音。


软件

ps. 本人是全 windows 开发。

伪 Linux 系统

wsl2 支持 docker 了,Terminus 配上个炫酷的半透明界面,oh my zsh 自带各种插件好用的哼,一套下来,windows 变 Linux,并且 pycharm 支持基于 wsl 开发,巴适得很。

关于 sz rz 传输 我这里有个 解决方案

Terminus 需要准备一下

wsl2 默认 root 用户

  • ubuntu config --default-user root

一个 windows 路径转换脚本,建议放到用户执行目录上,复制的 windows 路劲快速转换为 Linux。

#!/usr/bin/env python
# encoding: utf-8
# Created by zza on 2021/6/9 14:23
import re

from prompt_toolkit.clipboard import pyperclip

def convert_path():
path = pyperclip.pyperclip.paste() # r'/mnt/d/Programs/ActivityWatch'
wsl_result = re.match(r"(^[A-Z]:)\\(.*)", path)
if wsl_result:
_disk_symbol = wsl_result[1][:-1].lower()
wsl_path = f'\\mnt\\{_disk_symbol}\\{wsl_result[2]}'.replace('\\', '/')
pyperclip.pyperclip.copy(wsl_path)
print(wsl_path)
return wsl_path
elif re.match(r"^/mnt/([a-z])/(.*)", path):
win_result = re.match(r"^/mnt/([a-z])/(.*)", path)
tail = win_result[2].replace("/", "\\")
win_path = f'{win_result[1].upper()}:\\{tail}'
pyperclip.pyperclip.copy(win_path)
print(win_path)
return win_path
else:
print(f'nothing to do with {path}')
return

if __name__ == '__main__':
pyperclip.pyperclip.copy('D:\\Programs\\ActivityWatch')
convert_path()
print(pyperclip.pyperclip.paste())

  • 输入一下命令切换剪贴板里的路径,还是很舒服的。

  • 之前用的 cmder 感觉还行,但是和 terminus 相比,界面就丑了很多。


办公套件 to do list + outlook

待办不管是上班还是平时都用得上。
[[outlook 支持将邮件自动转入待办]]。

顺便说一下,outlook 的日历管理也很香。

手机日历上选择 Exchange 导入方式导入日历,就手机端和电脑端同步了。


分屏利器 PowerToys

这个每个 帖子 都讲烂了,自己看把。

顺便说说 windows 虚拟桌面(部分小伙伴不知道)

windows + ctrl + d 创建桌面
windows + ctrl + f4 删除桌面
windows + ctrl +方向键 快速移动

好了恭喜你拥有了无数个虚拟桌面。可以给桌面命名,把摸鱼桌面,学习桌面,工作桌面,看板桌面分开。

番茄时钟

google play 搜索 Tea Time

  • 支持多个定时器同时启动
  • 自定义是闹钟还是震动
  • 安卓桌面组件,快速启动,支持自定义外观。


随笔阅读需 3 分钟

如何在 python 异步函数中 debug


import asyncio
from aredis import StrictRedis
import nest_asyncio

# pip3 install aredis[hiredis]
# pip3 install nest_asyncio

async def example():
client = StrictRedis(host='127.0.0.1', port=6379, db=0)
await client.flushdb()
# error await client.flushdb()
# error asyncio.get_event_loop().run_until_complete(client.flushdb())
# error asyncio.new_event_loop().run_until_complete(client.flushdb())
# error asyncio.run(client.flushdb())

await client.set('foo', 1)
assert await client.exists('foo') is True
await client.incr('foo', 100)

assert int(await client.get('foo')) == 101
await client.expire('foo', 1)
await asyncio.sleep(0.1)
await client.ttl('foo')
await asyncio.sleep(1)
assert not await client.exists('foo')

loop = asyncio.get_event_loop()
# success nest_asyncio.apply()
loop.run_until_complete(example())

Python阅读需 1 分钟

windows 进程 监控

  • windows wmi-exporter 进程监控
    • 对应的看板 dashboard Id 10467
    • 没有进程数据
      • 服务器管理器找到 WMI exporter
        • 添加参数 --collectors.enabled "[defaults],process,container"
Grafana Status Map Panel not working, shows "Panel plugin not found: flant-statusmap-panel" #197
  • 解决方法
    • Open your Grafana instance and go to the Plugins section in the left-hand -nu.
    • Search for "statusmap" in the search bar.
    • Click on the "Install" button for the "statusmap" plugin.
    • Wait for the installation to complete.\

Grafana + prometheus + node-exporter docker-compose.yml

vim prometheus/docker-compose.yml

version: "3.7"
services:
node_exporter:
image: quay.io/prometheus/node-exporter:latest
container_name: node_exporter
command:
- '--path.rootfs=/host'
user: "1000"
network_mode: host
# pid: host
restart: unless-stopped
volumes:
- '/:/host:ro,rslave'
prometheus:
image: prom/prometheus:latest
container_name: "prometheus"
restart: always
ports:
- "9111:9090"
volumes:
- "./prometheus.yml:/etc/prometheus/prometheus.yml"
- "./prometheus_data:/prometheus"
grafana:
image: grafana/grafana
container_name: "grafana"
ports:
- "3000:3000"
restart: always
volumes:
- "./grafana_data:/var/lib/grafana"
process-exporter:
image: ncabatoff/process-exporter
command: --procfs /host/proc -config.path /config/process-exporter-config.yml
privileged: true
volumes:
- /proc:/host/proc
- ./process-exporter-config.yml:/config/process-exporter-config.yml
ports:
- "9256:9256"
restart: always

vim prometheus/prometheus.yml - 需要根据自己的 ip 进行修改器

global:
scrape_interval: 15s # 默认抓取周期
external_labels:
monitor: "codelab-monitor"
scrape_configs:
- job_name: "node-exporter" #服务的名称
scrape_interval: 5s
metrics_path: /metrics #获取指标的 url
static_configs:
- targets: ["192.168.31.2:9100"] # 这个为监听指定服务服务的 ip 和 port,需要修改为自己的 ip,貌似云服务必须用公网 ip
- job_name: "process-exporter"
scrape_interval: 5s
metrics_path: /metrics
static_configs:
- targets: ["192.168.31.2:9256"]
- job_name: "windows-laptop"
scrape_interval: 5s
metrics_path: /metrics
static_configs:
- targets: ["192.168.31.3:9182"]
- job_name: "other-node-192.168.31.5-node-exporter"
scrape_interval: 5s
metrics_path: /metrics
static_configs:
- targets: ["192.168.31.5"]

node-exporter linux 服务器状态监控

prometheus 相关

看板 Grafana

  • http://ip:9111/3000

  • 配合 node - 的 Dashborad 编号是 9276

    • Grafana 直接搜索 id 就能找到别人分享的看板。
    • 需要单独配置下 网络 io 图表。
    • 都是可视化的 先再 node-exporter 里找到相关指标,然后可视化点点点就能出现数据。
编程阅读需 2 分钟

买了个二手 mini 主机,刷成 ubunu 在家里当服务器用。

服务器配置

  • 天虹迷你主机
    • 电脑型号 - X64 兼容笔记本电脑(扫描时间:2022 年 11 月 15 日)
    • 操作系统 - Windows 10 专业版 64 位 (4.09.000904)
    • 处理器 - AMDA6-Series A6-1450 四核
    • 主板 - U14G-M ( AMD PCI standard host CPU bridge )
    • 内存 - 8 GB(极匠 DDR3L1600MHz)
    • 主硬盘 - 极匠 GJN128G(128GB/固态硬盘)
    • 显卡 - AMD Radeon HD 8250/8280G(512 MB/AMD)
    • 显示器 - NTP2401NT24GMB18()(52 英寸)
    • 声卡 - 瑞 ALC662 @AMD High Definition Audio Controller
    • 网卡 - 博通 BCM430N 80211n Network Adapter

小服务器

  • 需求
    • docker
    • 旁路由
    • 移动硬盘共享
  • 优先
    • 声音小
    • 耗电小
  • 测量耗电量
    • 小米智能插座

需要调查

  • 网口理速度
    • ethtool enp2s0
      • 1000baseT/Full 理论支持千兆网
  • 硬盘直接插 和 usb3.0 插入的差别
    • usb3.0 5 GPS 625 MB/s
    • SATA2 3Gbps 375MB/s -> 300MB/s
    • SATA3 6Gbps 750MB/s -> 600MB/s
  • 网口 与 usb3.0 or usb2.0 转网口的速率区别
    • USB3.0 传输速率达 USB 2.0 十倍,USB 2.0 的速率为 480 Mbps,而 USB 3.0 则可达到 4.8 Gbps。
    • 自带网口速度差不多 1000 MB/s
  • 网速测试
    • 内网测速 iperf3
      • 2.24 GBytes
      • 321 Mbits/sec
    • 一键测速 speedtest-cli
      • Download: 30.12 Mbit/s
      • Upload: 16.61 Mbit/s

U 盘启动器下载

  • 微 pe
    • 不能装 Linux
  • linux 下载 - ubuntu-22.04.1-live-server-amd64.iso
  • Universal-USB-Installer-2.0.0.8.exe

ubuntu 联 wifi

network:
version: 2
renderer: NetworkManager
wifis:
wlan0:
dhcp4: true
access-points:
"holypangci_5G":
password: "111111111"
dhcp6: true

功耗

  • 用的小米智能插座
  • 刚开机 啥也不跑 0.1 kWh
  • 当前功率 10w
  • 月功率 0.27 kWH

挂载硬盘

  • 挂载硬盘

  • nas docker 参考

  • 开机检测 在开机的时候 检测到移动硬盘 自动挂载

    • sudo lsblk
    • sudo fdisk -l
    • sudo mount -t auto /dev/sda2 /mnt/data
  • systemctl restart smbd.service

  • [[clash]]

    network:
version: 2
renderer: networkd
ethernets:
enp2s0:
dhcp4: true
optional: true

docker

  • 摸鱼工具使用 docker run -it --rm svenstaro/genact

  • docker 安装

$ sudo vim /etc/docker/daemon.json

{
"registry-mirrors": [
"https://hub-mirror.c.163.com",
"https://ustc-edu-cn.mirror.aliyuncs.com",
"https://ghcr.io",
"https://mirror.baidubce.com"
]
}

通过正在运行的 docker pod 获取 docker-compose.yaml

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock red5d/docker-autocompose <container-name-or-id>
sudo docker run --rm -v /var/run/docker.sock:/var/run/docker.sock red5d/docker-autocompose epic_bartik
sudo docker stop $(sudo docker ps -aq)

samba

硬盘读写测试

参考

  • ssd 读写
zza@zza-server:smb_tmp % time dd if=/dev/zero of=./testReadOrWrite bs=8k count=100000
记录了100000+0 的读入
记录了100000+0 的写出
819200000字节(819 MB,781 MiB)已复制,5.94344 s,138 MB/s
dd if=/dev/zero of=./testReadOrWrite bs=8k count=100000 0.16s user 4.67s system 80% cpu 6.003 total
zza@zza-server:smb_tmp % time dd if=./testReadOrWrite of=/dev/null bs=8k count=100000
记录了100000+0 的读入
记录了100000+0 的写出
819200000字节(819 MB,781 MiB)已复制,0.852206 s,961 MB/s
dd if=./testReadOrWrite of=/dev/null bs=8k count=100000 0.06s user 0.79s system 99% cpu 0.857 total
zza@zza-server:smb_tmp % time dd if=./testReadOrWrite of=./testReadAndWrite bs=8k count=100000
记录了100000+0 的读入
记录了100000+0 的写出
819200000字节(819 MB,781 MiB)已复制,6.46195 s,127 MB/s
dd if=./testReadOrWrite of=./testReadAndWrite bs=8k count=100000 0.13s user 5.27s system 83% cpu 6.507 total
  • 机械硬盘读写
zza@zza-server:tmp % time dd if=/dev/zero of=./testReadOrWrite bs=8k count=100000
记录了100000+0 的读入
记录了100000+0 的写出
819200000字节(819 MB,781 MiB)已复制,42.5608 s,19.2 MB/s
dd if=/dev/zero of=./testReadOrWrite bs=8k count=100000 0.28s user 7.69s system 18% cpu 42.591 total
zza@zza-server:tmp % time dd if=./testReadOrWrite of=/dev/null bs=8k count=100000
记录了100000+0 的读入
记录了100000+0 的写出
819200000字节(819 MB,781 MiB)已复制,0.835777 s,980 MB/s
dd if=./testReadOrWrite of=/dev/null bs=8k count=100000 0.08s user 0.76s system 99% cpu 0.840 total
zza@zza-server:tmp % time dd if=./testReadOrWrite of=./testReadAndWrite bs=8k count=100000
记录了100000+0 的读入
记录了100000+0 的写出
819200000字节(819 MB,781 MiB)已复制,42.0116 s,19.5 MB/s
dd if=./testReadOrWrite of=./testReadAndWrite bs=8k count=100000 0.29s user 8.90s system 21% cpu 42.039 total
随笔阅读需 4 分钟

  • 参考
  • 笔记本直接看这个人
    • 夏蒙乾
    • 但是最近(2023-02-09)还是不推荐买,能增加内存、ssd 的机型要么过于贵、要么其他方面不行。

CPU 选择


总体配置

  • CPU+主板 B660M-PLUS + i7-12700F ¥3109

    • B660M-PLUS ¥1060
    • i7-12700F ¥2130
    • cpu 65 w
  • 散热 利民 PA120 ¥169

    • 光太亮了,不能直视。
  • 内存 骇客神条 16g x 2 = ¥1099.00

    • DDR4 会便宜很多,主板就得换一个(也会便宜很多)
  • 固态 宏碁 GM7000 1T 649

  • 电源 酷冷 GX850 ¥594

    • 后期如果要上 3090 还得是千瓦电源
  • 机箱 先马(SAMA)颜之神 钛灰色 ¥226

  • 风扇 利民 12 厘米风扇 3 个,安装在尾部和顶部 ¥53

    • 声音大
  • 显卡 3070 卡诺基 ¥2199

    • 购买日的前两天涨价了 200 块,卡诺基在翻新卡里算口碑不错的。
  • 总价 7449


功率

最简单粗暴的电源计算办法,把 CPU 和 GPU 的功耗加起来再加上 100W,可以粗略算出配置的整体功耗。】

电源 850w + 100w + 65w (cpu)

固态

空盘测试数据

AS SSD Benchmark




AS SSD Benchmark 2.0.7316.34247
------------------------------
Name: Fanxiang S690 2TB
Firmware: SN07443
Controller: stornvme
Offset: 16384 K - OK
Size: 1863.01 GB
Date: 2023/2/13 11:18:00
------------------------------
Sequential:
------------------------------
Read: 4215.19 MB/s
Write: 3722.04 MB/s
------------------------------
4K:
------------------------------
Read: 79.78 MB/s
Write: 222.97 MB/s
------------------------------
4K-64Threads:
------------------------------
Read: 2091.47 MB/s
Write: 1283.86 MB/s
------------------------------
Access Times:
------------------------------
Read: 0.016 ms
Write: 0.060 ms
------------------------------
Score:
------------------------------
Read: 2593
Write: 1879
Total: 5783
------------------------------

CrystalDiskMark

------------------------------------------------------------------------------
CrystalDiskMark 8.0.1 x64 (C) 2007-2021 hiyohiyo
Crystal Dew World: https://crystalmark.info/
------------------------------------------------------------------------------
* MB/s = 1,000,000 bytes/s [SATA/600 = 600,000,000 bytes/s]
* KB = 1000 bytes, KiB = 1024 bytes

[Read]
SEQ 1MiB (Q= 8, T= 1): 4858.861 MB/s [ 4633.8 IOPS] < 1509.94 us>
SEQ 1MiB (Q= 1, T= 1): 4486.361 MB/s [ 4278.5 IOPS] < 233.60 us>
RND 4KiB (Q= 32, T= 1): 883.414 MB/s [ 215677.2 IOPS] < 143.61 us>
RND 4KiB (Q= 1, T= 1): 79.243 MB/s [ 19346.4 IOPS] < 51.61 us>

[Write]
SEQ 1MiB (Q= 8, T= 1): 4467.455 MB/s [ 4260.5 IOPS] < 1849.33 us>
SEQ 1MiB (Q= 1, T= 1): 4459.696 MB/s [ 4253.1 IOPS] < 234.96 us>
RND 4KiB (Q= 32, T= 1): 423.689 MB/s [ 103439.7 IOPS] < 304.18 us>
RND 4KiB (Q= 1, T= 1): 257.067 MB/s [ 62760.5 IOPS] < 15.85 us>

Profile: Default
Test: 1 GiB (x5) [E: 0% (0/1863GiB)]
Mode: [Admin]
Time: Measure 5 sec / Interval 5 sec
Date: 2023/02/13 11:28:35
OS: Windows 10 Professional [10.0 Build 22621] (x64)

写入 1T+ 数据后

AS SSD Benchmark 2

AS SSD Benchmark 2.0.7316.34247
------------------------------
Name: Fanxiang S690 2TB
Firmware: SN07443
Controller: stornvme
Offset: 16384 K - OK
Size: 1863.01 GB
Date: 2023/2/14 11:04:19
------------------------------
Sequential:
------------------------------
Read: 4150.81 MB/s
Write: 4084.55 MB/s
------------------------------
4K:
------------------------------
Read: 63.06 MB/s
Write: 204.81 MB/s
------------------------------
4K-64Threads:
------------------------------
Read: 2089.18 MB/s
Write: 1283.93 MB/s
------------------------------
Access Times:
------------------------------
Read: 0.087 ms
Write: 0.071 ms
------------------------------
Score:
------------------------------
Read: 2567
Write: 1897
Total: 5776
------------------------------

CrystalDiskMark 2

------------------------------------------------------------------------------
CrystalDiskMark 8.0.1 x64 (C) 2007-2021 hiyohiyo
Crystal Dew World: https://crystalmark.info/
------------------------------------------------------------------------------
* MB/s = 1,000,000 bytes/s [SATA/600 = 600,000,000 bytes/s]
* KB = 1000 bytes, KiB = 1024 bytes

[Read]
SEQ 1MiB (Q= 8, T= 1): 4828.908 MB/s [ 4605.2 IOPS] < 1728.61 us>
SEQ 1MiB (Q= 1, T= 1): 4506.055 MB/s [ 4297.3 IOPS] < 232.57 us>
RND 4KiB (Q= 32, T= 1): 808.553 MB/s [ 197400.6 IOPS] < 156.88 us>
RND 4KiB (Q= 1, T= 1): 71.322 MB/s [ 17412.6 IOPS] < 57.27 us>

[Write]
SEQ 1MiB (Q= 8, T= 1): 4393.255 MB/s [ 4189.7 IOPS] < 1906.56 us>
SEQ 1MiB (Q= 1, T= 1): 4383.751 MB/s [ 4180.7 IOPS] < 239.06 us>
RND 4KiB (Q= 32, T= 1): 405.718 MB/s [ 99052.2 IOPS] < 322.86 us>
RND 4KiB (Q= 1, T= 1): 247.658 MB/s [ 60463.4 IOPS] < 16.43 us>

Profile: Default
Test: 1 GiB (x5) [E: 66% (1226/1863GiB)]
Mode: [Admin]
Time: Measure 5 sec / Interval 5 sec
Date: 2023/02/14 11:09:57
OS: Windows 10 Professional [10.0 Build 22621] (x64)

随笔阅读需 4 分钟

参考

想法

  • 接微信机器人
    • 群友对话直接 at 机器人、以指令开头、触发逻辑。
  • 接 chatgpt
    • 根据问题与获取的卦辞或者表达的象征,通过有预设的 gpt 做解释后发回给群友。

代码部分

十二地支时间换算


import datetime
from lunardate import LunarDate

Zhi = ["子", "醜", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"]

def get_factor_time(time:datetime.datetime=None):
if time is None:
time = datetime.datetime.now()
# 获取农历时间
lunar_time = LunarDate.fromSolarDate(time.year, time.month, time.day)
# 输出农历时间
lunar_month = lunar_time.month
lunar_day = lunar_time.day
lunar_hour = time.hour//2
print(f"农历时间:{lunar_month}{lunar_day}{lunar_hour}({Zhi[lunar_hour]}) 时")

完整代码

#!/usr/bin/env python
# encoding: utf-8
# @Time : 2023/07/04 01:05:33
# @author : zza
# @Email : z740713651@outlook.com
# @File : xiao_liu_ren.py
from collections import defaultdict
import datetime
from lunardate import LunarDate

Zhi = ["子", "醜", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"]
xiao_liu_ren = [
"大安",
"留连",
"速喜",
"赤口",
"小吉",
"空亡",
]

def get_factor_time(time: datetime.datetime = None):
if time is None:
time = datetime.datetime.now()
print(f"阳历时间:{time.isoformat()}")
# 获取农历时间
lunar_time = LunarDate.fromSolarDate(time.year, time.month, time.day)
# 输出农历时间
lunar_month = lunar_time.month
lunar_day = lunar_time.day
lunar_hour = (time.hour + 1) // 2
print(f"农历时间:{lunar_month}{lunar_day}{Zhi[lunar_hour]}({lunar_hour}) 时")

factor_month = xiao_liu_ren[(lunar_month - 1) % 6]
factor_day = xiao_liu_ren[(lunar_month - 1 + lunar_day - 1) % 6]
factor_hour = xiao_liu_ren[(lunar_month - 1 + lunar_day - 1 + lunar_hour) % 6]
print(f"小六壬月日时:{factor_month} {factor_day} {factor_hour}")

return factor_month, factor_day, factor_hour

def lost_item(factor):
guaci = {
"大安": {
"留连": "大安加留连,失物西北去。",
"速喜": "大安加速喜,失物当日见。",
"赤口": "大安加赤口,失物不用找。",
"小吉": "大安加小吉,失物不出门。",
"空亡": "大安加空亡,失物无踪影。",
"大安": "大安加大安,失物在家里。",
},
"留连": {
"大安": "留连加大安,物在家中藏。",
"速喜": "留连加速喜,失物三天里。",
"赤口": "留连加赤口,失物准丢失。",
"小吉": "留连加小吉,失物东南去。",
"空亡": "留连加空亡,失物不见面。",
"留连": "留连加留连,失物落在南。",
},
"速喜": {
"赤口": "速喜加赤口,失物往正北。",
"小吉": "速喜加小吉,失物在家里。",
"空亡": "速喜加空亡,失物不久见。",
"大安": "速喜加大安,失物不丢失。",
"留连": "速喜加留连,失物无信息。",
"速喜": "速喜加速喜,失物落正南。",
},
"赤口": {
"小吉": "赤口加小吉,失物无信息。",
"空亡": "赤口加空亡,失物不用找。",
"大安": "赤口加大安,失物东北找。",
"留连": "赤口加留连,失物不回还。",
"速喜": "赤口加速喜,失物有着落。",
"赤口": "赤口加赤口,失物正西找。",
},
"小吉": {
"空亡": "小吉加空亡,失物正东找。",
"大安": "小吉加大安,失物自己出。",
"留连": "小吉加留连,失物上西南。",
"速喜": "小吉加速喜,失物在院里。",
"赤口": "小吉加赤口,失物丢了手。",
"小吉": "小吉加小吉,失物在西南。",
},
"空亡": {
"大安": "空亡加大安,失物反复间。",
"留连": "空亡加留连,失物永不还。",
"速喜": "空亡加速喜,失物在家里。",
"赤口": "空亡加赤口,失物往远走。",
"小吉": "空亡加小吉,失物回家里。",
"空亡": "空亡加空亡,失物寻不见。",
},
}
return guaci[factor[1]][factor[2]]

if __name__ == "__main__":
# get_factor_time()
# 日上起時。 假如三月初五日辰時:三月在速喜上;就速喜上起初一;初五在大安;大安上起子時;數至辰時即是小吉; 以類推占,餘皆倣此。
# 速喜 大安 小吉
res = get_factor_time(datetime.datetime(2023, 4, 24, 7, 15))
assert res == ("速喜", "大安", "小吉"), res
res = lost_item(res)
assert res == "大安加小吉,失物不出门。", res

res = get_factor_time(datetime.datetime(2022, 4, 30, 8, 20))
assert res == ("速喜", "留连", "空亡"), res
res = lost_item(res)
assert res == "留连加空亡,失物不见面。", res

表象属性

大安
不动 木 青色 东 吉祥
大安事事昌,求谋在东方,失物去不远

留连
慢 四方土 黑色 纠狸 拖延
留连事难成,求谋日未明,官事只宜缓

速喜
快速 火 红色 南方
吉利求财向南行,失物申未午(南或西南)

赤口
吵 金 白色 西方 凶险
赤口主口舌,官非切要防,失物急去寻

小吉
主动 缓慢 水 北方 吉利
小吉最吉昌,失物在坤方(西南)

空亡
无 随性 中央土 黄色 难以找回
空亡事不禅,失物寻不见

卦辞

大安日

  • 大安加留連,辦事不周全,失物西北去,婚姻晚幾天。
  • 大安加速喜,事事自己起,失物當日見,婚姻自己提。
  • 大安加赤口,辦事不順手,失物不用找,婚姻兩分手。
  • 大安加小吉,事事從己及,失物不出門,婚姻成就地。
  • 大安加空亡,病人要上床,失物無蹤影,事事不順情。

留連日

  • 留連加大安,辦事兩分張,婚姻有喜事,先苦後來甜。
  • 留連加速喜,事事由自己,婚姻有成意,失物三天裡。
  • 留連加赤口,病者死人口,失物準丟失,婚姻兩分手。
  • 留連加小吉,事事不用提,失物東南去,病者出人齊。
  • 留連加空亡,病人準死亡,失物不見面,婚姻兩分張。

速喜日

  • 速喜加赤口,自己往外走,失物往正北,婚姻得勤走。
  • 速喜加小吉,婚姻有人提,病人當天好,時物在家裡。
  • 速喜加空亡,婚姻有分張,病者積極治,失物不久見。
  • 速喜加大安,事事都平安,姻姻成全了,佔病都相安。
  • 速喜加留連,婚姻不可言,失物無資訊,病人有仙緣。

赤口日

  • 赤口加小吉,辦事自己提,婚姻不能成,失物無資訊。
  • 赤口加空亡,無病也上床,失物不用找,婚姻不能成。
  • 赤口加大安,辦事險和難,失物東北找,婚姻指定難。
  • 赤口加留連,辦事有困難,行人在外走,失物不回還。
  • 赤口加速喜,婚姻在自己,失物有著落,辦事官事起。

小吉日

  • 小吉加空亡,病人不妥當,失物正東找,婚姻再想想。
  • 小吉加大安,事事兩週全,婚姻當日定,失物自己損。
  • 小吉加留連,事事有反還,婚姻有人破,失物上西南。
  • 小吉加速喜,事事從頭起,婚姻能成就,失物在院裡。
  • 小吉加赤口,辦事往外走,婚姻有難處,失物丟了手。

空亡日

  • 空亡加大安,事事不周全,婚姻從和好,失物反覆間。
  • 空亡加留連,辦事處處難,婚姻重新定,失物永不還。
  • 空亡加速喜,事事怨自己,婚姻有一定,失物在家裡。
  • 空亡加赤口,辦事官非有,婚姻難定準,失物往遠走。
  • 空亡加小吉,事事有猜疑,婚姻有喜事,失物回家裡。
Python阅读需 6 分钟

Microsoft-to-do and Calendar synchronization problem

I use Microsoft-to-do to make a daily plan, but sometimes, I need to check-up if there is free time to give a session or something else. I need my Microsoft-to-do plan will show in Outlook.com's Calendar. Make a better way to me view my schedule.

我使用 Microsoft to do 来制定每日计划,但有时,我需要检查是否有空闲时间进行会议或其他活动。我需要我的 Microsoft 待办计划将显示在 Outlook.com 的日历。给我一个更好的方法来查看我的时间表。

I use Power Automate to make a action for create event when I made item at Microsoft-to-do. However, we need to write the reminder time when creating the to-do item.

在我创建一个待办时,Power Automate 会收到通知,并创建一个日历事件。 但是,我们需要在创建待办时,同时写上提醒时间。

English Step

First click Power Automate website and login with your Microsoft-account.

  • My flows - New flow - Automated cloud flow
    • give the flow a name. eg to-do Calendar sync
    • the triggers use when a task is add - Outlook Tasks
    • click create.
  • Choses the folder where you will create tasks
  • click New step
  • search Condition - Control
    • Reminder | is not equal to | (empty)
  • If yes
    • search Create event (V3) - Outlook.com
      • Calendar id - your Calendar name
      • Subject - Subject (with a check sign box)
      • Start time - Reminder Date-Time (with a check sign box)
      • End time - Reminder Date-Time (with a check sign box)
    • click Add action (if you need email notice)
    • search Send an email(V2) - Outlook.com
      • To - your email
      • Subject - Auto create by To-Do : Subject(with a check sign box)
      • Body
        • The context is decide by you.
  • If no
    • do nothing
  • Save

中文步骤

使用 outlook 邮箱账号登录 Power Automate

  • 我的流 - 新流 - 自动化云端流
    • 随便起个名字
    • 搜索触发器 在添加任务时 - Outlook Tasks
    • 点击创捷
  • 选择你会创建提醒任务的文件夹
  • 点击新步骤
  • 搜索 条件 - 控件
    • 提醒时间 | 不等于 | (放着不写)
  • 如果是
    • 搜索 创建事件 (V3) - Outlook.com
      • 日历 id - 你使用的日历的名字
      • 主题 - 主题 (有个打钩的框的)
      • 开始时间- 提醒日期(有个打钩的框的)
      • 结束时间 -提醒日期(有个打钩的框的)
    • 点击添加操作
    • 搜索 发送电子邮件 (V2) - Outlook.com
      • 到 - 填自己的邮箱
      • 主题 - 自动创建事件 : 主题(有个打钩的框的)
      • 正文
        • 随便写啦
  • 如果不是
    • 不动
  • 保存

Finish

Ok,now,when you create a to-do item with Reminder-date-time,it will be syncing in a few minutes. And send an email to you

好了,现在当你创建一个待办事项,并且有提醒时间的时候,他将会在一段时间内同步到日历上。并在完成后发送一份邮件到你填写的邮箱里。

随笔阅读需 3 分钟