basic

Install package

For .deb

1
sudo dpkg -i *.deb

For .AppImage

1
2
chmod +777 *.AppImage
./*.AppImage

Fix package

1
2
3
4
5
sudo apt -f install
sudo apt update
sudo apt install [dependencies]
...
sudo apt install [package]

Manage process

See all the process:

1
ps aux

Find the target pid

1
pgrep [partial name] 

return the pid of the process
kill the process
1
kill [pid]

Useful command

grep

Search for confirmed strings in file

1
grep [option] [pattern] [file]

option

  • -i: ignore capitalizing
  • -v: inverse search
  • -n: show the line num
  • -f: reveral search of files in folder
  • -i: only print the name od file
  • -c: only print the line num

Example

display the battery percentage

1
upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage

ssh

SSH Overview

SSH (Secure Shell) is a network security protocol that provides secure access and file transfer through encryption and authentication mechanisms. It encrypts and verifies network data to provide secure login and other secure network services.

SSH Keys

SSH uses a combination of public and private keys to secure communication. The public key is used to encrypt data, while the private key is used to decrypt data. This ensures that even if data is intercepted during transmission, attackers cannot decrypt it, ensuring data security.

SSH Agent

An SSH agent is a program that stores private keys and can help you avoid having to enter your passphrase every time you use SSH. When you add a private key to an SSH agent, you only need to enter the passphrase the first time you use the key. After that, the SSH agent will automatically provide the private key for you.

Generating a New SSH Key Pair

You can use the ssh-keygen tool to generate a new SSH key pair. Here’s an example of how to use ssh-keygen to generate an RSA key pair:

1
ssh-keygen -t rsa -b 4096 -C “your_email@example.com”

In this command:

  • -t rsa specifies the type of key to create. In this case, we’re creating an RSA key.
  • -b 4096 specifies the number of bits in the key. In this case, we’re creating a 4096-bit key.
  • -C "your_email@example.com" adds a comment to the key. This can be any text you like, but it’s common to use your email address.

After running this command, ssh-keygen will prompt you for a location to save the key pair and for a passphrase to secure the private key. You can accept the default location by pressing Enter, or you can specify a different location if you prefer. If you don’t want to use a passphrase, you can leave it blank by pressing Enter.

Adding a Key to the SSH Agent on Ubuntu

On Ubuntu, you can add a key to the ssh-agent by following these steps:

  1. Open the terminal.
  2. Make sure ssh-agent is running. You can start it by running the eval "$(ssh-agent -s)" command.
  3. Run the ssh-add ~/.ssh/id_rsa command to add your first key (the one you commonly use) to the ssh-agent. If your key file is not in the default location (i.e., ~/.ssh/id_rsa), replace the path in the command with the actual path of your key file.
  4. If your key has a passphrase, you will be prompted to enter it. Enter the passphrase and press Enter.

After completing these steps, you have successfully added your first key to the ssh-agent. Now when you use SSH to connect to a remote server, the ssh-agent will automatically provide your private key.

Viewing Keys in the SSH Agent on Ubuntu

On Ubuntu, you can view the keys added to the ssh-agent by running the ssh-add -l command. This command lists the fingerprints of all keys in the ssh-agent.

InterestingPlugin

InterestingPlugin

Python related

Magma

magma-nvim
Magma is a NeoVim plugin for running code interactively with Jupyter.

Jupynium

Jupynium.nvim
It’s just like a markdown live preview, but it’s Jupyter Notebook live preview!

Jupynium uses Selenium to automate Jupyter Notebook, synchronising everything you type on Neovim.
Never leave Neovim. Switch tabs on the browser as you switch files on Neovim.

stdpath

stdpath

In nvim:

1
:h standard-path
  • CONFIG DIRECTORY (DEFAULT)
    $XDG_CONFIG_HOME Nvim: stdpath(“config”)
    Unix: ~/.config ~/.config/nvim
    Windows: ~/AppData/Local ~/AppData/Local/nvim

  • DATA DIRECTORY (DEFAULT)
    $XDG_DATA_HOME Nvim: stdpath(“data”)
    Unix: ~/.local/share ~/.local/share/nvim
    Windows: ~/AppData/Local ~/AppData/Local/nvim-data

  • RUN DIRECTORY (DEFAULT)
    $XDG_RUNTIME_DIR Nvim: stdpath(“run”)
    Unix: /tmp/nvim.user/xxx /tmp/nvim.user/xxx
    Windows: $TMP/nvim.user/xxx $TMP/nvim.user/xxx

  • STATE DIRECTORY (DEFAULT)
    $XDG_STATE_HOME Nvim: stdpath(“state”)
    Unix: ~/.local/state ~/.local/state/nvim
    Windows: ~/AppData/Local ~/AppData/Local/nvim-data

Note: Throughout the user manual these defaults are used as placeholders, e.g.
“~/.config” is understood to mean “$XDG_CONFIG_HOME or ~/.config”.

  • LOG FILE $NVIM_LOG_FILE E5430
    Besides ‘debug’ and ‘verbose’, Nvim keeps a general log file for internal
    debugging, plugins and RPC clients.
    :echo $NVIM_LOG_FILE
    By default, the file is located at stdpath(“log”)/log unless that path
    is inaccessible or if $NVIM_LOG_FILE was set before |startup|.
app
March24

March24

Meeting

  • TSINGHUA DELTA LAB & INTEL
  • TSINGHUA DELTA LAB & EPIC UNREAL –> MetaVerse

ChatGPT

  • 乔姆斯基的生成文法《文法结构》–>符号主义
  • ImageNet 婴儿的大脑
  • GPU

《涌现》

Generated Pre-trained(来自全球互联网的输入)

影响的职业

金融,白领,

工具发生了重大变化–>AIGC

猫视觉皮层实验

神经认知机(福岛)

method

method

Use GPT to write paper

现象确认

确保一些基本概念,保证同频思考
例如:

  • 确认中国教育中鸡娃什么意思

学术概念化

使用学术的语言体系,定位学术概念,连接已有的学术研究
例如:

  • 关于鸡娃,在教育学上有哪些已有的研究

定位优质学术资源

询问推荐的学术文献

  • 关于… 请推荐五篇引用高的英文文献
  • 综述文献

让GPT总结一下这5篇文献

对比分析

跨学科对比
跨地域对比
时间对比
擅长进行知识的连接
具体的案例

启示分析

具体引导

  • 从政策方面…
  • 从家庭方面…
  • 从学校方面…

写初稿

  • 先定一个标题(多个里面选一个)

  • 延伸个大纲(基于选定的标题)

  • 分板块写

  • 文献综述(加上参考文献)

m1

m1

Task

  • Load car configuration from .json file
  • Compose DevDocs
  • Investigate csharp comment documentation
  • use assimp to load .glb model

Vehicle Physics Pro

Starting point
The unity’s build-in physics engine PhysX is far from being precise enough for a vehicle simulator.

Needs

  • Closer to reality vehicle physics
  • Runtime performance
  • Not so complicated to config so that the composition of the savings and editor will not be a headache

Official

Install

Through Asset Store


GLTFUtility

Starting point
The car model should be customizable, i.e. the user drag a car model into a directory and the game should be able to load it.
Filetype .glb is nice but unity doesn’t have build-in support

Needs

  • Runtime import
  • support mesh and material

GLTFUtility

Install

In tactics project:

1
git submodule add https://github.com/Siccity/GLTFUtility.git ./Tactics/Assets/ThirdParty/GLTFUtility

Runtime API

1
2
3
4
5
6
7
8
9
10
11
12
13
14
using Siccity.GLTFUtility

// Single thread
void ImportGLTF(string filepath){
GameObject res = Importer.LoadFromFile(filepath);
}

// Multi thread
void ImportGLTFAsync(string filepath){
Importer.ImportGLTFAsync(filepath, new ImportSettings(), OnFinish);
}
void OnFinish(){
...
}

here I use Application.streamingAssetsPath+"/Model/"+JsonReader.vehicle.model.carBody[0].dir as filepath

Trouble shooting

  1. In the built game, encounter ArgumentNullException: Value cannot be null. Parameter name: shader
    Github Issue
  2. The file management of the game changed after being built. How to determine where to place the Save and Model folders?
    Use Application.streamingAssetsPath, stands for Assets/StreamingAssets in Unity editor and Game_Data/StreamingAssets in exported game.

Csharp’s interpretation of Json

First construct the structure of the json file in c#.
Notice: the name of the member variable should be the same with those in json file

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
[System.Serializable]
public class VehiclePhysicsPara
{
public float bodyMass;
public Vector3 centerOfMass;
public List<BodyColliderPara> collider;
public List<WheelColliderPara> wheel;
}

[System.Serializable]
public class BodyColliderPara
{
public string type; // box | sphere
public Vector3 position;
public Vector3 eulerRotation;
public Vector3 scale;
}
[System.Serializable]
public class SteeringWheelTypePara
{
public bool use;
public bool inverse;
}
[System.Serializable]
public class WheelTypePara
{
public bool powered;
public SteeringWheelTypePara steering;
}
[System.Serializable]
public class WheelSuspensionPara
{
public float spring;
public float damper;
public float distance;
public float initialPosition;
}
[System.Serializable]
public class WheelFrictionPara
{
public float extremumSlip;
public float extremumValue;
public float AsymptoteSlip;
public float AsymptoteValue;
}

[System.Serializable]
public class WheelColliderPara
{
public WheelTypePara type;
public float mass;
public float radius;
public Vector3 position;
public WheelSuspensionPara suspension;
public WheelFrictionPara forwardFriction;
public WheelFrictionPara sidewayFriction;
}

[System.Serializable]
public class VehicleModelPara
{
public List<CarBodyPara> carBody;
public List<WheelModelPara> wheel;
}
[System.Serializable]
public class CarBodyPara
{
public string name;
public string dir;
public Vector3 position;
public Vector3 eulerRotation;
public Vector3 scale;
public string shader;
}
[System.Serializable]
public class WheelModelPara
{
public string name;
public string dir;
public Vector3 scale;
public string shader;
}
[System.Serializable]
public class VehiclePara
{
public VehicleModelPara model;
public VehiclePhysicsPara physics;
}

Notice: [System.Serializable] is for serialized display in Unity editor.

Then, directly use build-in json loader:

1
2
VehiclePara vehicle;
vehicle = JsonUtility.FromJson<VehiclePara>(textJson.text);

All the parameters will be stored in the instance vehicle
vehiclePara


Abstract the vehicle as a Json structure

Graph

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
flowchart RL
Main
Model --> Main
Physics --> Main
Controller --> Main
carBody --> Model
subgraph bodyPart
part1
part2
end
bodyPart --> carBody
wheelVis --> Model
wheelVisGroup --> wheelVis
subgraph bodyCollider
boxCol
sphereCol
end
bodyCollider --> collider
collider --> Physics
massProperty --> Physics
wheelProperty --> Physics
wheelColGroup --> wheelProperty
subgraph wheelVisGroup
tyreVis1
tyreVis2
tyreVis3
tyreVis4
end
subgraph wheelColGroup
wheelCol1
wheelCol2
wheelCol3
wheelCol4
end
wheelVisGroup -- oneToOne --> wheelColGroup

Json example

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
{
"model":{
"carBody":[
{
"name":"body1",
"dir":"./CustomModel/car1/body1.obj",
"position":{"x":0,"y":0,"z":0},
"eulerRotation":{"x":0,"y":0,"z":0},
"scale":{"x":0,"y":0,"z":0},
"shader":"Standard"
},
{
"name":"body2",
"dir":"./CustomModel/car1/body2.obj",
"position":{"x":0,"y":0,"z":0},
"eulerRotation":{"x":0,"y":0,"z":0},
"scale":{"x":0,"y":0,"z":0},
"shader":"Standard"
}
],
"wheel":[
{
"name":"wheel1",
"dir":"./CustomModel/car1/wheel1.obj",
"scale":{"x":0,"y":0,"z":0},
"shader":"Standard"
}
]
},
"physics":{
"collider":[
{
"type":"box",
"position":{"x":0,"y":0,"z":0},
"eulerRotation":{"x":0,"y":0,"z":0},
"scale":{"x":0,"y":0,"z":0}
},
{
"type":"sphere",
"position":{"x":0,"y":0,"z":0},
"eulerRotation":{"x":0,"y":0,"z":0},
"scale":{"x":0,"y":0,"z":0}
}
],
"centerOfMass":{"x":0,"y":0,"z":0},
"bodyMass":700,
"wheel":[
{
"type":{"powered":true,"steering":{"use":true,"inverse":false}},
"mass":7,
"radius":0.5,
"position":{"x":0,"y":0,"z":0},
"suspension":{
"spring":25000,
"damper":9000,
"distance":0.3,
"initialPosition":0.5
},
"forwardFriction":{
"extremumSlip":0.1,
"extremumValue:":1,
"AsymptoteSlip":0.2,
"AsymptoteValue":0.8
},
"sidewayFriction":{
"extremumSlip":0.05,
"extremumValue:":1,
"AsymptoteSlip":0.2,
"AsymptoteValue":0.8
}
}
]
}
}

March21

Lecture content

operational ability vs academic ability

动手能力对于公司创业初期有关键作用
基础研发实力决定公司后期发展(学科)

After lecture chatting

phd vs start a business

读书永远风险最低, 长线收益最高
李教授能搞项目是因为他可以带动硕博本,但本科生指挥不动人

How to design education

以项目为导向,兼顾基础知识的课程
自上而下, 夯实基础原理的理解,而不是调参摁卷(某些竞赛就是源代码拿来然后使劲调参,钻牛角尖,不符合人才培养要求,无基础能力,适应力差)
某些创新的小比赛就比较好,能给自己的成果锦上添花

basic

LSP install location

~/.local/share/nvim/mason/packages/*

1
:h mason-settings