Question List in July, 2023
1、工作记录
工作内容不对外公开。
2、日常积累
2.1 SQLite 时间管理
#spatialite
-- 创建数据表
CREATE TABLE IF NOT EXISTS UID (
Id INTEGER PRIMARY KEY AUTOINCREMENT,
UidName TEXT,
CreateTime DATE
);
-- 插入当前时间的数据
INSERT INTO UID(UidName, CreateTime) VALUES(
'demo',
strftime('%Y-%m-%d %H:%M:%S','now','localtime')
);
2.2 C++ 复制文件
#cplusplus
#include <iostream>
#include <fstream>
int main() {
std::ifstream source("source.cpp", std::ios::binary);
std::ofstream destination("destination.cpp", std::ios::binary);
destination << source.rdbuf();
source.close();
destination.close();
return 0;
}
2.3 Mac+Docker+VSCode
(1)安装 Docker 并启动容器
#step.1 安装 Docker Desktop
wget https://desktop.docker.com/mac/main/arm64/Docker.dmg
#step.2 拉齐镜像并启动容器
docker pull ubuntu
docker run -it ubuntu /bin/bash
#step.3 安装 C++ 开发环境
cp sources.list /etc/apt/sources.list # 镜像源
apt update && apt install -y cmake g++ gdb
#step.4 为 vscode 安装插件
Docker
Dev Containers
# x86/64 镜像源 source.list
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# arch64 镜像源 source.list
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy main restricted universe multiverse
# deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-updates main restricted universe multiverse
# deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-updates main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-backports main restricted universe multiverse
# deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-security main restricted universe multiverse
# deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-security main restricted universe multiverse
(2) 配置终端
#step.1 安装 z shell
cat /etc/shells
apt-get install zsh
#step.2 安装 Oh My Zsh
sh -c "$(wget -O- http://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
#step.3 修改主题 robbyrussell 为 ys
vim ~/.zshrc
#ZSH_THEME="ys"
source ~/.zshrc
#step.4 安装插件
# 1) zsh-autosuggestions 插件可以帮助我们在输入命令时,根据历史的输入记录给出建议
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
# 2) zsh-syntax-highlighting 插件可以对输入的命令行添加高亮,并进行语法检查
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# 3) zsh-history-substring-search 插件可以实现对历史命令的子串搜索
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
# 4) 更新配置
vim ~/.zshrc
#plugins=(... zsh-autosuggestions zsh-syntax-highlighting zsh-history-substring-search)
source ~/.zshrc
(3)常用软件
#mac软件
[Yoink] # 文件拖拽到左侧收纳窗进行拷贝
[DataGraph] # 数据可视化软件, 类似于 Origin
[scidavis] # 免费数据可视化软件
[Obsidian] # Markdown 笔记管理
[Mos] # 让 Mac 链接别的鼠标时更顺畅
[MacDroid] # 链接手机管理数据
[TinyCal] # 点击图标显示具体日历
[Cursor] # 用 ChatGPT 辅助代码
参考资料
# Docker 容器使用[EB/OL].
# 解决brew慢的问题[EB/OL].