惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tailwind CSS Blog
大猫的无限游戏
大猫的无限游戏
L
LINUX DO - 热门话题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
V
V2EX
GbyAI
GbyAI
量子位
Microsoft Azure Blog
Microsoft Azure Blog
有赞技术团队
有赞技术团队
G
Google Developers Blog
云风的 BLOG
云风的 BLOG
B
Blog
Microsoft Security Blog
Microsoft Security Blog
S
SegmentFault 最新的问题
O
OpenAI News
N
News and Events Feed by Topic
博客园 - Franky
爱范儿
爱范儿
Forbes - Security
Forbes - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V2EX - 技术
V2EX - 技术
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
News and Events Feed by Topic
N
News | PayPal Newsroom
Schneier on Security
Schneier on Security
Cloudbric
Cloudbric
Security Archives - TechRepublic
Security Archives - TechRepublic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Recent Commits to openclaw:main
Recent Commits to openclaw:main
人人都是产品经理
人人都是产品经理
P
Privacy International News Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
B
Blog RSS Feed
阮一峰的网络日志
阮一峰的网络日志
D
DataBreaches.Net
Last Week in AI
Last Week in AI
罗磊的独立博客
Spread Privacy
Spread Privacy
Recent Announcements
Recent Announcements
The Cloudflare Blog
Google DeepMind News
Google DeepMind News
AWS News Blog
AWS News Blog
The Register - Security
The Register - Security
Y
Y Combinator Blog
J
Java Code Geeks
I
Intezer

Blanboom

移动端 SSH + CLI Coding Agent 的实践与体验优化 HEIF & HEVC 转换器 1.0 发布:压缩 iOS 照片库,释放存储空间 一个 UniFi IPv6 问题的定位与解决 通过自定义 Prompts,让 Readwise Reader 为文章优化标题、添加中文摘要 通过 Waydroid 自动备份 NAS 照片到 Google Photos AirTerminal 2.2:Telnet 服务器、自动重连 AirTerminal 2.1:自定义字体、颜色主题、退格键映射 一次使用 ChatGPT 帮助我学习 L4S 的尝试 AirTerminal 2.0:支持连接多个蓝牙设备
将 Logseq 的昨日待办事项自动转移到今天
2023-09-09 · via Blanboom

虽然 Logseq 提供了强大的 Query 功能,能够汇总显示所有页面的待办事项,或者通过双链把待办事项链接到今日日志页面。但是,我更习惯用一种比较繁琐的方式整理待办事项:第二天早上,手动将前一天未完成的待办事项转移到当天的日志页面,前一天的日志中只保留笔记和已完成任务。

这种方式源自我之前用文本文件管理待办事项的习惯,它让我做到了每天回顾前一天完成的事情,并重新规划当天任务。当我使用 Logseq 后,也开始在 Logseq 中继续使用这种方式。不过,对于每天早上重复的复制粘贴操作,我还是感觉有点麻烦……

所以,我我想用一种「半自动化」的方式,让这个过程更加顺畅:也就是通过脚本,自动将前一天未完成的待办事项转移到今天。

由于我不熟悉 Logseq 插件的开发,所以我尝试了让 ChatGPT 生成一个 shell 脚本,完成这个任务:

#!/bin/bash

yesterday=$(date -d "yesterday" "+%Y_%m_%d")
today=$(date "+%Y_%m_%d")

input_file="${yesterday}.md"
output_file="${today}.md"
temp_file="temp.md"

awk '
BEGIN { RS = "\n"; FS = "\n"; ORS = "\n"; print_flag = 0; }
{
    # 确定哪些 block 从昨天转移到今天。可根据自己的使用习惯修改此处
    if ($1 ~ /^- (TODO|DOING)/) {
        print_flag = 1;
    } else if ($1 ~ /^- /) {
        print_flag = 0;
    }
    if (print_flag == 1) {
        print $0 >> "'"$output_file"'";
    } else {
        print $0 > "'"$temp_file"'";
    }
}
' "$input_file"

mv "$temp_file" "$input_file"

经过测试,脚本能够完美运行。我主要在 Windows 上使用 Logseq,所以我安装了 Git for Windows,然后为这个脚本创建快捷方式,添加到开始菜单。以后我就可以在每天早上,直接点击开始菜单中的快捷方式,实现待办事项的自动转移。

当然,这种方法也适用于 Obsidian,或者其他类似的纯文本笔记工具。