
python
python将markdown转换为html并应用github-markdown-css样式
穆琪 发表于2023-09-26 浏览8 评论0
最近在尝试给文本编辑器加一个markdown转html的功能,然后发现转换出来的样式很丑,遂使用github-markdown-css样式进行美化。
主要使用python-markdown模块来进行转换,并使用开源的github-markdown-css样式来美化
1.安装markdown库
pip install markdown
杂项
vim配置备份
穆琪 发表于2023-08-30 浏览425 评论0
" vundle config set nocompatible " required filetype off " required " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() " alternatively, pass a path where Vundle should install plugins "call vundle#begin('~/some/path/here') " let Vundle manage Vundle, required Plugin 'gmarik/Vundle.vim' Plugin 'https://github.com/scrooloose/nerdtree' Plugin 'kien/rainbow_parentheses.vim' Plugin 'https://github.com/bling/vim-airline' " add all your plugins here (note older versions of Vundle " used Bundle instead of Plugin) " All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required " user config " 通用配置 syntax on set ic set hlsearch set encoding=utf-8 set fileencodings=utf-8,ucs-bom,GB2312,big5 set cursorline set autoindent set smartindent set scrolloff=4 set showmatch set nu " python文件配置 let python_highlight_all=1 au Filetype python set tabstop=4 au Filetype python set softtabstop=4 au Filetype python set shiftwidth=4 au Filetype python set textwidth=79 au Filetype python set expandtab au Filetype python set autoindent au Filetype python set fileformat=unix autocmd Filetype python set foldmethod=indent autocmd Filetype python set foldlevel=99 " 分割窗口配置 set splitbelow set splitright " split navigations nnoremap <C-J> <C-W><C-J> nnoremap <C-K> <C-W><C-K> nnoremap <C-L> <C-W><C-L> nnoremap <C-H> <C-W><C-H> " 代码折叠 set foldmethod=indent set foldlevel=99 nnoremap <space> za " 文件树配置 nnoremap <F3> :NERDTreeToggle<CR> autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif " 括号匹配颜色配置 let g:rbpt_colorpairs = [ \ ['brown', 'RoyalBlue3'], \ ['Darkblue', 'SeaGreen3'], \ ['darkgray', 'DarkOrchid3'], \ ['darkgreen', 'firebrick3'], \ ['darkcyan', 'RoyalBlue3'], \ ['darkred', 'SeaGreen3'], \ ['darkmagenta', 'DarkOrchid3'], \ ['brown', 'firebrick3'], \ ['gray', 'RoyalBlue3'], \ ['darkmagenta', 'DarkOrchid3'], \ ['Darkblue', 'firebrick3'], \ ['darkgreen', 'RoyalBlue3'], \ ['darkcyan', 'SeaGreen3'], \ ['darkred', 'DarkOrchid3'], \ ['red', 'firebrick3'], \ ] let g:rbpt_max = 16 let g:rbpt_loadcmd_toggle = 0 au VimEnter * RainbowParenthesesToggle au Syntax * RainbowParenthesesLoadRound au Syntax * RainbowParenthesesLoadSquare au Syntax * RainbowParenthesesLoadBraces

python-web框架
推荐一个开源项目:Python在线pdb
穆琪 发表于2023-08-16 浏览27 评论0
项目地址:https://github.com/romanvm/python-web-pdb
项目截图:

操作系统
记录一次centos7恢复系统的过程
穆琪 发表于2023-06-15 浏览53 评论0
背景
昨天客户反馈了一个问题,服务器突然进不去系统了,只能进入一个shell的维护系统,显示下图的样子
操作系统
修改git密码后重置更新git记住的密码
穆琪 发表于2023-06-07 浏览57 评论0
背景
域账号密码到期了,进行修改之后提交代码发现git默认记住的密码还是原来的,需要重新重置一下密码进行更新。
操作步骤
重置密码
git config --system --unset credential.helper git config --global credential.helper store
操作系统
docker根据overlay2的目录名找到对应的容器
穆琪 发表于2023-06-06 浏览57 评论0
背景
在工作中,有一段旧代码在容器中使用了临时文件库tmpfile,并设置为不自动删除,所以临时文件一直堆积在/tmp目录下。
而容器中的tmp目录是不会清理的,终于有一天,整个var目录满了。
查到overlay2目录下的某个目录占用比较大,就需要根据目录名找到对应的容器
操作语句
docker ps -q | xargs docker inspect --format '{{.State.Pid}}, {{.Id}}, {{.Name}}, {{.GraphDriver.Data.WorkDir}}' | grep '目录名'
操作系统
麒麟高级服务器操作系统V10安装docker
穆琪 发表于2023-05-23 浏览80 评论0
背景
服务采用docker启动,适配国产化麒麟V10系统,需要安装docker
软件包
使用二进制的安装方式进行安装,docker版本为19.03.15
docker下载地址:https://download.docker.com/linux/static/stable/x86_64/
操作系统
麒麟高级服务器操作系统V10安装supervisor
穆琪 发表于2023-05-23 浏览76 评论0
数据库
redis查看占用内存大的key
穆琪 发表于2023-05-15 浏览109 评论0
背景
在测试环境中,经常出现某些同事乱用redis存数据,导致redis内存不够用,所以有下面的命令来查redis的内存占用和占用大的key。
命令
查看redis占用内存信息
docker环境:
docker exec -i redis redis-cli -h 127.0.0.1 -p 6379 -a <password> -n 1 info Memory
杂项
kafka查看topic的偏移量
穆琪 发表于2023-05-12 浏览96 评论0
1. 列举消费者 ./kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list 2. 查看偏移量 ./kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group consumer --describe 3. 移动至最新 ./kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group multi-alarms-pro --topic Alarms --reset-offsets --to-latest -execute