Posted onIn博客管理
,
HexoViews: Symbols count in article: 9.9kReading time ≈25 mins.
This blog has switched to Github Action for automated deployment.
Using Hexo to generate a static blog and then deploying it to Github/Coding Pages is currently how my blog is hosted. It’s quite enjoyable to use, but there are several issues:
The environment configuration for Hexo is too cumbersome; it’s almost impossible to update the blog when changing to a new computer.
Each time I modify an article, I have to regenerate everything.
Additionally, the number of command executions for submitting the blog source files is too high (mainly the first step).
I wasted a lot of time submitting articles, so I optimized the process to almost achieve fully automated submissions.
Posted onIn编程笔记Views: Symbols count in article: 2.9kReading time ≈7 mins.
Recently, I’ve been reading the Boost code and writing some analyses on the usage and implementation of useful modules in the Boost libraries, with updates to come periodically.
Posted onIn编程工具
,
SublimeTextViews: Symbols count in article: 10kReading time ≈25 mins.
Recently, I would like to study the Boost library. Most tutorials available online are based on using IDEs (such as VS/Code::Blocks), but I find it frustrating to have to open a bloated IDE just to write some test code. Today, I fiddled around and managed to compile/link code that uses the Boost library in SublimeText. I also organized the process/tools I worked with, so if others have similar needs and happen to see this article, they can save some time.
2016.11.01 Update I used the latest version of MinGW64-GCC6.2 (x86_64-6.2.0-posix-seh-rt_v5-rev1) to compile LLVM/Clang 3.9, and then I used the compiled Clang to compile Boost1.62. The error messages that occurred when linking the Boost library in Clang are gone now. Note: When compiling Boost with Clang, it is best to ensure that the current version of clang is compiled from the version of gcc in the current system; otherwise, when linking the static libraries produced by clang, strange issues might arise.
Posted onInDockerViews: Symbols count in article: 1.7kReading time ≈4 mins.
Arukas is a Japanese Docker service provider that is currently in the testing phase and can be used for free. We can easily use Docker to do some interesting (useful) things, such as deploying our own blog or shadowsocks server.
Posted onInUnrealEngine
,
GitViews: Symbols count in article: 3.7kReading time ≈9 mins.
The Source Control provided in Unreal Editor allows you to implement basic functions such as version submission/version comparison/reverting changes through Git for blueprint projects, which is far less powerful than Git Bash, but the Diff between BluePrints is still very useful.
Posted onEdited onIn版本控制
,
GitViews: Symbols count in article: 4.2kReading time ≈10 mins.
no hostkey alg
When connecting to the SSH Server, if this prompt appears, it is due to the SSH version being used; the remote SSHD version is too high while the local SSH version is too low.
If the engine version is earlier than 4.27, upgrading to MacOS13+ will encounter this problem during remote builds. ## detected dubious ownership in repository at
1 2 3 4 5 6 7 8 9
$ git remote set-url origin https://git.woa.com/xxxx/UnrealEngine.git fatal: detected dubious ownership in repository at 'D:/agent/workspace/MasterPackage/SOURCE/Engine' 'D:/agent/workspace/MasterPackage/SOURCE/Engine' is owned by: 'S-1-5-21-1333135361-625243220-14044502-1020188' but the current user is: 'S-1-5-21-1333135361-625243220-14044502-1052754' To add an exception for this directory, call: git config --global --add safe.directory D:/agent/workspace/MasterPackage/SOURCE/Engine
If you switch to a new account, you will encounter the error message above for repositories pulled using the previous account.
The solution is to add all paths to the safe directory:
1
git config --global --add safe.directory "*"
Note: This command must be executed in the new account.
Warning: the ECDSA host key
When you encounter the warning while submitting to GitHub: Warning: the ECDSA host key for 'github.com' differs from the key for the IP address '192.30.255.112', it means your SSH client has authenticated another host matching the target IP address.
To resolve this issue, please follow these steps:
1. Remove the old key from the known_hosts file: Open the ~/.ssh/known_hosts file with a text editor (Windows users should find the file at %UserProfile%\.ssh\known_hosts) and locate the corresponding entry (referring to the IP address and hostname), then delete the corresponding line.
For example, find the following entry in the known_hosts file:
2. Confirm GitHub’s SSH host fingerprint: Confirm the currently valid transport layer security (TLS) public key fingerprint and SSH public key fingerprint from the GitHub official documentation.
3. Reconnect via SSH and add the new host key: Execute the following command in the terminal or command prompt:
This will automatically add the new github.com host key.
If prompted with “Hi username! You’ve successfully authenticated, but GitHub does not provide shell access.”, it means the SSH authentication is successful and the issue has been resolved.
Now, you should be able to submit code to GitHub normally, and the warning message should no longer appear.
pull/push prompts for password every time
You can execute the following command:
1
git config --global credential.helper store
Get the latest commit information of the current repository
To get the latest commit ID of the current repository, you can use the following command:
1 2
$ git rev-parse HEAD 5c342b5145720c8cd4642e50774990db1c4294c3
If you want to see branch and commit information, you can use the command below:
The -1 argument lists only the most recent commit.
If you add --decorate, you can see the branch information (this also depends on the git version; newer versions display branch information by default):
To clear all history records in a Git repository, keeping only the latest commit, you can follow these steps:
Create a new branch: First, ensure you are in a clean working directory (no uncommitted changes), then create a new branch.
1
git checkout --orphan latest_branch
This command creates a new branch without any history.
Add all files: Add all files to the new branch.
1
git add -A
Commit changes: Commit all files.
1
git commit -am "Initial commit with latest state"
Delete the old branch: Switch back to the main branch and delete the old branch.
1
git branch -D main
Rename the new branch to main: Rename the new branch to the main branch.
1
git branch -m main
Force push to the remote repository: Finally, force push the changes to the remote repository. Note: This will overwrite all history in the remote repository.
1
git push -f origin main
This will clear all history records, keeping only the latest commit. This operation is irreversible; all historical records will be permanently deleted, so please ensure you really do not need these historical records before executing this operation.
Differences in line endings between Win and Linux
Windows uses carriage return and line feed (CRLF, \r\n), while Linux uses line feed (LF, \n). If you create or modify files on Windows and then view them on Linux, Git may recognize changes due to the differences in line endings.
The solution is to configure how Git handles line endings. Use the following commands to set Git to automatically convert line endings:
1 2
git config --global core.autocrlf true# Windows git config --global core.autocrlf input # Linux
Use a .gitattributes file to specify how line endings should be treated for specific files, for example:
1
* text=auto
Note: After I set this, I found that changes in files could not be displayed in real-time in the working directory. You can delete this configuration in C:\User\[USER_NAME]\.gitconfig.
Posted onIn编程技巧Views: Symbols count in article: 7kReading time ≈17 mins.
At the beginning when writing code, I always rolled up my sleeves and got to work as soon as I encountered a problem, essentially writing code while debugging and simultaneously designing the solution flow. However, this approach is simply too slow, often leading to writing and deleting code, effectively resulting in a poorly designed code structure requiring refactoring, which wastes a lot of time.
Posted onIn读书笔记Views: Symbols count in article: 4.5kReading time ≈11 mins.
C++ Language Design and Evolution is a book written by C++ author Bjarne Stroustrup, discussing the thought process and trade-offs from the conception and design to the actual implementation of C++. It is arguably the only book on the market written from the perspective of a language designer on language design.
There are many issues where we should not only know How, but also understand Why, as this allows for a deeper comprehension of the subject. Fortunately, “C++ Language Design and Evolution” is precisely that kind of book. Recently, I realized many aspects of C++ that I only knew How but did not understand Why (too much was sacrificed for compatibility with C), and this article serves as a reading note and a record of Why, which I will gradually organize.