-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path._output.txt
416 lines (330 loc) · 23.1 KB
/
._output.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
File Name: hugo-server.sh
#!/bin/bash
lsof -ti:1313 | xargs kill
hugo server --ignoreCache &
open -a 'Google Chrome' http://localhost:1313/
-----------------
File Name: lastmod.py
import os
import frontmatter
import re
# 定义遍历的目录
dir_path = './' # 当前目录
for dirpath, dirnames, filenames in os.walk(dir_path):
for filename in filenames:
if filename.endswith('.md'):
filepath = os.path.join(dirpath, filename)
with open(filepath, 'r', encoding='utf-8') as file:
content = file.read()
# 通过正则表达式检查是否存在 date 字段但缺少 lastmod 字段
date_match = re.search(r'date: (.+)', content)
lastmod_match = re.search(r'lastmod: (.+)', content)
if date_match and not lastmod_match:
date_value = date_match.group(1)
# 在 date 字段后插入 lastmod 字段
content = content.replace(f"date: {date_value}", f"date: {date_value}\nlastmod: {date_value}")
# 将更新的内容写回文件
with open(filepath, 'w', encoding='utf-8') as file:
file.write(content)
print("Script completed!")
-----------------
File Name: open-news.sh
#!/bin/bash
open -a "NetNewsWire"
open https://x.com
open https://mastodon.social
-----------------
File Name: set_default_app.sh
#!/bin/bash
# Bundle Identifiers
# For example:
# mdls -name kMDItemCFBundleIdentifier /System/Applications/Books.app
# Get all bundle identifiers in /Applications
# lsappinfo list | rg --multiline '("[^"]*?") ASN:.*\n.*bundleID=("[^"]*?")' --replace '$1 $2' --only-matching
# System-Declared Uniform Type Identifiers
# https://developer.apple.com/library/archive/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html#//apple_ref/doc/uid/TP40009259
# 检查 duti 是否安装
if ! command -v duti &> /dev/null; then
echo "duti 未安装。请先安装 duti。"
exit 1
fi
# 设置文件类型与应用程序的关联
fileAssociations=(
# 图片文件
"com.interversehq.qView jpg"
"com.interversehq.qView jpeg"
"com.interversehq.qView png"
"com.interversehq.qView gif"
"com.interversehq.qView tiff"
"com.interversehq.qView bmp"
"com.interversehq.qView heic"
# 视频文件
"com.colliderli.iina mov"
"com.colliderli.iina mp4"
"com.colliderli.iina avi"
"com.colliderli.iina mkv"
"com.colliderli.iina m4v"
# 文本文件
"com.microsoft.VSCode txt"
"com.microsoft.VSCode xml"
"com.microsoft.VSCode opml"
"com.microsoft.VSCode json"
"com.microsoft.VSCode html"
"com.microsoft.VSCode css"
"com.microsoft.VSCode js"
"com.microsoft.VSCode ts"
"com.microsoft.VSCode tsx"
"com.microsoft.VSCode pub"
"abnerworks.Typora md"
"com.microsoft.Excel xls"
"com.microsoft.Excel xlsx"
# PDF 文件
"com.apple.iBooksX pdf"
)
# 错误日志
errors=()
# 应用设置
for association in "${fileAssociations[@]}"; do
app=$(echo "$association" | awk '{print $1}')
ext=$(echo "$association" | awk '{print $2}')
if ! duti -s "$app" "$ext" all; then
errors+=("设置 $ext 类型的默认应用程序为 $app 失败。")
fi
done
# 输出错误日志
if [ ${#errors[@]} -ne 0 ]; then
echo "以下文件类型的默认应用程序设置失败:"
for error in "${errors[@]}"; do
echo "$error"
done
exit 1
else
echo "默认应用程序全部设置成功。"
fi
-----------------
File Name: App_bundle_id.md
| 程序名称 | Bundle ID |
| --------------------------------------------------------- | ----------------------------------------------------------- |
| loginwindow | com.apple.loginwindow |
| Dock | com.apple.dock |
| SystemUIServer | com.apple.systemuiserver |
| WindowManager | com.apple.WindowManager |
| Control Center | com.apple.controlcenter |
| Finder | com.apple.finder |
| Wallpaper | com.apple.wallpaper.agent |
| talagent | com.apple.talagent |
| ViewBridgeAuxiliary | com.apple.ViewBridgeAuxiliary |
| Notification Center | com.apple.notificationcenterui |
| Bob | com.hezongyidev.Bob |
| Day Progress | com.sindresorhus.Day-Progress |
| Shottr | cc.ffitch.shottr |
| Raycast | com.raycast.macos |
| Dozer | com.mortennn.Dozer |
| Google Drive | com.google.drivefs.finderhelper.findersync |
| Wi-Fi | com.apple.wifi.WiFiAgent |
| AirPlayUIAgent | com.apple.AirPlayUIAgent |
| TextInputMenuAgent | com.apple.TextInputMenuAgent |
| Take a Break | tech.miidii.TakeABreak |
| Spotlight | com.apple.Spotlight |
| Squirrel | im.rime.inputmethod.Squirrel |
| FigmaAgent | com.figma.agent |
| CursorUIViewService | com.apple.TextInputUI.xpc.CursorUIViewService |
| UIKitSystem | com.apple.UIKitSystemApp |
| Dock Extra | com.apple.dock.extra |
| Dock Extra | com.apple.dock.external.extra.arm64 |
| com.apple.CoreSimulator.CoreSimulatorService | com.apple.CoreSimulator.CoreSimulatorService |
| Simulator | com.apple.CoreSimulator.SimulatorTrampoline |
| Stash | ws.stash.app |
| Family | com.apple.Family |
| storeuid | com.apple.storeuid |
| UserNotificationCenter | com.apple.UserNotificationCenter |
| PowerChime | com.apple.PowerChime |
| CoreLocationAgent | com.apple.CoreLocationAgent |
| ShareSheetUI (Finder) | com.apple.sharing.ShareSheetUI |
| SoftwareUpdateNotificationManager | com.apple.SoftwareUpdateNotificationManager |
| Keychain Circle Notification | com.apple.security.Keychain-Circle-Notification |
| Siri | com.apple.Siri |
| CoreServicesUIAgent | com.apple.coreservices.uiagent |
| SiriNCService | com.apple.SiriNCService |
| coreautha | com.apple.LocalAuthentication.UIAgent |
| TextInputSwitcher | com.apple.TextInputSwitcher |
| nsattributedstringagent | com.apple.textkit.nsattributedstringagent |
| QLPreviewGenerationExtension (Raycast) | com.apple.QuickLookUIFramework.QLPreviewGenerationExtension |
| AirDrop (Finder) | com.apple.share.AirDrop.send |
| QuickLookUIService (AirDrop (Finder)) | com.apple.quicklook.QuickLookUIService |
| QuickLookUIService (Finder) | com.apple.quicklook.QuickLookUIService |
| Single Sign-On | com.apple.AppSSOAgent |
| nbagent | com.apple.nbagent |
| Raycast Graphics and Media | com.apple.WebKit.GPU |
| Safari | com.apple.Safari |
| Safari Networking | com.apple.WebKit.Networking |
| com.apple.Safari.SandboxBroker (Safari) | com.apple.Safari.SandboxBroker |
| Bitwarden (Personal) Safari Web Extension | com.apple.WebKit.WebContent |
| Eagle for Safari (Personal) Safari Web Extension | com.apple.WebKit.WebContent |
| Safari Graphics and Media | com.apple.WebKit.GPU |
| Bitwarden | com.bitwarden.desktop.safari |
| Open and Save Panel Service (Safari) | com.apple.appkit.xpc.openAndSavePanelService |
| QuickLookUIService (Open and Save Panel Service (Safari)) | com.apple.quicklook.QuickLookUIService |
| ThemeWidgetControlViewService (Safari) | com.apple.appkit.xpc.ThemeWidgetControlViewService |
| Vimari (Safari) | net.televator.Vimari.SafariExtension |
| Downie Safari Extension (Safari) | com.charliemonroe.Downie-4-Downie-Extension |
| Subscribe to Feed (Safari) | com.ranchero.NetNewsWire-Evergreen.SubscribeToFeed |
| Instapaper (Safari) | com.instapaper.Instapaper-Mac.Safari |
| MiaoYan | com.tw93.MiaoYan |
| MiaoYan Networking | com.apple.WebKit.Networking |
| ThemeWidgetControlViewService (MiaoYan) | com.apple.appkit.xpc.ThemeWidgetControlViewService |
| OSDUIHelper | com.apple.OSDUIHelper |
| chronod | com.apple.chronod |
| Universal Control | com.apple.universalcontrol |
| Code | com.microsoft.VSCode |
| ThemeWidgetControlViewService (Code) | com.apple.appkit.xpc.ThemeWidgetControlViewService |
| QuickLookSatellite | com.apple.quicklook.satellite |
| Telegram | ru.keepcoder.Telegram |
| ThemeWidgetControlViewService (Telegram) | com.apple.appkit.xpc.ThemeWidgetControlViewService |
| Safari Web Content | com.apple.WebKit.WebContent |
| ChatGPT | com.openai.chat |
| AccessibilityVisualsAgent | com.apple.AccessibilityVisualsAgent |
| Safari Web Inspector | com.apple.WebKit.WebContent |
| Downie 4 | com.charliemonroe.Downie-4 |
| Downie 4 Networking | com.apple.WebKit.Networking |
| Notes | com.apple.Notes.WidgetExtension |
| iTerm2 | com.googlecode.iterm2 |
-----------------
File Name: sortData.py
import sqlite3
import datetime
import os
def export_records(duration="3"):
# Connect to the SQLite database
conn = sqlite3.connect('data.db')
cursor = conn.cursor()
# Calculate the starting date based on the given duration
today = datetime.datetime.now()
if isinstance(duration, (int, str)) and duration.isdigit():
start_date = (today - datetime.timedelta(days=int(duration))).strftime('%Y-%m-%d %H:%M:%S')
elif duration == "周":
start_date = (today - datetime.timedelta(days=7)).strftime('%Y-%m-%d %H:%M:%S')
elif duration == "月":
# Calculate start date as the same day of the previous month
if today.month == 1:
start_date = today.replace(year=today.year-1, month=12).strftime('%Y-%m-%d %H:%M:%S')
else:
start_date = today.replace(month=today.month-1).strftime('%Y-%m-%d %H:%M:%S')
elif duration == "年":
start_date = today.replace(year=today.year-1).strftime('%Y-%m-%d %H:%M:%S')
else:
raise ValueError("Invalid duration provided.")
cursor.execute('''
SELECT fileName, createTime, summary FROM records WHERE createTime >= ? ORDER BY createTime
''', (start_date,))
records = cursor.fetchall()
# Generate the total summary from all summaries
total_summary = "\n".join([record[2] for record in records if record[2]])
# Generate the text to save
text_to_save = f"Total Summary:\n{total_summary}\n\n"
for record in records:
text_to_save += f"File Name: {record[0]}\nCreation Time: {record[1]}\nSummary:\n{record[2]}\n\n"
# Generate the file name based on the start and end dates
end_date = today.strftime('%Y%m%d')
start_date_str = datetime.datetime.strptime(start_date, '%Y-%m-%d %H:%M:%S').strftime('%Y%m%d')
sorted_file_name = f"讯飞录音笔_{start_date_str}_{end_date}.txt"
sorted_file_path = os.path.join(os.getcwd(), sorted_file_name)
with open(sorted_file_path, 'w', encoding='utf-8') as file:
file.write(text_to_save)
conn.close()
return sorted_file_name
if __name__ == "__main__":
file_name = export_records()
print(f"Data exported to '{file_name}'.")
-----------------
File Name: main.py
import insertData
import sortData
if __name__ == '__main__':
insertData.insert_data_to_db()
sortData.export_records("3")
-----------------
File Name: insertData.py
import datetime
import json
import sqlite3
def insert_data_to_db(filename='input.json'):
conn = sqlite3.connect('data.db')
cursor = conn.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS records (
id TEXT PRIMARY KEY,
fileName TEXT,
createTime TEXT,
summary TEXT
)
''')
with open(filename, 'r', encoding='utf-8') as file:
data = json.load(file)
for record in data["data"]["records"]:
if record["summary"]: # Only insert if summary is not empty
cursor.execute('''
INSERT OR IGNORE INTO records (id, fileName, createTime, summary)
VALUES (?, ?, ?, ?)
''', (record["id"], record["fileName"], datetime.datetime.fromtimestamp(record["createTime"] / 1000).strftime('%Y-%m-%d %H:%M:%S'), record["summary"]))
conn.commit()
conn.close()
return "Data inserted/updated in SQLite database 'data.db'."
-----------------
File Name: README.md
# 我的工具库
这个仓库是用来保存我所有能够复用的工具。这些工具旨在帮助自动化或简化一些常见的任务。
- `extract_dom_link.sh`: 这个脚本用于从 DOM 中提取链接。(删除,使用 Web2Book 将网页转换成 Epub 书籍)
- `xf`: 讯飞录音笔转译内容提取
- lastmod.py: hugo 文章添加 lastmod
- hugo-server.sh: 关闭占用的 localhost:1313 端口,启动 hugo server
- get_files_content: 获取文件夹下所有文件的内容
-----------------
File Name: .gitignore
*.DS_Store
node_modules
*.log
idea/
*.local
.DS_Store
dist
.cache
.idea
logs
*-debug.log
*-error.log
*__pycache__/
-----------------
File Name: Cargo.toml
[package]
name = "get_files_content"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-----------------
File Name: .rustc_info.json
{"rustc_fingerprint":9598281567943839055,"outputs":{"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/huyixi/.rustup/toolchains/stable-aarch64-apple-darwin\noff\npacked\nunpacked\n___\ndebug_assertions\noverflow_checks\npanic=\"unwind\"\nproc_macro\nrelocation_model=\"pic\"\ntarget_abi=\"\"\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"aes\"\ntarget_feature=\"crc\"\ntarget_feature=\"dit\"\ntarget_feature=\"dotprod\"\ntarget_feature=\"dpb\"\ntarget_feature=\"dpb2\"\ntarget_feature=\"fcma\"\ntarget_feature=\"fhm\"\ntarget_feature=\"flagm\"\ntarget_feature=\"fp16\"\ntarget_feature=\"frintts\"\ntarget_feature=\"jsconv\"\ntarget_feature=\"lor\"\ntarget_feature=\"lse\"\ntarget_feature=\"neon\"\ntarget_feature=\"paca\"\ntarget_feature=\"pacg\"\ntarget_feature=\"pan\"\ntarget_feature=\"pmuv3\"\ntarget_feature=\"ras\"\ntarget_feature=\"rcpc\"\ntarget_feature=\"rcpc2\"\ntarget_feature=\"rdm\"\ntarget_feature=\"sb\"\ntarget_feature=\"sha2\"\ntarget_feature=\"sha3\"\ntarget_feature=\"ssbs\"\ntarget_feature=\"v8.1a\"\ntarget_feature=\"v8.2a\"\ntarget_feature=\"v8.3a\"\ntarget_feature=\"v8.4a\"\ntarget_feature=\"vh\"\ntarget_has_atomic\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"128\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store\ntarget_has_atomic_load_store=\"128\"\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"apple\"\nunix\n","stderr":""},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.76.0 (07dca489a 2024-02-04)\nbinary: rustc\ncommit-hash: 07dca489ac2d933c78d3c5158e3f43beefeb02ce\ncommit-date: 2024-02-04\nhost: aarch64-apple-darwin\nrelease: 1.76.0\nLLVM version: 17.0.6\n","stderr":""},"15481046163696847946":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/huyixi/.rustup/toolchains/stable-aarch64-apple-darwin\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"aes\"\ntarget_feature=\"crc\"\ntarget_feature=\"dit\"\ntarget_feature=\"dotprod\"\ntarget_feature=\"dpb\"\ntarget_feature=\"dpb2\"\ntarget_feature=\"fcma\"\ntarget_feature=\"fhm\"\ntarget_feature=\"flagm\"\ntarget_feature=\"fp16\"\ntarget_feature=\"frintts\"\ntarget_feature=\"jsconv\"\ntarget_feature=\"lor\"\ntarget_feature=\"lse\"\ntarget_feature=\"neon\"\ntarget_feature=\"paca\"\ntarget_feature=\"pacg\"\ntarget_feature=\"pan\"\ntarget_feature=\"pmuv3\"\ntarget_feature=\"ras\"\ntarget_feature=\"rcpc\"\ntarget_feature=\"rcpc2\"\ntarget_feature=\"rdm\"\ntarget_feature=\"sb\"\ntarget_feature=\"sha2\"\ntarget_feature=\"sha3\"\ntarget_feature=\"ssbs\"\ntarget_feature=\"vh\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""}},"successes":{}}
-----------------
File Name: CACHEDIR.TAG
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cargo.
# For information about cache directory tags see https://bford.info/cachedir/
-----------------
File Name: bin-get_files_content.json
{"rustc":13833583445748798061,"features":"[]","declared_features":"","target":10024020606492413526,"profile":14094339167972473758,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"release/.fingerprint/get_files_content-f87143aa1b1172be/dep-bin-get_files_content"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}
-----------------
File Name: bin-get_files_content
3093d054c952654a
-----------------
File Name: invoked.timestamp
This file has an mtime of when this was started.
-----------------
File Name: dep-bin-get_files_content
src/main.rs
-----------------
File Name: get_files_content.d
/Users/huyixi/i/Utils/get_files_content/target/release/get_files_content: /Users/huyixi/i/Utils/get_files_content/src/main.rs
-----------------
File Name: .cargo-lock
-----------------