Compare commits
10 commits
09c66e71cf
...
2ad1ecf074
Author | SHA1 | Date | |
---|---|---|---|
Akemi Izuko | 2ad1ecf074 | ||
Akemi Izuko | e3e2868d99 | ||
Akemi Izuko | 52edf88012 | ||
Akemi Izuko | ae5113f102 | ||
Akemi Izuko | 3ed011462c | ||
Akemi Izuko | b107d81043 | ||
Akemi Izuko | 2e4d73806f | ||
Akemi Izuko | c3b2c9ad34 | ||
Akemi Izuko | 6b792716c2 | ||
Akemi Izuko | 52a8bdd094 |
32
bin/ssh-list-config.py
Executable file
32
bin/ssh-list-config.py
Executable file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
|
def bold(s):
|
||||||
|
return "\033[1m" + s + "\033[0m"
|
||||||
|
|
||||||
|
RE_HOST = re.compile('Host (.*)')
|
||||||
|
RE_HOSTNAME = re.compile('Hostname (.*)')
|
||||||
|
|
||||||
|
with open(f"{os.environ['HOME']}/.ssh/config", 'r') as f:
|
||||||
|
lines = [l.strip() for l in f.readlines()]
|
||||||
|
|
||||||
|
lines = list(filter(lambda x: not x.startswith('#'), lines))
|
||||||
|
|
||||||
|
l = list()
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
|
m = RE_HOST.match(line)
|
||||||
|
n = RE_HOSTNAME.match(line)
|
||||||
|
|
||||||
|
if m is not None:
|
||||||
|
l.append([bold(m[1]) + ":", None])
|
||||||
|
elif n is not None:
|
||||||
|
l[-1][1] = n[1]
|
||||||
|
|
||||||
|
mlength = max(len(s[0]) for s in l )
|
||||||
|
|
||||||
|
l.sort(key=lambda x: x[0])
|
||||||
|
|
||||||
|
for line in l:
|
||||||
|
print(f"{line[0]:{mlength}} {line[1]}")
|
|
@ -11,12 +11,18 @@ battery_charge() {
|
||||||
}
|
}
|
||||||
|
|
||||||
display_brightness() {
|
display_brightness() {
|
||||||
|
local x
|
||||||
|
|
||||||
if command -v ddcutil &>/dev/null; then
|
if command -v ddcutil &>/dev/null; then
|
||||||
ddcutil getvcp 10 | awk '
|
x="$(ddcutil getvcp 10 2>/dev/null |\
|
||||||
match($0, /[0-9]+,/) { printf "%s", substr($0, RSTART, RLENGTH - 1) }'
|
awk 'match($0, /[0-9]+,/) { printf "%s", substr($0, RSTART, RLENGTH - 1) }')"
|
||||||
else
|
|
||||||
light -G | awk '{ split($0, a, "."); printf "%s", a[1] }'
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$x" ]]; then
|
||||||
|
x="$(light -G | awk '{ split($0, a, "."); printf "%s", a[1] }')"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "%s" "$x"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_volume() {
|
get_volume() {
|
||||||
|
@ -25,15 +31,15 @@ get_volume() {
|
||||||
}
|
}
|
||||||
|
|
||||||
remaining_ram() {
|
remaining_ram() {
|
||||||
free --mega | awk '/Mem/ {
|
awk '
|
||||||
split($0, a, " ")
|
/MemTotal:/ { memtotal = $2 / 1024**2 }
|
||||||
|
/MemAvailable:/ { mavailable = $2 / 1024**2 }
|
||||||
|
|
||||||
used = a[3] / 1000
|
END {
|
||||||
shared = a[5] / 1000
|
used = memtotal - mavailable
|
||||||
available = a[7] / 1000
|
printf "%0.1fG / %.1fG", used, memtotal - used
|
||||||
|
}
|
||||||
printf "%0.1fG / %.1fG", used + shared, available
|
' /proc/meminfo
|
||||||
}'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ramu="$(remaining_ram)"
|
ramu="$(remaining_ram)"
|
||||||
|
|
|
@ -91,6 +91,9 @@ bind T clock-mode
|
||||||
bind-key -n M-0 switch-client -n
|
bind-key -n M-0 switch-client -n
|
||||||
bind-key -n M-9 switch-client -p
|
bind-key -n M-9 switch-client -p
|
||||||
|
|
||||||
|
unbind-key w
|
||||||
|
bind-key w choose-session
|
||||||
|
|
||||||
# Tmux Keybinds =====================================================
|
# Tmux Keybinds =====================================================
|
||||||
# Reload tmux quickly
|
# Reload tmux quickly
|
||||||
unbind R
|
unbind R
|
||||||
|
@ -122,7 +125,7 @@ bind-key -T copy-mode-vi 'H' send-keys '^'
|
||||||
# Navigate to previous command prompt
|
# Navigate to previous command prompt
|
||||||
bind-key b copy-mode\;\
|
bind-key b copy-mode\;\
|
||||||
send-keys -X start-of-line\;\
|
send-keys -X start-of-line\;\
|
||||||
send-keys -X search-backward " "
|
send-keys -X search-backward "( |Compiling)" # For Cargo compiles too
|
||||||
|
|
||||||
# Copy mode selection
|
# Copy mode selection
|
||||||
bind P paste-buffer
|
bind P paste-buffer
|
||||||
|
|
1
vim/.vim/ftdetect/mlir.vim
Normal file
1
vim/.vim/ftdetect/mlir.vim
Normal file
|
@ -0,0 +1 @@
|
||||||
|
au BufRead,BufNewFile *.mlir set filetype=mlir
|
|
@ -229,7 +229,7 @@ let RG_TEMPLATE = 'rg --hidden --no-ignore --follow '
|
||||||
let $FZF_DEFAULT_COMMAND = RG_TEMPLATE . '--files '
|
let $FZF_DEFAULT_COMMAND = RG_TEMPLATE . '--files '
|
||||||
|
|
||||||
" Use ripgrep with fzf (from Jonhoo)
|
" Use ripgrep with fzf (from Jonhoo)
|
||||||
noremap <leader>s :Rg<CR>
|
noremap <leader>S :Rg<CR>
|
||||||
command! -bang -nargs=* Rg
|
command! -bang -nargs=* Rg
|
||||||
\ call fzf#vim#grep(
|
\ call fzf#vim#grep(
|
||||||
\ RG_TEMPLATE
|
\ RG_TEMPLATE
|
||||||
|
@ -239,6 +239,8 @@ command! -bang -nargs=* Rg
|
||||||
\ : fzf#vim#with_preview('right:50%:hidden', '?'),
|
\ : fzf#vim#with_preview('right:50%:hidden', '?'),
|
||||||
\ <bang>0)
|
\ <bang>0)
|
||||||
|
|
||||||
|
noremap <leader>s :BLines <CR>
|
||||||
|
|
||||||
" FZF colors match vim colorscheme
|
" FZF colors match vim colorscheme
|
||||||
let g:fzf_colors =
|
let g:fzf_colors =
|
||||||
\ { 'fg': ['fg', 'Normal'],
|
\ { 'fg': ['fg', 'Normal'],
|
||||||
|
|
141
vim/.vim/syntax/mlir.vim
Normal file
141
vim/.vim/syntax/mlir.vim
Normal file
|
@ -0,0 +1,141 @@
|
||||||
|
" Vim syntax file
|
||||||
|
" Language: mlir
|
||||||
|
" Maintainer: The MLIR team, http://github.com/tensorflow/mlir/
|
||||||
|
" Version: $Revision$
|
||||||
|
" Some parts adapted from the LLVM vim syntax file.
|
||||||
|
|
||||||
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn case match
|
||||||
|
|
||||||
|
" Types.
|
||||||
|
"
|
||||||
|
syn keyword mlirType index f16 f32 f64 bf16
|
||||||
|
" Signless integer types.
|
||||||
|
syn match mlirType /\<i\d\+\>/
|
||||||
|
" Unsigned integer types.
|
||||||
|
syn match mlirType /\<ui\d\+\>/
|
||||||
|
" Signed integer types.
|
||||||
|
syn match mlirType /\<si\d\+\>/
|
||||||
|
|
||||||
|
" Elemental types inside memref, tensor, or vector types.
|
||||||
|
syn match mlirType /x\s*\zs\(bf16|f16\|f32\|f64\|i\d\+\|ui\d\+\|si\d\+\)/
|
||||||
|
|
||||||
|
" Shaped types.
|
||||||
|
syn match mlirType /\<memref\ze\s*<.*>/
|
||||||
|
syn match mlirType /\<tensor\ze\s*<.*>/
|
||||||
|
syn match mlirType /\<vector\ze\s*<.*>/
|
||||||
|
|
||||||
|
" vector types inside memref or tensor.
|
||||||
|
syn match mlirType /x\s*\zsvector/
|
||||||
|
|
||||||
|
" Operations.
|
||||||
|
" TODO: this list is not exhaustive.
|
||||||
|
syn keyword mlirOps alloc alloca addf addi and call call_indirect cmpf cmpi
|
||||||
|
syn keyword mlirOps constant dealloc divf dma_start dma_wait dim exp
|
||||||
|
syn keyword mlirOps getTensor index_cast load log memref_cast
|
||||||
|
syn keyword mlirOps memref_shape_cast mulf muli negf powf prefetch rsqrt sitofp
|
||||||
|
syn keyword mlirOps splat store select sqrt subf subi subview tanh
|
||||||
|
syn keyword mlirOps view
|
||||||
|
|
||||||
|
" Math ops.
|
||||||
|
syn match mlirOps /\<math\.erf\>/
|
||||||
|
|
||||||
|
" Affine ops.
|
||||||
|
syn match mlirOps /\<affine\.apply\>/
|
||||||
|
syn match mlirOps /\<affine\.dma_start\>/
|
||||||
|
syn match mlirOps /\<affine\.dma_wait\>/
|
||||||
|
syn match mlirOps /\<affine\.for\>/
|
||||||
|
syn match mlirOps /\<affine\.if\>/
|
||||||
|
syn match mlirOps /\<affine\.load\>/
|
||||||
|
syn match mlirOps /\<affine\.parallel\>/
|
||||||
|
syn match mlirOps /\<affine\.prefetch\>/
|
||||||
|
syn match mlirOps /\<affine\.store\>/
|
||||||
|
syn match mlirOps /\<scf\.execute_region\>/
|
||||||
|
syn match mlirOps /\<scf\.for\>/
|
||||||
|
syn match mlirOps /\<scf\.if\>/
|
||||||
|
syn match mlirOps /\<scf\.yield\>/
|
||||||
|
|
||||||
|
" TODO: dialect name prefixed ops (llvm or std).
|
||||||
|
|
||||||
|
" Keywords.
|
||||||
|
syn keyword mlirKeyword
|
||||||
|
\ affine_map
|
||||||
|
\ affine_set
|
||||||
|
\ dense
|
||||||
|
\ else
|
||||||
|
\ func
|
||||||
|
\ module
|
||||||
|
\ return
|
||||||
|
\ step
|
||||||
|
\ to
|
||||||
|
|
||||||
|
" Misc syntax.
|
||||||
|
|
||||||
|
syn match mlirNumber /-\?\<\d\+\>/
|
||||||
|
" Match numbers even in shaped types.
|
||||||
|
syn match mlirNumber /-\?\<\d\+\ze\s*x/
|
||||||
|
syn match mlirNumber /x\s*\zs-\?\d\+\ze\s*x/
|
||||||
|
|
||||||
|
syn match mlirFloat /-\?\<\d\+\.\d*\(e[+-]\d\+\)\?\>/
|
||||||
|
syn match mlirFloat /\<0x\x\+\>/
|
||||||
|
syn keyword mlirBoolean true false
|
||||||
|
" Spell checking is enabled only in comments by default.
|
||||||
|
syn match mlirComment /\/\/.*$/ contains=@Spell
|
||||||
|
syn region mlirString start=/"/ skip=/\\"/ end=/"/
|
||||||
|
syn match mlirLabel /[-a-zA-Z$._][-a-zA-Z$._0-9]*:/
|
||||||
|
" Prefixed identifiers usually used for ssa values and symbols.
|
||||||
|
syn match mlirIdentifier /[%@][a-zA-Z$._-][a-zA-Z0-9$._-]*/
|
||||||
|
syn match mlirIdentifier /[%@]\d\+\>/
|
||||||
|
" Prefixed identifiers usually used for blocks.
|
||||||
|
syn match mlirBlockIdentifier /\^[a-zA-Z$._-][a-zA-Z0-9$._-]*/
|
||||||
|
syn match mlirBlockIdentifier /\^\d\+\>/
|
||||||
|
" Prefixed identifiers usually used for types.
|
||||||
|
syn match mlirTypeIdentifier /![a-zA-Z$._-][a-zA-Z0-9$._-]*/
|
||||||
|
syn match mlirTypeIdentifier /!\d\+\>/
|
||||||
|
" Prefixed identifiers usually used for attribute aliases and result numbers.
|
||||||
|
syn match mlirAttrIdentifier /#[a-zA-Z$._-][a-zA-Z0-9$._-]*/
|
||||||
|
syn match mlirAttrIdentifier /#\d\+\>/
|
||||||
|
|
||||||
|
" Syntax-highlight lit test commands and bug numbers.
|
||||||
|
syn match mlirSpecialComment /\/\/\s*RUN:.*$/
|
||||||
|
syn match mlirSpecialComment /\/\/\s*CHECK:.*$/
|
||||||
|
syn match mlirSpecialComment "\v\/\/\s*CHECK-(NEXT|NOT|DAG|SAME|LABEL):.*$"
|
||||||
|
syn match mlirSpecialComment /\/\/\s*expected-error.*$/
|
||||||
|
syn match mlirSpecialComment /\/\/\s*expected-remark.*$/
|
||||||
|
syn match mlirSpecialComment /;\s*XFAIL:.*$/
|
||||||
|
syn match mlirSpecialComment /\/\/\s*PR\d*\s*$/
|
||||||
|
syn match mlirSpecialComment /\/\/\s*REQUIRES:.*$/
|
||||||
|
|
||||||
|
if version >= 508 || !exists("did_c_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_c_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
HiLink mlirType Type
|
||||||
|
HiLink mlirOps Statement
|
||||||
|
HiLink mlirNumber Number
|
||||||
|
HiLink mlirComment Comment
|
||||||
|
HiLink mlirString String
|
||||||
|
HiLink mlirLabel Label
|
||||||
|
HiLink mlirKeyword Keyword
|
||||||
|
HiLink mlirBoolean Boolean
|
||||||
|
HiLink mlirFloat Float
|
||||||
|
HiLink mlirConstant Constant
|
||||||
|
HiLink mlirSpecialComment SpecialComment
|
||||||
|
HiLink mlirIdentifier Identifier
|
||||||
|
HiLink mlirBlockIdentifier Label
|
||||||
|
HiLink mlirTypeIdentifier Type
|
||||||
|
HiLink mlirAttrIdentifier PreProc
|
||||||
|
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax = "mlir"
|
Loading…
Reference in a new issue