Skip to content

Commit

Permalink
add categories and sftp blog
Browse files Browse the repository at this point in the history
  • Loading branch information
darkwilldie committed Sep 19, 2024
1 parent 116fa78 commit 0263a97
Show file tree
Hide file tree
Showing 17 changed files with 128 additions and 12 deletions.
1 change: 1 addition & 0 deletions source/_posts/2024-09-08.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 20240908
date: 2024-09-08 14:51:56
tags: diary
categories: diary
---

今天是新学期第一个周日,预定是完成课后作业,和多组学项目那边的负责人对一下代码,有多余时间就看一下 tangram 论文。
Expand Down
1 change: 1 addition & 0 deletions source/_posts/2024-09-12.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 20240912
date: 2024-09-12 17:47:39
tags: diary
categories: diary
---

# 22 端口
Expand Down
1 change: 1 addition & 0 deletions source/_posts/2024-09-14.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 20240914
date: 2024-09-14 14:08:24
tags: diary
categories: diary
---

上午刚开完会被拷打,还算是这个星期跑出来的结果不错,给我顺利过关了。明天要开会迎接新研一,顺便去吃饭!导还说再分配一个研一跟我一起做生信的项目,不过今年下半年就要出成果的话,刚学了点深度学习基础的研一恐怕也派不上大用场。
Expand Down
41 changes: 29 additions & 12 deletions source/_posts/R语言使用命令行参数.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: R语言使用命令行参数
date: 2024-09-18 08:46:29
tags: R
categories: coding
---

因为用同一个文件对不同数据集画图的时候,每次都改文件内容有点麻烦,而且容易忘,所以有使用命令行参数的需求。
Expand Down Expand Up @@ -38,20 +39,36 @@ print(args[4])
args <- commandArgs()
```

运行一个输出参数 0~9 的测试文件:
实践是检验真理的唯一标准。我们先写一个输出参数 0~9 的测试文件`test.R`

```R test.R
Args <- commandArgs()
cat("Args[0] =", Args[0], "\n")
cat("Args[1] =", Args[1], "\n")
cat("Args[2] =", Args[2], "\n")
cat("Args[3] =", Args[3], "\n")
cat("Args[4] =", Args[4], "\n")
cat("Args[5] =", Args[5], "\n")
cat("Args[6] =", Args[6], "\n")
cat("Args[7] =", Args[7], "\n")
cat("Args[8] =", Args[8], "\n")
cat("Args[9] =", Args[9], "\n")
```

终端运行`test.R`进行测试:

```bash
> Rscript.exe .\beifen\R_plot\test.R a b c d
Args[0]=
Args[1]= D:\R-4.4.1\bin\x64\Rterm.exe
Args[2]= --no-echo
Args[3]= --no-restore
Args[4]= --file=.\beifen\R_plot\test.R
Args[5]= --args
Args[6]= a
Args[7]= b
Args[8]= c
Args[9]= d
Args[0] =
Args[1] = D:\R-4.4.1\bin\x64\Rterm.exe
Args[2] = --no-echo
Args[3] = --no-restore
Args[4] = --file=.\beifen\R_plot\test.R
Args[5] = --args
Args[6] = a
Args[7] = b
Args[8] = c
Args[9] = d
```

可以看出用户输入参数是从第六个开始的
可见用户输入参数是从第六个开始的
1 change: 1 addition & 0 deletions source/_posts/github推送报错解决.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ tags:
- github
- ssh
- Tokens
categories: environment
---

# 报错
Expand Down
84 changes: 84 additions & 0 deletions source/_posts/ssh和sftp配置.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
title: ssh和sftp配置
date: 2024-09-19 21:10:46
tags:
- ssh
- sftp
categories: environment
---

# SSH

关于怎么配置 github 的 ssh 密钥,我在{% post_link github推送报错解决 %}中已经记录过,故不赘述。

这次主要是解决一个小问题,用校园网无法通过 ssh 连接 github。我再{% post_link 20240912 %}中提到校园网 ban 了 22 端口,但今天发现不是这样。参考[这篇博客](https://www.alonetech.com/2024/01/19/2586.html),修改`~/.ssh`(在 windows 环境为`C:\Users\Username\.ssh`)目录下的`config`文件,如果没有就新建。

```config ~/.ssh/config
Host github.com
HostName ssh.github.com
```

也就是把`github.com`作为`ssh.github.com`的别名。设置之后就可以正常连接 ssh 了。

# SFTP

## 设置别名

sftp 是用来在服务器和本机之间传输文件的,只要能连上服务器,sftp 几乎不需要配置。参考[师兄的 notion](https://rylynn.notion.site/SFTP-f6d6bb9bdbeb45fab80fe1d8a53bef07)

首先可以在本地的`~/.ssh/config`文件中设置服务器 ip 的别名,如:

```config ~/.ssh/config
Host adana
HostName 127.0.0.1
User yamada
Port 22
```

设置完之后,`yamada@adana`就相当于`[email protected]`的效果。服务器密码该输还得输,没有任何变化,这一步仅仅只是为了简化每次要输入 ip 地址的一长串。

## 连接

然后使用 sftp 代替 ssh 命令来连接。

```bash
# 不指定端口(使用22端口)
sftp yamada@adana
# 指定端口(也可以事先在~/.ssh/config设置好Port
sftp -oPort=custom_port yamada@adana
# 连接成功后会进入
sftp>
```

## 基本命令

连接上之后,可以互传文件。使用`help``?` 来访问 sftp 的命令帮助。

需要注意的是:

1. 服务器相关命令没有变化,但无法使用 `~` 来访问`/home/username`路径。
2. 本地的命令需要在前面加 `l`,如`cd`->`lcd`, `pwd`->`lpwd`, `ls`->`lls`

## 下载

从服务器下载到本地,使用`get`命令。

```bash
# 直接下载
sftp> get remoteFile
Fetching /home/demouser/remoteFile to remoteFile
/home/demouser/remoteFile 100% 37KB 36.8KB/s 00:01
# 指定下载文件名字(和服务器上的名字不同)
sftp> get remoteFile localFile
# 递归地下载目录
sftp> get -r someDirectory
```

## 上传

使用`put`命令,方法和`get`相同。

```bash
sftp> put localFile
sftp> put -r localDirectory
```
1 change: 1 addition & 0 deletions source/_posts/从协方差到典型相关分析-CCA.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ date: 2024-09-12 21:10:05
tags:
- math
- linear algebra
categories: math
---

<meta name="referrer" content="no-referrer" />
Expand Down
1 change: 1 addition & 0 deletions source/_posts/余弦相似性.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: 余弦相似性
date: 2024-09-12 08:23:30
tags:
- math
categories: math
---

虽然项目中一直在用这两种方法,但其实关于原理我是一窍不通~~(cv 大法好)~~,今天来学习一下。
Expand Down
1 change: 1 addition & 0 deletions source/_posts/关于搭建博客的博客.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 关于搭建博客的博客
date: 2024-09-07 19:29:57
tags: blog
categories: environment
---

# 前言
Expand Down
1 change: 1 addition & 0 deletions source/_posts/内积和外积.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ date: 2024-09-11 14:20:38
tags:
- linear algebra
- math
categories: math
---

# 前言
Expand Down
1 change: 1 addition & 0 deletions source/_posts/损失函数可以是负数吗.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ date: 2024-09-10 14:19:56
tags:
- deep learning
- loss function
categories: DL
---

今天尝试改代码的时候不得不面对这样一个问题:代码中计算的损失函数,是相关性(正数,越大越优)直接取负的结果。
Expand Down
1 change: 1 addition & 0 deletions source/_posts/教員情報集め.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 教員情報集め
date: 2024-09-14 18:30:16
tags: info
categories: others
---

各大学の教員情報を集めてメモします。
Expand Down
1 change: 1 addition & 0 deletions source/_posts/空间转录组和单细胞转录组.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 空间转录组和单细胞转录组
date: 2024-09-16 09:29:44
tags: biology
categories: biology
---

<meta name="referrer" content="no-referrer" />
Expand Down
1 change: 1 addition & 0 deletions source/_posts/蒙特卡罗方法.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: 蒙特卡罗方法
date: 2024-09-11 21:16:37
tags: math
categories: math
---

# 介绍
Expand Down
1 change: 1 addition & 0 deletions source/_posts/记录两个代码错误.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ date: 2024-09-10 21:06:29
tags:
- debug
- normalization
categories: coding
---

# 错误 1
Expand Down
1 change: 1 addition & 0 deletions source/_posts/证明可导必定连续.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ date: 2024-09-11 20:36:57
tags:
- math
- calculus
categories: math
---

非常简单的一行小证明,但刚刚就是死活证不出来。看了 MIT 视频豁然开朗。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ date: 2024-09-15 11:16:02
tags:
- debug
- blog
categories: environment
---

<meta name="referrer" content="no-referrer" />
Expand Down

0 comments on commit 0263a97

Please sign in to comment.