pigbreeder / CodeMemo

1 stars 0 forks source link

shell #3

Open testpppppp opened 2 years ago

testpppppp commented 2 years ago

打印指定行 https://jiangliheng.github.io/2020/07/10/linux-print-text-part-line-content/ https://blog.51cto.com/u_15278282/3021184

for i in {0..34}; do
        sstr='>>>>>>> 0.5'
        st=$(awk -v mstr="$sstr" "/$sstr/{print NR}" $i.log|tail -n1)
        estr='>>>>>>> 0.6'
        ed=$(awk -v mstr="$estr" "/$estr/{print NR}" $i.log|tail -n1)
        #echo $i $st $ed
        awk -v st="$st" -v ed="$ed" '{if(NR>st+2 && NR<ed-6){print $0}}' $i.log
done
testpppppp commented 2 years ago

vim

colorscheme torte
nnoremap ; : 

let mapleader=','
" 去除搜索的标志, normal下,/即可
" noremap / :nohls
" 跨panel复制粘贴
vmap <Leader>y :w! ~/.vbuf
nmap <Leader>p :r ~/.vbuf
testpppppp commented 1 year ago

regex re.match 匹配的一定是开头才返回 re.search 返回匹配到的第一个 re.findall 返回匹配到的全部

# multi either or
re.search(r'/(ID|SG|PH)\-.*', f)
# 一种错误方式是 [(ID)|(SG)|(PH)],[]里面的都是单个字符

# 生成待匹配正则,⚠️要用escape避免不合语法
ubrand2 = re.escape(ubrand)
ret = re.finditer(fr'\b{ubrand2}\b', utext, re.IGNORECASE)
testpppppp commented 1 year ago

github 使用多个账号

step1

生成多个账号 $ ssh-keygen -t rsa -C 'xxxxx@company.com' -f ~/.ssh/gitee_id_rsa

step2

~/.ssh 目录下新建一个config文件

Host github.com
    HostName github.com
    User git
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa_normal_github

Host adoredee.github.com
    HostName github.com
    User git
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa_hugo_github

step3

去网站把自己key加进去 git clone,注意后面的host增加了一项跟config一样 git clone git@adoredee.github.com:adoredee/GitlocalDoc.git

step4

配置项目的名称

git config user.name "your github name"
git config user.email "your email"

https://gitee.com/help/articles/4229#article-header0 https://kangzhiheng.top/post/11-more-ssh-in-one-laptop/

testpppppp commented 1 year ago

vimrc

colorscheme torte
nnoremap ; :

set term=builtin_ansi
if has('mouse')
  set mouse=a
endif

set encoding=utf8

set nobackup
set nowb
set noswapfile

" winpos 5 5 这个强制打开位置的,去掉
" 高亮显示匹配的括号
set showmatch
" 匹配括号高亮的时间(单位是十分之一秒)
set matchtime=1
" 光标移动到buffer的顶部和底部时保持3行距离
set scrolloff=3
" remove highlight
noremap <silent><leader>/ :nohls<CR>
" select all
map <Leader>sa ggVG"
" kj 替换 Esc
inoremap kj <Esc>

let mapleader=','
" 去除搜索的标志, normal下,/即可
" noremap / :nohls
" 跨panel复制粘贴
vmap <Leader>y :w! ~/.vbuf
nmap <Leader>p :r ~/.vbuf

" 搜索高亮选中部分 https://blog.twofei.com/610/
vnoremap // y/<c-r>"<cr>
set nu
set ruler                   " 打开状态栏标尺
set cursorline              " 突出显示当前行
set magic                   " 设置魔术
set guioptions-=T           " 隐藏工具栏
set guioptions-=m           " 隐藏菜单栏
"set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ %{&encoding}\ %c:%l/%L%)\
" 设置在状态行显示的信息
set foldcolumn=0
"set foldmethod=indent 
set foldlevel=3 
set foldenable              " 开始折叠
" 不要使用vi的键盘模式,而是vim自己的
set nocompatible
" 语法高亮
set syntax=on
" 去掉输入错误的提示声音
set noeb
" 在处理未保存或只读文件的时候,弹出确认
set confirm
" 自动缩进
set autoindent
set cindent
" Tab键的宽度
set tabstop=4
" 统一缩进为4
set softtabstop=4
set shiftwidth=4
" 不要用空格代替制表符
set expandtab
" 在行和段开始处使用制表符
set smarttab
" 显示行号
set number
" 历史记录数
set history=10000
"禁止生成临时文件
set nobackup
set noswapfile
"搜索忽略大小写
set ignorecase

" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
  endif