mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[Chore] Fix merge conflict.
This commit is contained in:
commit
d9d4e046b7
7 changed files with 46 additions and 26 deletions
|
@ -160,6 +160,11 @@
|
|||
hi! link SneakScope Visual
|
||||
hi! link SneakLabel Sneak
|
||||
|
||||
" checkhealth UI
|
||||
call s:hi('healthSuccess', 'bg', 0xB, 'bold', '')
|
||||
call s:hi('healthWarning', 'bg', 0xA, 'bold', '')
|
||||
call s:hi('healthError', 'bg', 0x8, 'bold', '')
|
||||
|
||||
" }}}
|
||||
|
||||
" AWK {{{
|
||||
|
|
|
@ -19,7 +19,7 @@ def run_chooser(choices: Iterable[str], prompt: str = None, async_read: bool = F
|
|||
process_args = [
|
||||
"fzf",
|
||||
"--with-nth=2..",
|
||||
"--height=50%",
|
||||
"--height=40%",
|
||||
"--reverse",
|
||||
"--tiebreak=index",
|
||||
]
|
||||
|
|
|
@ -12,7 +12,6 @@ import colorama
|
|||
import time
|
||||
import argparse
|
||||
import json
|
||||
import typing
|
||||
|
||||
|
||||
DISCORD_EPOCH = 1420070400000 # milliseconds
|
||||
|
@ -38,6 +37,7 @@ parser.add_argument("user_snowflake", type=int)
|
|||
parser.add_argument("--bot-token", type=str)
|
||||
parser.add_argument("--image-size", type=int)
|
||||
parser.add_argument("--get-prop", type=str)
|
||||
parser.add_argument("--api-response", action='store_true')
|
||||
cli_args = parser.parse_args()
|
||||
|
||||
user_snowflake = cli_args.user_snowflake
|
||||
|
@ -68,6 +68,11 @@ except urllib.error.HTTPError as err:
|
|||
print(err.read(), file=sys.stderr)
|
||||
raise err
|
||||
|
||||
if cli_args.api_response:
|
||||
json.dump(raw_data, sys.stdout, ensure_ascii=False, indent=2)
|
||||
sys.stdout.write('\n')
|
||||
sys.exit()
|
||||
|
||||
data = {}
|
||||
|
||||
data["ID"] = raw_data["id"]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
# https://superuser.com/a/207474
|
||||
apropos . | fzf --no-multi --tiebreak=begin --query="$*" | sed -n 's/^\([^ ]\+\) \?(\([^)]\+\)).*$/\2 \1/p'
|
||||
apropos . | fzf --height=40% --reverse --no-multi --tiebreak=begin --query="$*" | sed -n 's/^\([^ ]\+\) \?(\([^)]\+\)).*$/\2 \1/p'
|
||||
|
|
|
@ -33,4 +33,4 @@ unset jq_colors
|
|||
export HOMEBREW_NO_AUTO_UPDATE=1
|
||||
|
||||
# https://github.com/junegunn/fzf/blob/764316a53d0eb60b315f0bbcd513de58ed57a876/src/tui/tui.go#L496-L515
|
||||
export FZF_DEFAULT_OPTS="--color=16"
|
||||
export FZF_DEFAULT_OPTS="--color=16 --height=40% --reverse"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
count() { print -r -- "$#"; }
|
||||
|
||||
bytecount() { wc -c "$@" | bytefmt2; }
|
||||
bytecount() { wc -c "$@" | numfmt --to=iec-i --suffix=B; }
|
||||
|
||||
mkcd() { mkdir -p "$@" && cd "${@[-1]}"; }
|
||||
|
||||
|
@ -109,24 +109,25 @@ sudoedit() {
|
|||
alias sudoe="sudoedit"
|
||||
alias sue="sudoedit"
|
||||
|
||||
# gpg-crypt {{{
|
||||
# Encrypt the given file or directory to a given recipient
|
||||
function gpg-encrypt() {
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo "Usage: $0 FILE/DIRECTORY RECIPIENT" >&2
|
||||
return 1
|
||||
fi
|
||||
# This idea was taken from <https://github.com/ohmyzsh/ohmyzsh/blob/706b2f3765d41bee2853b17724888d1a3f6f00d9/plugins/last-working-dir/last-working-dir.plugin.zsh>
|
||||
SYNC_WORKING_DIR_STORAGE="${ZSH_CACHE_DIR}/last-working-dir"
|
||||
|
||||
tar -c `basename $1` | gpg --encrypt --recipient $2 -o `basename $1`.tar.gpg
|
||||
}
|
||||
autoload -Uz add-zsh-hook
|
||||
add-zsh-hook chpwd sync_working_dir_chpwd_hook
|
||||
sync_working_dir_chpwd_hook() {
|
||||
if [[ "$ZSH_SUBSHELL" == 0 ]]; then
|
||||
sync_working_dir_save
|
||||
fi
|
||||
}
|
||||
|
||||
# Decrypt the given tar.gpg file
|
||||
function gpg-decrypt() {
|
||||
if [ "$#" -ne 1 ] || [[ "$1" != *.tar.gpg ]]; then
|
||||
echo "Usage: $0 FILE.tar.gpg" >&2
|
||||
return 1
|
||||
fi
|
||||
sync_working_dir_save() {
|
||||
pwd >| "$SYNC_WORKING_DIR_STORAGE"
|
||||
}
|
||||
|
||||
gpg --quiet --decrypt $1 | tar -x
|
||||
}
|
||||
# }}}
|
||||
sync_working_dir_load() {
|
||||
local dir
|
||||
if dir="$(<"$SYNC_WORKING_DIR_STORAGE")" 2>/dev/null && [[ -n "$dir" ]]; then
|
||||
cd -- "$dir"
|
||||
fi
|
||||
}
|
||||
alias cds="sync_working_dir_load"
|
||||
|
|
15
zsh/zshrc
15
zsh/zshrc
|
@ -23,14 +23,17 @@ autoload -U colors && colors
|
|||
}
|
||||
|
||||
_perf_timer_stop() {
|
||||
# Record the stop time as precisely as possible even in the case of an error
|
||||
local stop_time="$EPOCHREALTIME"
|
||||
local name="$1"
|
||||
if [[ -z "$name" ]]; then
|
||||
print >&2 "$0: usage: $0 <name>"
|
||||
return 1
|
||||
fi
|
||||
local stop_time="$EPOCHREALTIME" start_time="${_perf_timers[$name]}"
|
||||
local start_time="${_perf_timers[$name]}"
|
||||
unset "_perf_timers[${(qq)name}]"
|
||||
local -i duration="$(( (stop_time - start_time) * 1000 ))"
|
||||
print -- "$(print -P '%F{8}==>%f') ${name}: ${duration}ms"
|
||||
print -r -- "$(print -P '%F{8}==>%f') ${name}: ${duration}ms"
|
||||
}
|
||||
|
||||
# }}}
|
||||
|
@ -66,4 +69,10 @@ fi
|
|||
|
||||
_perf_timer_stop "total"
|
||||
|
||||
welcome
|
||||
if [[ -z "$DOTFILES_DISABLE_WELCOME" ]]; then
|
||||
welcome
|
||||
fi
|
||||
|
||||
if [[ -z "$DOTFILES_SYNC_LAST_WORKING_DIR" ]]; then
|
||||
sync_working_dir_load
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue