Skip to content

Commit

Permalink
bunch of updates
Browse files Browse the repository at this point in the history
Signed-off-by: Egor Kovetskiy <[email protected]>
  • Loading branch information
kovetskiy committed Oct 5, 2022
1 parent 420774a commit d0905e0
Show file tree
Hide file tree
Showing 16 changed files with 99 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .config/coc/extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
"coc-eslint": ">=1.5.8",
"coc-git": ">=2.5.1",
"coc-go": ">=1.3.0",
"coc-grammarly": ">=0.0.2",
"coc-java": ">=1.5.5",
"coc-java-lombok": ">=1.0.0",
"coc-json": ">=1.6.1",
"coc-pairs": ">=1.3.2",
"coc-prettier": ">=9.3.1",
"coc-pyright": ">=1.1.266",
"coc-python": ">=1.2.12",
"coc-sourcekit": ">=0.0.3",
Expand Down
1 change: 1 addition & 0 deletions .gitignore_global
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ tags
.ycm_extra_conf.pyc
.agignore
docs/tags
.idea
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
[submodule "git-diff-image"]
path = git-diff-image
url = https://github.com/ewanmellor/git-diff-image
[submodule "alacritty-themes/dracula"]
path = alacritty-themes/dracula
url = https://github.com/dracula/alacritty
1 change: 1 addition & 0 deletions .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,7 @@ git-commit-smart() {
git commit -s "${args[@]}"
}

alias grt='git reset'
alias gtc='go clean -testcache'
alias wu='wg-quick up'
alias wd='wg-quick down'
Expand Down
1 change: 1 addition & 0 deletions alacritty-themes/dracula
Submodule dracula added at 77aff0
2 changes: 2 additions & 0 deletions bin/autoxrandr
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ has() {
xrandr -q | grep "^$1 connected"
}

exclusive="$1"

profile=$(cat ~/.config/profile)
if [[ "$profile" == "desktop" ]]; then
CENTER=DP-0
Expand Down
3 changes: 3 additions & 0 deletions bin/brb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

exec discord-status idle "brb lunch" "🍕"
10 changes: 0 additions & 10 deletions bin/browser
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@ if [[ -e "${url}" ]]; then
url="$(readlink -f "${url}")"
fi

if [[ "$url" =~ "open.spotify.com" ]]; then
spotify_uri=$(grep -Po 'open.spotify.com/\K\w+/[^?]+' <<< "$url" | sed 's@/@:@')
exec dbus-send \
--type=method_call \
--dest=org.mpris.MediaPlayer2.spotify\
/org/mpris/MediaPlayer2 \
org.mpris.MediaPlayer2.Player.OpenUri \
string:"spotify:$spotify_uri"
fi

browser="chromium"

if [[ "$url" ]]; then
Expand Down
34 changes: 34 additions & 0 deletions bin/discord-status
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

token=$(cat ~/.config/discord.token)

:set-status() {
curl -X PATCH \
-H 'Content-Type: application/json' \
-H "authorization: $token" \
--data '{"status": "'$1'"}' \
https://discord.com/api/v9/users/@me/settings
}

:custom-status() {
local status=$1
local text=$2
local emoji=$3

curl -X PATCH \
-H 'Content-Type: application/json' \
-H "authorization: $token" \
--data '{"status": "'$status'", "custom_status": {"text": "'"$text"'", "emoji_name": "'"$emoji"'"}}' \
https://discord.com/api/v9/users/@me/settings
}

status="${1:-online}"
text="${2:-}"
emoji="${3:-}"

if [[ ! "$text" ]]; then
:set-status "${status}"
exit 0
fi

:custom-status "${status}" "${text}" "${emoji}"
15 changes: 15 additions & 0 deletions bin/k8s-labels
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/env python3
# vim: ft=python ts=4 sw=4 et ai

import sys
import re

header_index = -1
for line in sys.stdin:
chunks = re.split(r'\s+', line.strip())
chunks = filter(lambda x: x.count(',') > 2, chunks)
if len(list(chunks)) == 0:
print(line, end='')
continue

print(line, end='')
3 changes: 3 additions & 0 deletions bin/online
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

exec discord-status online Available "⌨️"
9 changes: 9 additions & 0 deletions bin/wg-peer-status
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

peer="${1}"

if sudo wg show all peers | grep -q "$peer"; then
echo "${peer}"
else
echo "${peer}"
fi
2 changes: 1 addition & 1 deletion bin/wg-status
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

peer=$(sudo wg show all peers | awk '{print $1}')
peer=$(sudo wg show all peers | awk '{print $1}' | paste -sd' ')
if [[ ! "$peer" ]]; then
echo ' insecure'
else
Expand Down
17 changes: 17 additions & 0 deletions bin/xdg-open
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

[ -n "$_LOCK" ] || _LOCK=x exec flock -n $0 $0 "$@"

url="$1"

if [[ "$url" =~ "open.spotify.com" ]]; then
spotify_uri=$(grep -Po 'open.spotify.com/\K\w+/[^?]+' <<< "$url" | sed 's@/@:@')
exec dbus-send \
--type=method_call \
--dest=org.mpris.MediaPlayer2.spotify\
/org/mpris/MediaPlayer2 \
org.mpris.MediaPlayer2.Player.OpenUri \
string:"spotify:$spotify_uri"
fi

/bin/xdg-open "$url"
6 changes: 6 additions & 0 deletions vim.d/01-plugins.vim
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Plug 'scrooloose/nerdcommenter'
Plug 'kovetskiy/vim-hacks'
Plug 'kovetskiy/synta'
Plug 'fatih/vim-go', {'for': ['template']}
"let g:go_def_mapping_enabled = 0
Plug 'vim-scripts/l9'
Plug 'sirver/ultisnips', { 'frozen': 1 }
Plug 'tpope/vim-surround'
Expand Down Expand Up @@ -130,6 +131,8 @@ Plug 'HerringtonDarkholme/yats.vim'
Plug 'MaxMEllon/vim-jsx-pretty'

Plug 'github/copilot.vim'
imap <silent><script><expr> <C-Q> copilot#Accept("\<CR>")
let g:copilot_no_tab_map = v:true

Plug 'mogelbrod/vim-jsonpath'
noremap <buffer> <silent> <C-J><C-D> :call jsonpath#echo()<CR>
Expand All @@ -139,4 +142,7 @@ Plug 'ziglang/zig.vim'
Plug 'mfussenegger/nvim-dap'
Plug 'sonph/onehalf', { 'rtp': 'vim' }

Plug 'sebdah/vim-delve'


call plug#end()
8 changes: 1 addition & 7 deletions vim.d/11-fzf.vim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let g:fzf_prefer_tmux = 1
let g:fzf_layout = { 'down': '~40%' }
let g:fzf_layout = { 'down': '~50%' }

func! _select_file(...)
let dir = ""
Expand Down Expand Up @@ -88,9 +88,3 @@ endfunc!
func! _grep_recover()
call _grep(g:grep_last_query, '')
endfunc!

"func! _lstags()
" call fzf#vim#ag("", {'source': 'lstags', 'options': '--delimiter : --nth 4..'})
"endfunc!
"
"nnoremap <silent> <c-g> :call _lstags()<CR>

0 comments on commit d0905e0

Please sign in to comment.