太行一粟

专注于网站及程序设计

列表

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
def get_factors2(number):
import math
factors = []
sqrt = math.sqrt(number)
# print(f"{number}的开方数{sqrt:.3f}")
for i in range(1, int(sqrt)+1):
if number % i == 0:
factors.append(i)
if number // i != i:
factors.append(number // i)
# print(factors)
return sorted(factors)

if __name__ == '__main__':
i = 0
factors = get_factors2(100)
print(factors)
for f in factors:
print(f"factors[{i}]: {factors[i]}")
i += 1

字典

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/env python3
import os
book_list = [
{'name':"数学1年级上册", 'url':"https://v3.ykt.cbern.com.cn/65/document/40a22857f0234ab1b1827998d588d927/pdf.pdf"},
{'name':"数学1年级下册", 'url':"https://v3.ykt.cbern.com.cn/65/document/39c42025a2d848bf8c57ff612439ceb3/pdf.pdf"},
{'name':"数学2年级上册", 'url':"https://v2.ykt.cbern.com.cn/65/document/6490bb97b5ad41fb83e2b3dbd28b8fe0/pdf.pdf"},
{'name':"数学2年级下册", 'url':"https://v2.ykt.cbern.com.cn/65/document/2a3ceb3318714414ad0d658af901ea77/pdf.pdf"},
{'name':"数学3年级上册", 'url':"https://v2.ykt.cbern.com.cn/65/document/32c6b18bca334b439ba061ac958d9d3f/pdf.pdf"},
{'name':"数学3年级下册", 'url':"https://v3.ykt.cbern.com.cn/65/document/01c4d03170af48d1b88ea5efdfcb5011/pdf.pdf"},
{'name':"数学4年级上册", 'url':"https://v1.ykt.cbern.com.cn/65/document/f86d42fd514c4945b27a4166e3deb8a3/pdf.pdf"},
{'name':"数学4年级下册", 'url':"https://v1.ykt.cbern.com.cn/65/document/d0a86fb3780b4a1f92db6025aa5683bd/pdf.pdf"},
{'name':"数学5年级上册", 'url':"https://v1.ykt.cbern.com.cn/65/document/c07eb72ef5044b339bde311968ad3e31/pdf.pdf"},
{'name':"数学5年级下册", 'url':"https://v1.ykt.cbern.com.cn/65/document/00149c6d79044fa08e7d03f78cdb4145/pdf.pdf"},
{'name':"数学6年级上册", 'url':"https://v1.ykt.cbern.com.cn/65/document/b1950c9c9dcc43919f60824c1b258b06/pdf.pdf"},
{'name':"数学6年级下册", 'url':"https://v2.ykt.cbern.com.cn/65/document/9547d96598ec4966876698c225bcfd11/pdf.pdf"}
]

for book in book_list:
# print(book['name'], book['url'])
command = f"wget {book['url']} -O {book['name']}.pdf"
print(command)
os.system(command)

字符串

f””

1
2
3
4
h = "hello"
w = "world"
f"{h} {w}"
输出:hello world

format函数

1
2
3
4
5
6
7
8
9
10
# 不带位置转换
"{} {}".format("hello", "world")
输出:hello world

# 带位置转换
"{0} {1}".format("hello", "world")
输出:hello world

"{1} {0} {1}".format("hello", "world")
输出:world hello world

字典

遍历

1
2
3
4
# 使用items()方法遍历字典
my_dict = {'name': 'Tom', 'age': 18, 'sex': '男'}
for key, value in my_dict.items():
print(key, value)
1
2
3
my_dict = {'name': 'Tom', 'age': 18, 'sex': '男'}
for key in my_dict:
print(key, ':', my_dict[key])

lambda匿名函数

1
2
3
f = lambda x: x*x
print(f(5))
print((lambda y: y*y)(10))

DataFrame

创建DataFrame对象

1
2
3
4
5
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.random((3, 5)))
df.columns = ['a', 'b', 'c', 'd', 'e']
print(df)

运行结果:

1
2
3
4
          a         b         c         d         e
0 0.493908 0.129874 0.715260 0.725369 0.994077
1 0.021717 0.369733 0.070762 0.940723 0.637749
2 0.201970 0.075588 0.103985 0.706798 0.635883

访问DF对象的列

1
2
print(df.columns)
print(df.columns.tolist())

运行结果:

1
2
Index(['a', 'b', 'c', 'd', 'e'], dtype='object')
['a', 'b', 'c', 'd', 'e']

访问DF对象的索引

1
print(df.index)

运行结果:

1
RangeIndex(start=0, stop=3, step=1)
阅读全文 »

以管理员身份进入命令行方式

按下键盘上的“win + R”组合键,在弹出的运行框中输入“cmd”,然后按下“ctrl+shift+enter”快捷键。这样,出现的cmd窗口就已经是以管理员身份运行了。

右键以终端方式进入当前文件夹

编辑文件:MS-DOS.REG,内容如下,保存文件并双击导入注册表。

1
2
3
4
5
6
7
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\MS-DOS]
@="MS-DOS"

[HKEY_CLASSES_ROOT\Directory\shell\MS-DOS\command]
@="cmd.exe /s /k pushd \"%V\""

可执行文件EXE签名

安装Windows SDK的SignTools

下载地址:https://go.microsoft.com/fwlink/?linkid=2305205

安装只选择:Windows SDK Signing Tools for Desktop Apps

签名

1
signtool sign /tr http://CAtimestampserver.com /td SHA256 /fd SHA256 /v "path_to_yourfile.exe"

还原

WatchOS 9之前

  1. 将手表放在充电器上,直到你完成这些步骤为止。
  2. 按住侧边按钮,直到你在显示屏的右上角看到电源按钮。
  3. WatchOS 9之前的版本:用力按压屏幕上的“关机”滑块(WatchOS 9之后的版本:按住手表右侧边的红色数码表冠),然后抬起手指,选择屏幕显示的“抹掉所有内容和设置”。
  4. 轻点“还原”,然后再次轻点“还原”进行确认。
  5. 等待这个过程完成,然后重新设置你的 Apple Watch。系统提示时,请选择从备份恢复。

“抹掉所有内容和设置”会抹掉 Apple Watch 上的所有媒体、数据和设置,但不会移除激活锁。要移除激活锁,请首先取消配对手表。在抹掉手表之前,你的 iPhone 上会创建手表内容的备份。

find

查找当前目录下,所有以”(1)”结尾的文件,并删除

因为:文件名中含有**’(‘‘)’**特殊字符,find命令需要使用”-print0”参数,对应的xargs使用”-0”参数

1
find ./ -name "*(1).*" -print0 | xargs -0 rm -f

或:

1
find ./ -name "*(1).*" -exec rm -f {} \;

删除所有以**”._”**开头的文件:

1
find ./ -name "._*" -type f -exec rm -f {} \;

ffmpeg

转换格式(mp4 -> mov)

1
2
ffmpeg -c:v copy -c:a copy -i input.mp4 output.mov
ffmpeg -i input.mp4 output.mov

macOS系统中文件名带._前缀的文件

这些以._开头的文件是由Finder创建的隐藏文件,主要用于存储文件的元数据信息。通常不会对用户造成直接影响,但如果你希望避免它们被创建,可以通过以下方法禁用:

  1. 通过终端命令禁用‌:

    • 打开终端应用程序(可以在应用程序/实用工具/终端中找到)。

    • 输入以下命令并按回车键:

      1
      defaults write com.apple.desktopservices DSDontWriteNetworkStores -booltrue

      这个命令将禁用在网络共享文件夹中创建**”.DS_Store”文件和“._”**开头的隐藏文件。

    • 输入以下命令并按回车键:

      1
      defaults write com.apple.desktopservices DSDontWriteUSBStores -booltrue

      这个命令将禁用在外部存储设备中创建**”._”**开头的隐藏文件。

    • 退出终端应用程序。现在,Finder 将不会在外部存储设备或网络共享文件夹中创建 ._ 开头的隐藏文件或文件夹‌1。

  2. 删除现有的._文件‌:

    • 打开终端应用程序。

    • 输入以下命令并按回车键:

      1
      find . -name "._*" | xargs rm -f

      这个命令会删除当前目录及其子目录下所有以**”._”**开头的文件‌。

通过以上方法,你可以有效地管理macOS系统中的 ._ 文件,避免它们被创建或删除现有的文件。

VTT2SRT

Javascript版本

安装node

1
2
axel -n 10 https://nodejs.org/dist/v22.0.0/node-v22.0.0.pkg
sudo installer -pkg node-v22.0.0.pkg -target /

安装vtt-to-srt

1
npm install vtt-to-srt --global

转换vtt为srt格式

1
vtt-to-srt example.vtt example.srt

Python版本

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
import argparse
import codecs
import math
import os
import re


SUPPORTED_EXTENSIONS = [".xml", ".vtt"]


def leading_zeros(value, digits=2):
value = "000000" + str(value)
return value[-digits:]


def convert_time(raw_time):
if int(raw_time) == 0:
return "{}:{}:{},{}".format(0, 0, 0, 0)

ms = '000'
if len(raw_time) > 4:
ms = leading_zeros(int(raw_time[:-4]) % 1000, 3)
time_in_seconds = int(raw_time[:-7]) if len(raw_time) > 7 else 0
second = leading_zeros(time_in_seconds % 60)
minute = leading_zeros(int(math.floor(time_in_seconds / 60)) % 60)
hour = leading_zeros(int(math.floor(time_in_seconds / 3600)))
return "{}:{}:{},{}".format(hour, minute, second, ms)


def xml_id_display_align_before(text):
"""
displayAlign="before" means the current sub will be displayed on top.
That is and not at bottom. We check what's the xml:id associated to it
to have an {\an8} position tag in the output file.
"""
align_before_re = re.compile(u'<region.*tts:displayAlign=\"before\".*xml:id=\"(.*)\"/>')
has_align_before = re.search(align_before_re, text)
if has_align_before:
return has_align_before.group(1)
return u""


def xml_get_cursive_style_ids(text):
style_section = re.search("<styling>(.*)</styling>", text, flags=re.DOTALL)
if not style_section:
return []
style_ids_re = re.compile(
'<style.* tts:fontStyle="italic".* xml:id=\"([a-zA-Z0-9_.]+)\"')
return [re.search(style_ids_re, line).groups()[0]
for line in style_section.group().split("\n")
if re.search(style_ids_re, line)]


def xml_cleanup_spans_start(span_id_re, cursive_ids, text):
has_cursive = []
span_start_tags = re.findall(span_id_re, text)
for s in span_start_tags:
has_cursive.append(u"<i>" if s[1] in cursive_ids else u"")
text = has_cursive[-1].join(text.split(s[0], 1))
return text, has_cursive


def xml_cleanup_spans_end(span_end_re, text, has_cursive):
span_end_tags = re.findall(span_end_re, text)
for s, cursive in zip(span_end_tags, has_cursive):
cursive = u"</i>" if cursive else u""
text = cursive.join(text.split(s, 1))
return text


def to_srt(text, extension):
if extension.lower() == ".xml":
return xml_to_srt(text)
if extension.lower() == ".vtt":
return vtt_to_srt(text)

def format_text(line):
line = line.replace("&lrm;","",1)
while line.find("<")!=-1:
indexa = line.find("<")
indexb = line.find(">")
line = line.replace(line[indexa:indexb+1],"")
return line

def convert_vtt_time(line):
times = line.replace(".", ",").split(" --> ")
if len(times[0]) == 9:
times = ["00:" + t for t in times]
return "{} --> {}".format(times[0], times[1].split(" ")[0])


def vtt_to_srt(text):
if not text.startswith(u"\ufeffWEBVTT") and not text.startswith(u"WEBVTT"):
raise Exception(".vtt format must start with WEBVTT, wrong file?")

lines = []
current_sub_line = []
for line in text.split("\n"):
if current_sub_line:
line = format_text(line)
current_sub_line.append(line)
if not line or line=="\r":
lines.append("\n".join(current_sub_line) + "\n")
current_sub_line = []

elif " --> " in line:
current_sub_line = [convert_vtt_time(line)]
if current_sub_line:
lines.append("\n".join(current_sub_line))

return "".join((u"{}\n{}".format(i, l) for i, l in enumerate(lines, 1)))


def xml_to_srt(text):
def append_subs(start, end, prev_content, format_time):
subs.append({
"start_time": convert_time(start) if format_time else start,
"end_time": convert_time(end) if format_time else end,
"content": u"\n".join(prev_content),
})

display_align_before = xml_id_display_align_before(text)
begin_re = re.compile(u"\s*<p begin=")
sub_lines = (l for l in text.split("\n") if re.search(begin_re, l))
subs = []
prev_time = {"start": 0, "end": 0}
prev_content = []
start = end = ''
start_re = re.compile(u'begin\="([0-9:\.]*)')
end_re = re.compile(u'end\="([0-9:\.]*)')
content_re = re.compile(u'\">(.*)</p>')

# some span tags are used for italics, we'll replace them by <i> and </i>,
# which is the standard for .srt files. We ignore all other uses.
cursive_ids = xml_get_cursive_style_ids(text)
span_id_re = re.compile(u'(<span style=\"([a-zA-Z0-9_.]+)\">)+')
span_end_re = re.compile(u'(</span>)+')
br_re = re.compile(u'(<br\s*\/?>)+')
fmt_t = True
for s in sub_lines:
s, has_cursive = xml_cleanup_spans_start(
span_id_re, cursive_ids, s)

string_region_re = r'<p(.*region="' + display_align_before + r'".*")>(.*)</p>'
s = re.sub(string_region_re, r'<p\1>{\\an8}\2</p>', s)
content = re.search(content_re, s).group(1)

br_tags = re.search(br_re, content)
if br_tags:
content = u"\n".join(content.split(br_tags.group()))

content = xml_cleanup_spans_end(
span_end_re, content, has_cursive)

prev_start = prev_time["start"]
start = re.search(start_re, s).group(1)
end = re.search(end_re, s).group(1)
if len(start.split(":")) > 1:
fmt_t = False
start = start.replace(".", ",")
end = end.replace(".", ",")
if (prev_start == start and prev_time["end"] == end) or not prev_start:
# Fix for multiple lines starting at the same time
prev_time = {"start": start, "end": end}
prev_content.append(content)
continue
append_subs(prev_time["start"], prev_time["end"], prev_content, fmt_t)
prev_time = {"start": start, "end": end}
prev_content = [content]
append_subs(start, end, prev_content, fmt_t)

lines = (u"{}\n{} --> {}\n{}\n".format(
s + 1, subs[s]["start_time"], subs[s]["end_time"], subs[s]["content"])
for s in range(len(subs)))
return u"\n".join(lines)


def main():
directory = "."
help_text = u"path to the {} directory (defaults to current directory)"
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", type=str, default=directory,
help=help_text.format("input", directory))
parser.add_argument("-o", "--output", type=str, default=directory,
help=help_text.format("output", directory))
a = parser.parse_args()
filenames = [fn for fn in os.listdir(a.input)
if fn[-4:].lower() in SUPPORTED_EXTENSIONS]
for fn in filenames:
with codecs.open("{}/{}".format(a.input, fn), 'rb', "utf-8") as f:
text = f.read()
with codecs.open("{}/{}.srt".format(a.output, fn[:-4]), 'wb', "utf-8") as f:
f.write(to_srt(text, fn[-4:]))


if __name__ == '__main__':
main()

图层

文字

文字描边

文字最好放在一个独立的图层。

选中文字,菜单,图层,图层样式,描边,

安装

安装剪映,很多功能需要会员。可以安装CapCut,外区ID。

导入素材

截屏

封面

定格

转场

转场时间可以调整,默认的转场时间太短,转场效果感觉太快。

转场效果可以选择,滑雪可以选择“MG转场”的“飘雪”效果。

剪辑视频

Mac上使用剪映剪辑视频的步骤如下:

  1. 打开剪映:首先,确保你已经在Mac上安装了剪映应用。如果你还没有安装,可以通过Mac App Store搜索并下载它。
  2. 导入视频:启动剪映应用,并在页面上选择“新建项目”,接着从本地文件夹中选择你需要编辑的视频文件,将其拖放至时间线中。
  3. 剪辑视频:
    • 使用基本工具进行剪辑:在界面的底部,你可以找到裁剪、旋转、调整音频等基本工具,用来处理你的视频内容。
    • 选择切割位置:选中视频轨道上的某一段落,点击切割按钮(通常是一个方框图标),以将不需要的部分分离出来。
  4. 添加文本和标签:
    • 如果需要在视频中添加文本元素,如字幕、标题或文字覆盖层,可以在时间线上进行添加。
    • 你还可以通过点击界面底部的“文本”选项,来选择合适的字体和大小。
  5. 润色和特效:
    • 使用滤镜和特效功能来提升视频的美观度。这可以通过“视觉效果”和“音频效果”选项卡来实现。
  6. 导出视频:
    • 完成所有的编辑工作后,点击左上角的“文件”菜单,然后选择“导出为”来设置视频的输出参数。
    • 你可以选择不同的文件格式,如MP4、MOV等,以及是否包含音频。
    • 确认设置无误后,点击“导出”按钮,等待视频导出完成。

字幕

导出字幕

剪映是一款流行的视频编辑软件,它支持导出字幕功能。以下是使用剪映导出字幕的步骤:

  1. 打开剪映并导入视频。首先,打开剪映软件,并导入需要编辑的视频。
  2. 添加和编辑字幕。在“文本”选项卡中,可以切换到“智能字幕”或“视频歌词”来识别视频中的字幕。识别完成后,可以修改字幕内容。
  3. 选择导出格式。在字幕编辑完成后,点击“导出”按钮,选择导出字幕的格式。剪映支持导出为SRT(带有时间标记)和TXT(纯文本)格式。
  4. 导出字幕文件。在导出窗口中,取消勾选“视频导出”和“音频导出”,只勾选“字幕导出”。设置好文件名和保存路径后,点击“导出”按钮即可将字幕文件导出到指定位置。

此外,如果需要将字幕与视频一起导出,可以选择导出视频,这样在导出的视频文件中,字幕也会被包含在内。需要注意的是,剪映的导出功能可能无法直接导出字幕,但可以通过导出视频的方式来获得字幕。

字幕识别

字幕轨道删除

点击选择字幕轨道,按下删除键,或者点击时间轴左上的删除按钮。

字幕位置

字幕格式

安装android-platform-tools

1
brew install android-platform-tools --cask

手机端

安装”Terminal Emulator for Android

Adb命令

启动服务器

1
adb start-server

停止服务器

1
adb kill-server

查询已连接的设备

1
2
adb devices
adb devices -l

获取前台app名称

1
adb shell "dumpsys activity | grep mCurrentFocus"

mCurrentFocus=Window{63a2419 u0 com.dragon.read/com.dragon.read.reader.ui.ReaderActivity}

获取屏幕尺寸

1
adb shell wm size

Physical size: 1344x2772

Override size: 1152x2376

模拟屏幕滑动

1
adb shell input swipe 500 2000 500 1000

坐标:左上角为原点(0,0)

从(500,2000)上滑到(500,1000)

浮点运算

1
echo "1.5 + 3" | bc

随机间隔

1
2
3
4
5
sleep $(((RANDROM % 70 / 10 + 3)))
或:
t=$(echo "scale=2;$RANDOM % 7000 / 10 + 3" | bc)
echo $t
sleep $t

获取当前窗口

1
adb shell "dumpsys window | grep mCurrentFocus"

代码

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
#!/bin/sh

while getopts ":s:" opt
do
case $opt in
s)
ID=$OPTARG
;;
*)
echo "Usage:"
echo " -h: help"
echo " -s device_id"
echo
exit 1
;;
esac
done

ADB="adb"
$ADB start-server
if [ $ID ]; then
OPT_ID="-s $ID"
fi
ADB="$ADB $OPT_ID"

ACTIVITIES="
com.ss.android.ugc.aweme.lite/com.ss.android.ugc.aweme.splash.SplashActivity
com.ss.android.ugc.live/com.ss.android.ugc.aweme.splash.SplashActivity
com.ss.android.article.lite/com.ss.android.article.lite.activity.SplashActivity
com.dragon.read/com.dragon.read.reader.ui.ReaderActivity
com.sankuai.meituan/com.meituan.android.pt.homepage.activity.MainActivity
"

SWIPEUP_APPS="ss.android.ugc.aweme.lite ss.android.ugc.live sankuai.meituan ss.android.article.lite cat.readall"
SWIPELEFT_APPS="dragon.read xs.fm"

swipe(){
#echo $ADB shell input swipe $1 $2 $3 $4
$ADB shell input swipe $1 $2 $3 $4
}

swipe_left(){
y1=$((YMAX * (RANDOM % 10 + 50) / 100))
y2=$((y1 + YMAX * (RANDOM % 5) / 100))
x1=$((XMAX * (RANDOM % 10 + 50) / 100))
x2=$((x1 - XMAX * (RANDOM % 8 + 15) / 100))
echo "swipe_left: $x1 $y1 $x2 $y2"
swipe $x1 $y1 $x2 $y2
}

swipe_up(){
x1=$((XMAX * (RANDOM % 10 + 45) / 100))
x2=$((x1 + XMAX * (RANDOM % 5) / 100))
y1=$((YMAX * (RANDOM % 10 + 70) / 100))
y2=$((y1 - YMAX * (RANDOM % 5 + 20) / 100))
echo "swipe_up: $x1 $y1 $x2 $y2"
swipe $x1 $y1 $x2 $y2
}

get_focus_app(){
FOCUS_APP=$($ADB shell "dumpsys window | grep mCurrentFocus" | awk -F 'com\.|/' '{print $2}')
echo $FOCUS_APP
}

switch_app(){
$ADB shell am start $1
}

process_app(){
total_time=0
while [[ $(echo "$total_time / 1" | bc ) -lt 3600 ]]; do
echo "Foucs Application: $(get_focus_app)"
for app in $SWIPEUP_APPS; do
if [[ "$(get_focus_app)" == "$app" ]] ; then
t=$(echo "scale=2;$RANDOM % 999 / 5 + 1.27" | bc)
echo "after $t s..."
swipe_up
sleep $t
total_time=$(echo "$total_time + $t" | bc)
echo "total_time: $total_time seconds..."
echo
fi
done
for app in $SWIPELEFT_APPS; do
if [[ "$(get_focus_app)" == "$app" ]] ; then
t=$(echo "scale=2;$RANDOM % 499 / 5 + 5.27" | bc)
echo "after $t s..."
swipe_left
sleep t
total_time=$(echo "$total_time + $t" | bc)
echo "total_time: $total_time seconds..."
echo
fi
done
done
}

XMAX=$($ADB shell wm size | awk -F ': ' '{print $2}' | sed 's/x.*//')
YMAX=$($ADB shell wm size | awk -F ': ' '{print $2}' | sed 's/.*x//')
echo "XMAX: $XMAX, YMAX:$YMAX"

while true; do
for activity in $ACTIVITIES; do
echo
echo $activity
switch_app $activity
process_app
done
done

下载

AutoCAD for Mac下载

安装

运行安装程序Install Autodesk AutoCAD 2024 for Mac.app

注册及破解

第一次运行

生成目录$HOME/Library/Application\ Support/Autodesk/AutoCAD\ 2024/

显示隐藏文件

1
defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder

拷贝破解文件

方法一、在Finder中拷贝文件

将**/Volumes/AutoCAD\ 2024\ [MacApp]/AutoCAD文件拷贝到:/Applications/Autodesk/AutoCAD\ 2024/AutoCAD\ 2024.app/Contents/MacOS/AutoCAD**

方法二、设置终端完全访问权限

打开“系统偏好设置 — > 隐私与安全性 — > 完全磁盘访问权限 –> 找到“终端” ,可以看到终端后面的开关没有打开,我们打开它,然后会提示输入你的Mac开机密码,输入密码确认即可开启,这个时候可能会提示你退出终端,这个时候要记得点击退出,不然设置无效!

1
sudo cp -a /Volumes/AutoCAD\ 2024\ [MacApp]/AutoCAD /Applications/Autodesk/AutoCAD\ 2024/AutoCAD\ 2024.app/Contents/MacOS/AutoCAD

不显示隐藏文件

1
defaults write com.apple.finder AppleShowAllFiles -boolean false ; killall Finder

一键破解脚本

1
2
3
4
5
6
#!/bin/sh

defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder
sudo cp -a /Volumes/AutoCAD\ 2024\ [MacApp]/AutoCAD /Applications/Autodesk/AutoCAD\ 2024/AutoCAD\ 2024.app/Contents/MacOS/AutoCAD
defaults write com.apple.finder AppleShowAllFiles -boolean false ; killall Finder