Skip to content

Commit

Permalink
调整结构/更新笔记
Browse files Browse the repository at this point in the history
  • Loading branch information
cmx02088102 committed Sep 4, 2024
1 parent a34e60e commit 4501fe2
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 6 deletions.
2 changes: 1 addition & 1 deletion _posts/coding/2024-08-13-chatglm-PPO训练路径探索.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: chatglm-PPO训练路径探索
author: X
date: 2024-08-13 09:06:31 +0800
categories: [coding]
categories: [coding, LLM]
tags: [ppo,模型训练]
---
# 背景
Expand Down
2 changes: 1 addition & 1 deletion _posts/coding/2024-08-13-脚本内指定GPU部署.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: 脚本内指定GPU部署
author: X
date: 2024-08-13 09:06:31 +0800
categories: [engineering]
categories: [engineering, GPU]
tags: [GPU,CUDA]
---

Expand Down
2 changes: 1 addition & 1 deletion _posts/engineering/2024-08-13-linux删除相关.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: linux删除相关
author: X
date: 2024-08-13 09:06:31 +0800
categories: [engineering]
categories: [engineering, linux]
tags: [linux]
---
# 常用
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: linux服务器离线安装anaconda
author: X
date: 2024-08-13 15:06:31 +0800
categories: [engineering]
categories: [engineering, linux]
tags: [Linux,environment]
---

Expand Down
2 changes: 1 addition & 1 deletion _posts/engineering/2024-08-13-linux软链接相关.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: linux软链接相关|含批量脚本
author: X
date: 2024-08-13 09:06:31 +0800
categories: [engineering]
categories: [engineering, linux]
tags: [黑科技,linux]
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: 两台Linux机器传文件
author: X
date: 2024-08-13 09:06:31 +0800
categories: [engineering]
categories: [engineering, linux]
tags: [文件传输,linux]
---
本来用的是xftp里直接传,结果速度很慢而且直接给哥们C盘干爆了。
Expand Down
25 changes: 25 additions & 0 deletions _posts/engineering/2024-09-04-conda重命名.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: conda重命名
author: X
date: 2024-09-04 11:26:00 +0800
categories: [engineering, conda]
tags: [conda]
---

# 参考资料
[conda官网教程](https://docs.conda.io/projects/conda/en/23.5.x/commands/rename.html)

# 命令
```bash
conda rename [-h] [-n ENVIRONMENT | -p PATH] [--force] [-d] destination
```

本人的使用场景是,在vscode使用在文件夹中自动创建的conda环境,即`.conda`文件夹,该环境在工作区中运行,此环境没有名称,只有路径,通过`conda info`可以查询,但使用时较为麻烦,故重命名。

示例:
```bash
conda rename -p "C:\Users\work\project\.conda" "project"
```

提示:
实际并非重命名,而是将环境移动到新位置,并删除旧位置。
65 changes: 65 additions & 0 deletions _posts/engineering/2024-09-04-windows命令行下载url文件.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: Windows命令行下载URL文件
author: X
date: 2024-09-04 13:42:04 +0800
categories: [engineering]
tags: [windows]
---

# 参考文档

最终使用的是这个方法:[windows系统自带cmd命令下载文件(类似linux的wget下载文件)](https://blog.csdn.net/u012910342/article/details/116278306)

一开始看的:[windows命令行远程下载文件的五种方法](https://www.cnblogs.com/cute-puli/p/14859208.html)

里面记录的方法,我用了方法一和方法二两种,用方法二的时候弄错了,没有写`-o`导致报错;写了还是报错,估计是权限问题,因为改到最终方法(powershell)就可以了。

# 脚本

最后为了方便使用,写了脚本。

```bash
chcp 65001
@echo off
setlocal enabledelayedexpansion

:: 获取脚本所在路径
set "scriptPath=%~dp0"

:: 提示用户输入URL
set /p "userUrl=请输入URL: "

:: 从URL中提取文件路径

for /f "tokens=1 delims=?" %%a in ("!userUrl!") do (
set "filePath=%%a"
set "repoPath=%%a"
)
for /f "tokens=3,* delims=/" %%a in ("%repoPath%") do (
set "repoPath=%%b"
)

for %%i in ("%repoPath%") do set DIRECTORY=%%~dpi

for /f "tokens=6,* delims=/" %%a in ("%filePath%") do (
set "filePath=%%b"
)

echo 文件路径:!DIRECTORY!
echo filepath: %filePath%

:: 生成保存的完整路径
set "savePath=!DIRECTORY!%filePath%"

:: 创建目录(如果不存在的话)
mkdir "!DIRECTORY!" >nul 2>&1

:: 使用certutil工具下载文件
powershell curl "%userUrl%" -o "%savePath%"

echo 文件已下载到: %savePath%
pause
```
脚本中,首先获取脚本所在路径,然后提示用户输入URL,并从URL中提取文件路径。接着,使用powershell的curl命令下载文件,并将下载的文件保存到指定的路径。最后,打印下载完成的信息,并暂停脚本。
一个比较重要的部分是`chcp 65001`,这条命令用于设置当前代码页为UTF-8编码,防止中文乱码。

0 comments on commit 4501fe2

Please sign in to comment.