Giter Club home page Giter Club logo

blog's People

Contributors

ysl2 avatar

Watchers

 avatar

blog's Issues

内网穿透

Frp

自建

按照官网的教程来

https://gofrp.org/docs/examples/ssh/

注意公网服务器上面需要开放相应的端口

sdu_net 一旦检测到有 frp 行为,会直接封禁 ip。因此如果要用的话,需要做 tls 加密。而且就算采用了加密,也不知道能不能行,因为没法测试了,我的腾讯云的 ip 已经被封了。

可以采用外部 frp 嵌套内部 autossh 的方法。对于封禁 ip 的网段,采用 autossh 先连接到其他不封禁的网段。然后把不封禁的这台机器的对应端口用 frp 映射出去。比如 yin3 在 2244 端口用 autossh 映射了 server-53 的 22 端口,然后再找个公网机器用 frp 映射 yin3 的 2244 端口。这样在外部访问 frp 端口,就直接映射到了 server-53 的 22 端口,并且 server-53 对应的网段还检测不到。

樱花frp

# which sfrpc
# ~/.Local/bin/my/sfrp/sfrpc
# ln -s ~/.Local/bin/my/sfrp/sfrpc ~/.Local/bin/sfrpc
sfrpc -c ~/.Local/bin/my/sfrp/sfrpc.ini --natfrp_tls

Autossh

  1. 准备

    内网机器 A

    • ip: 172.27.67.80
    • ssh port: 22
    • username: yusongli
    • passwd: ysl123

    公网机器 B

    • ip: 47.105.198.227
    • ssh port: 22
    • username: gongwang
    • passwd: gw1234
  2. 在公网主机 B 上配置/etc/ssh/sshd_config文件,改以下字段为yes,然后重启 ssh 服务

    # 意思是监听端口可以绑定到任意其他ip
    GatewayPorts yes
    
    sudo systemctl restart sshd
  3. 在内网主机 A 上生成 ssh key,并对 B 做免密登录

    ssh-keygen
    ssh-copy-id [email protected]
  4. 在内网主机 A 上做端口映射(需要安装autossh)

    # autossh -M {本地主机端口} -NfR {公网主机端口}:localhost:22 {公网主机用户}@{公网ip}
    autossh -M 10550 -NfR 9550:localhost:22 [email protected]
  5. 端口占用情况

    • A 仅有 10550 端口会被占用 (可能是因为学校屏蔽公网下内网穿透的原因。以前的时候好像A也是9550和10550都会被占用)
    • B 的 9550 端口和 10550 端口都会被占用
    • 9550 是用来在公网主机上登录的端口
  6. 开机自启

    sudo vim /etc/rc.local
    
    # 加入上面那行代码
    autossh -M 10550 -NfR 9550:localhost:22 [email protected]
  7. kill

    1. 方式一

      应该先在内网主机A上,通过ps aux | grep autossh找到autossh所在的PID,kill掉。

      此时公网主机B上的9550和10550端口会自动断开。

      然后再在内网主机A上通过lsof -i:9550或者lsof -i:10550找到对应PID,然后kill掉。

    2. 方式二 (可能不好用,并且可能只适用于学校屏蔽公网下内网穿透的情况)

      在任意A或者B上,通过lsof -i:9550或者lsof -i:10550找到对应PID,然后kill掉。

      此时另一个主机会自动断开。

GPT-4

需要:
ios设备,梯子环境,美区账号(地区在美国五个免税州内),支付宝,chatgpt账号

步骤:
ios设备,地区切换到美国,系统语言切换英文
美区账号下载chatgpt app
通过支付宝小程序给美区账号充值礼品卡
chatgpt app登录账号,通过美区账号充值gpt4

其他:
到这个链接中登录获取api key,然后部署到其他地方(但由于后面好像还要充值,没再继续部署)

udiskie使用方法

图标的左右键功能不同。如果想unmount,需要在图标上点右键

TODO

把各个地方的blog全都迁移至此

没有进程,但是显存有占用

用以下命令查看所有在显卡上运行的进程。

但注意这种方法会打印所有卡上的进程,因此一旦kill,所有卡的都会停,非常危险,需要谨慎使用

fuser -v /dev/nvidia*

sudo 免密

一种情况是手动给自己的账号添加的sudo,此时用下面这个:

vim /etc/sudoers
# 找到下面这一行
yusongli ALL=(ALL:ALL) ALL
# 改为:
yusongli ALL=(ALL:ALL) NOPASSWD:ALL

另一种情况是自己的账号默认就有sudo权限,此时应该用下面这个:

vim /etc/sudoers
# 找到下面这一行
%sudo ALL=(ALL:ALL) ALL
# 改为:
%sudo ALL=(ALL:ALL) NOPASSWD:ALL

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.