Skip to content

Instantly share code, notes, and snippets.

@yougg
Created April 4, 2022 12:53
Show Gist options
  • Save yougg/55bfd0e1c464373733e3cd808d97bf41 to your computer and use it in GitHub Desktop.
Save yougg/55bfd0e1c464373733e3cd808d97bf41 to your computer and use it in GitHub Desktop.
Command Note

Command Note

@yougg
Copy link
Author

yougg commented Apr 4, 2022

Tool/Software/Middleware

MySQL

启用用户远程连接权限

grant all privileges on *.* to ${username}@${IP} identified by '${pwd}' with grant option;
flush privileges;

超级权限

grant super on *.* to 'my_user'@'localhost';
revoke super on *.* from 'my_user'@'localhost';

连接数据库

mysql -h ${IP} -P ${Port} -D ${database} -u ${user} -p${pwd}

本地MySQL调试

docker run -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=pa55w0rd --name DB mysql
docker exec -it DB bash
mysql -u root -ppa55w0rd

Docker

从镜像复制文件到其他镜像

COPY --from=ochinchina/supervisord:latest /usr/local/bin/supervisord /usr/local/bin/supervisord

列出镜像ID、摘要

docker images -f=reference='registry.example.com/*/*' --format "table {{.Repository}}:{{.Tag}}\t{{.Digest}}\t{{.CreatedSince}}"

docker image ls --format "table {{.Repository}}:{{.Tag}}\t{{.Digest}}\t{{.CreatedSince}}" registry.example.com/group*/*
docker image ls --format "{{.Repository}}:{{.Tag}}" registry.example.com/group*/*

IDE/Editor

编译Webkit版本的LietIDE

sudo apt install qt4-qmake libqt4-dev libqtwebkit-dev
go get github.com/visualfc/gotools
cd ${SRC}/liteide/build/
chmod +x build_linux_qt4_webkit.sh
./build_linux_qt4_webkit.sh
cp -rf liteide ~/

Emacs Shortcut

image
image
image

Git

切换远程仓库路径

git remote set-url origin https://github.com/user/FORK.git

添加子模块

cd parent_project
git submodule add https://github.com/username/subproject.git external/src
git submodule update --init --recursive external/src
cd external/src
git checkout -b develop origin/develop
cd ..
git add .
git commit -m 'Add submodule'
git push

同步子模块

git submodule update --init --force --recursive

删除子模块

  1. Delete the relevant section from the .gitmodules file.
git config -f .gitmodules --remove-section submodule.src

Stage the .gitmodules changes git add .gitmodules

  1. Delete the relevant section from .git/config.
git config --remove-section submodule.src
  1. Delete submodule and folder
git rm --cached path_to_submodule
rm -rf .git/modules/path_to_submodule
git commit -m "Removed submodule <name>"
  1. Delete the now untracked submodule files
rm -rf path_to_submodule

git克隆保存用户/密码

git clone http://username:[email protected]/user/project.git

git指定提交时的作者和邮箱

GIT_AUTHOR_NAME="some one" GIT_AUTHOR_EMAIL="[email protected]" GIT_COMMITTER_NAME="some one" GIT_COMMITTER_EMAIL="[email protected]" git commit -m 'message'
git push -f --set-upstream origin master

配置git diff使用vimdiff

git config --global diff.tool vimdiff
git config --global difftool.prompt false
git config --global alias.d difftool

使用方式

git difftool
git d

如果执行报错

Can't locate Error.pm in @inc ......

则执行如下方式后再操作

cpan Error.pm

或者

sudo perl -MCPAN -e 'install Error'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment