mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
Compare commits
2 commits
34074f1013
...
ea46555488
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea46555488 | ||
|
|
aab6ad2098 |
4 changed files with 22 additions and 42 deletions
|
|
@ -160,11 +160,6 @@
|
||||||
hi! link SneakScope Visual
|
hi! link SneakScope Visual
|
||||||
hi! link SneakLabel Sneak
|
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 {{{
|
" AWK {{{
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import colorama
|
||||||
import time
|
import time
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
|
import typing
|
||||||
|
|
||||||
|
|
||||||
DISCORD_EPOCH = 1420070400000 # milliseconds
|
DISCORD_EPOCH = 1420070400000 # milliseconds
|
||||||
|
|
@ -37,7 +38,6 @@ parser.add_argument("user_snowflake", type=int)
|
||||||
parser.add_argument("--bot-token", type=str)
|
parser.add_argument("--bot-token", type=str)
|
||||||
parser.add_argument("--image-size", type=int)
|
parser.add_argument("--image-size", type=int)
|
||||||
parser.add_argument("--get-prop", type=str)
|
parser.add_argument("--get-prop", type=str)
|
||||||
parser.add_argument("--api-response", action='store_true')
|
|
||||||
cli_args = parser.parse_args()
|
cli_args = parser.parse_args()
|
||||||
|
|
||||||
user_snowflake = cli_args.user_snowflake
|
user_snowflake = cli_args.user_snowflake
|
||||||
|
|
@ -68,11 +68,6 @@ except urllib.error.HTTPError as err:
|
||||||
print(err.read(), file=sys.stderr)
|
print(err.read(), file=sys.stderr)
|
||||||
raise err
|
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 = {}
|
||||||
|
|
||||||
data["ID"] = raw_data["id"]
|
data["ID"] = raw_data["id"]
|
||||||
|
|
|
||||||
|
|
@ -109,25 +109,24 @@ sudoedit() {
|
||||||
alias sudoe="sudoedit"
|
alias sudoe="sudoedit"
|
||||||
alias sue="sudoedit"
|
alias sue="sudoedit"
|
||||||
|
|
||||||
# This idea was taken from <https://github.com/ohmyzsh/ohmyzsh/blob/706b2f3765d41bee2853b17724888d1a3f6f00d9/plugins/last-working-dir/last-working-dir.plugin.zsh>
|
# gpg-crypt {{{
|
||||||
SYNC_WORKING_DIR_STORAGE="${ZSH_CACHE_DIR}/last-working-dir"
|
# Encrypt the given file or directory to a given recipient
|
||||||
|
function gpg-encrypt() {
|
||||||
autoload -Uz add-zsh-hook
|
if [ "$#" -ne 2 ]; then
|
||||||
add-zsh-hook chpwd sync_working_dir_chpwd_hook
|
echo "Usage: $0 FILE/DIRECTORY RECIPIENT" >&2
|
||||||
sync_working_dir_chpwd_hook() {
|
return 1
|
||||||
if [[ "$ZSH_SUBSHELL" == 0 ]]; then
|
|
||||||
sync_working_dir_save
|
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
sync_working_dir_save() {
|
tar -c `basename $1` | gpg --encrypt --recipient $2 -o `basename $1`.tar.gpg
|
||||||
pwd >| "$SYNC_WORKING_DIR_STORAGE"
|
}
|
||||||
}
|
|
||||||
|
|
||||||
sync_working_dir_load() {
|
# Decrypt the given tar.gpg file
|
||||||
local dir
|
function gpg-decrypt() {
|
||||||
if dir="$(<"$SYNC_WORKING_DIR_STORAGE")" 2>/dev/null && [[ -n "$dir" ]]; then
|
if [ "$#" -ne 1 ] || [[ "$1" != *.tar.gpg ]]; then
|
||||||
cd -- "$dir"
|
echo "Usage: $0 FILE.tar.gpg" >&2
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
alias cds="sync_working_dir_load"
|
gpg --quiet --decrypt $1 | tar -x
|
||||||
|
}
|
||||||
|
# }}}
|
||||||
|
|
|
||||||
15
zsh/zshrc
15
zsh/zshrc
|
|
@ -23,17 +23,14 @@ autoload -U colors && colors
|
||||||
}
|
}
|
||||||
|
|
||||||
_perf_timer_stop() {
|
_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"
|
local name="$1"
|
||||||
if [[ -z "$name" ]]; then
|
if [[ -z "$name" ]]; then
|
||||||
print >&2 "$0: usage: $0 <name>"
|
print >&2 "$0: usage: $0 <name>"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
local start_time="${_perf_timers[$name]}"
|
local stop_time="$EPOCHREALTIME" start_time="${_perf_timers[$name]}"
|
||||||
unset "_perf_timers[${(qq)name}]"
|
|
||||||
local -i duration="$(( (stop_time - start_time) * 1000 ))"
|
local -i duration="$(( (stop_time - start_time) * 1000 ))"
|
||||||
print -r -- "$(print -P '%F{8}==>%f') ${name}: ${duration}ms"
|
print -- "$(print -P '%F{8}==>%f') ${name}: ${duration}ms"
|
||||||
}
|
}
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
@ -69,10 +66,4 @@ fi
|
||||||
|
|
||||||
_perf_timer_stop "total"
|
_perf_timer_stop "total"
|
||||||
|
|
||||||
if [[ -z "$DOTFILES_DISABLE_WELCOME" ]]; then
|
welcome
|
||||||
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