04 Oct
Ubuntu删除无用的ppa(之前安装的ppa现在因为proxy缘故下载不下来,需要删除)
- 直接在/etc/apt/sources.list.d/文件夹中删除对应的文件即可。
- 可以安装ppa-purge
GitHub回到指定的commit
|
|
返回最近提交:git pull
更新了oh-my-zsh的主题
默认主题由于过于简洁导致时长分不清当前工作目录;因此更换了一个新的eastwood
主题,这是和westwood
相互照应吗🤔, 效果不错。
05 Oct
Check the version and codename in WSL
|
|
Bug: Protocol “https:” not supported. Expected “http:” #2003
In node, when the npm
version is lower than 7.0.6
, you will get the error.
you can either upgrade the npm
version or unset you proxy settings.
Install NVIM
Trying to install nvim, and use the config from the github, there are some problems:
- mind the
python
,path
variable, you need to change it. - install the correct
node
version, refer to the bug above. 16 is better. - this sh use all from souce, so you might have problem when you install from the package manager ( like apt).
- the shell script needs to be update, some are not so good (it use zsh as default, but it don’t config the zsh).
Currently I will still use the vim
with some default configs, when I have time, I will migrate to nvim
.
In case I forget, the relevant folders are ~/package
, ~/tools
.
Show the size of a directory
|
|
08 Oct
Ubuntu apt problem
When updating ubuntu with sudo apt update
, got the error:
|
|
Run:
|
|
This command gets the latest time from Windows machine’s RTC and sets the system time to that.
09 Oct
Git SSH
I want to add another github account in my terminal, I refer stackoverflow for some ways. The following is a work way:
- Generate new ssh
id_rsa
key (Link1 & Link2) - Add the SSH key to ssh-agent Link
- Add a new SSH key to your account Link
- Change remote for repository from
https
togit
|
|
This is also a work Link. I haven’t give it a try.
10 Oct
yt-dlp
Download the youtube video, the youtube-dl
is so slow, even with proxy.
Use the command:
|
|
Speed is alright.
14 Oct
Make microsoft software available even when using proxy
Use the clash, then in UWP Lookback
, mark the software you want to use.
15 Oct
Make python
excute Python 3
Install python-is-python3
with
|
|
Then the python2
in your computer will also be useless, then just
|
|
and every thing works fine.
Change the hostname of Ubuntu
The default config for standard Ubuntu is at /usr/hostname
and /usr/hosts
, just replace them with the name you want.
But in WSL2, you should change the wsl.conf
which is under /usr/wsl.conf
with
|
|
Then restart, everything works fine.
18 Oct
Picture the code
silicon
is a tool that can make png file with code input.
|
|
Use with cargo install silicon
, in Ubuntu, perhaps need install some libs to make it work,
use apt search xxx
to search the package.
20 Oct
SQL standard
I am working miniob to add some basic SQL syntex, I find in most database, like mysql
, postgres
, mariadb
, the SQL query select id, * from t;
will cause the SQL error.
But in spark-sql
, I can even write this query: select id, *, id, *, id from t;
, this is ridiculous, I need to remove the COMMA STAR attr_list
in attr_list
cause it is not the standard SQL in most databases.
Docker in WSL
I install docker
in my WSL2, I can test something on wsl mysql easily.
My conf is
|
|
But since wsl supports systemd
on Sep, after I set
|
|
I can’t start my docker service, I tried sudo dockerd --debug
, sudo systemctl start docker
from stackoverflow, but none of them works.
Then I tried remove systemd=true
, docker works again. But I still don’t know why.
22 Oct
Type Conversion in C++
- Implicit Type Conversion
|
|
Implicit type conversion may cause data lossing when convert the larger type to smaller type. like from Long double to double.
- Explict Type Conversion
- C style type conversion
|
|
- Function-style casting
|
|
- Type conversion Operators
- static_cast
- dynamic_cast
- const_cast
- reinterpret_cast
25 Oct
The winget
is built-in program for windows to install softwares.
The scoop
is another package manager like brew
in Mac, apt
in Debian.
The text to ASCII, use the figlet
command (a fun fact: there is also a software named toilet
that can also generate ASCII characters.
The feh
use the X window to display image, which is very lightweight,
besides, use the explorer.exe xxx.png
can also open the image file. Just add an alias with
alias winfile="explorer.exe"
. This is very useful.
01 Nov
SELECT *
will make the query slow
- 效率低的原因
- 不需要的列会增加数据传输时间和网络开销
- 需要解析更多的对象、字段、权限、属性等相关内容,在SQL语句复杂,硬解析较多的情况下,会对数据库造成沉重的负担
- 增大网络开销;*有时会带上如log、IconMD5之类的无用且大文本字段,数据传输size会集合增长。如果DB和应用程序不在同一台机器,这种开销非常明显。
- 即使MySQL服务器和客户端是在同一台机器上,使用的协议还是tcp,通信也是需要额外的时间。
- 对于无用的大字段,如varchar、blob、text,会增加io操作
- 准确来说,长度超过728字节的时候,会先把超出的数据序列化到另外一个地方,因此读取这条记录会增加一次io操作。
- 失去MySQL优化器“覆盖索引”策略优化的可能性
- 基于MySQL优化器的“覆盖索引”策略又是速度极快,效率极高,业界极为推荐的查询优化方式。
- 不需要的列会增加数据传输时间和网络开销
18 Nov
perf
tool in WSL2
Normally, there is no perf tools in WSL2 linux, (Debian/Ubuntu), in order to use perf tools, you need to use WSL kernel to compile it locally. The folder is /WSL*/tools/perf
. Before compile, install the bison
and flex
. Then just run make
. After compiling, there are two ways to use perf:
- add the perf
realpath
toPATH
, likeexport PATH=$PATH:/<path of perf>
in.zshrc
or.bashrc
file. - just copy the
perf
file tousr/local/bin
.
Way 2 is better.
Then refer this blog and flamegraph github readme file to draw flamegraph.
Python tools
There are some tools to check the python code. Like mypy
, pyflakes3
, black
. In C/C++, cpplint
is a good choice.
19 Nov
IRC
on Debian
I am using the weechat as my IRC client, my IP is banned by libera, luckily, the OFTC
is still available. There are some interesting channels on Debian IRC, and I even find a #debian-zh
channel.
Here are step I use weechat(I did not use the ssl):
- use
/help server
to check some useful command to connect, list, or delete a server. - use
/server add oftc irc.oftc.net
to add this server to weechat. PS. refer to weechat guide - you can alias your name like
/set irc.server.oftc.nicks "<your nicks>"
- some channels like
#debian-zh
requires you to register and verify your usename. refer to msg NickServ help. - use
/join #debian-zh
, here you are!
IRC NickServ
Some channels require you to register a nickname before chatting.
/msg NickServ help
will show how to register.
use /msg NickServ register <passwd> <mail>
to register a nickname. Both are required to register.
mail is only used to find the passwd when you do not remember.
After that you can use /msg NickServ info <nick>
and /msg NickServ status <nick>
to check your nickname.
Blog with hugo and papermod
Coder theme supports code not well, so I choose change coder to papermod.
It takes me a lot of time to understand the domain. At last, it works! I put the CNAME
file in the static folder according to manual, then every time I update my blog, aucker.me
works well, cool.👏
Plus, I also learn a git command refererence:
Delete a remote branch
|
|
Delete a local branch
|
|
To set a local mirror of git, refer this
20 Nov
IP地址是如何跳转的
很久之前利用GitHub pro的账号在namecheap上白嫖了一个一年的.me
域名,于是乎就可以用这个域名作为我的博客地址。
这两天在配置博客的时候老是出问题,问题的起因就在于用了hugo中的papermodx主题,但是之前用papermod构建的主题用aucker.me托管之后不会自动更新,现在在我的chrome上输入aucker.github.io
之后还是会跳转到aucker.me
,这个问题困扰了我好久,直到我在Firefox上输入aucker.github.io
之后,并没有跳转。我意识到可能是浏览器的问题。
11 Feb 2023
Set the token for private repo
When you push commits in private repo, you have to enter your username and password, if you enable two step authentication, you have to use your token, so set the token before push can save a lot of time
|
|
Then you can directly push your commits.
You can also use ssh to push your commits other than https
, before this, you need to configure ssh key in your computer and GitHub, then:
|
|
Install deb
file in debian manually
sudo apt install file.deb
sudo dpkg -i file.deb
Both works on debian/ubuntu.
23 Mar 2023
Configure hugo blog to render images well
This is also a MD format, just refer to stackoverflow.
LaTeX compile problem
When I compile my thesis, there is a problem:
Something's wrong--perhaps a missing \item. \end{thebibliography}
.
The reason is the *.bbl
file under this repo, but there is no \cite{}
on the paragraph, I will encounter a compilation problem.
Solution for me:
- delete the
*.bbl
file - edit the
*.tex
file, add\cite{*}
anywhere - recompile, all done<3
25 Mar 2023
How to start docker image in CLI
Use mysql as example, when download from the dockerhub, you can use docker images
to list all the images.
Then you need to start this image, use the command:
|
|
this command will start this image in a container, you can use docker ps
or docker containers ls
to list all the active containers.
Note: when you got nothing when run docker ps
, perhaps some container is not active, just use the docker start container-id
to start the container. Is this a bug?
Then when we want to use this mysql, just run the command:
|
|
06 May 2023
Ping not working in WSL2 Debian
Use ping in Debian WSL2, got ping: socket: Operation not permitted
, after run with sudo, I can use ping again, weird.
There is a issue in GitHub, just for reference.
09 May 2023
Reading the book The Linux Command Line.
Below is the Ch6, Redirection.
Redirecting Standard Error
While we have refered to the first three of these file streams as standard input, ouput, and error, the shell references them internally as file descriptors 0, 1 and 2, respectively. Since standard error is the same as file descriptor 2, we can redirect standard error with this notation:
|
|
Redirecting Standard Output and Standard Error to One File
There are cases in which we may want to capture all of the output of a command to a single file. So we need redirect both standard output and standard error at the same time. There are two ways, the first traditional way, which works with old version of the shell is as follows:
|
|
Using this method, we perform two redirections. First we redirect standard output to the file ls-output
and then we redirect file descriptor 2 (standard error) to file descriptor 1 (standard output) using the notation 2>&1
.
Recent version of bash provide a second, more streamlined method for performing this combined redirection shown here:
|
|
In this example, we use the single notation &> to redirect both standard output and standard error to the file ls-output
. We can also append the standard output and standard error streams to a single file like so:
|
|
Disposing of Unwanted Output
When we don’t want output from a command, we just want to throw it away. This applies particularly to error and status messages. The system provides a way to do this by redirecting output to a special file called “/dev/null”. This file is a system device often referred to as a bit bucket, which accepts input and does nothing with it. To supress error messages from a command, we do this:
|
|
Below is Ch7, Shell.
Pathname Expansion
The mechanism by which wildcards work is called pathname expansion. If we try some of the techniques that we employed in earlier chapters, we will see that they are really expansions. Given a directory that looks like this:
|
|
we could carry out the following expansions:
|
|
or even this:
|
|