This commit is contained in:
2019-02-10 03:15:14 -05:00
parent 64311dfb06
commit 07677923c4
18 changed files with 216 additions and 60 deletions

View File

@@ -1,5 +1,5 @@
# copy this into ~/.config/fish/completions/ to enable autocomplete for the watson time tracker
#
function __fish_watson_needs_sub -d "provides a list of sub commands"
set cmd (commandline -opc)
if [ (count $cmd) -eq 1 -a $cmd[1] = 'watson' ]
@@ -19,12 +19,61 @@ function __fish_watson_using_command -d "determine if watson is using the passed
return 1
end
function __fish_watson_set_cache_vars -d "set vars used for caches"
if test -n "$WATSON_DIR"
set -g _watson_dir $WATSON_DIR
else
# TODO: set dir for Darwin (not sure how to do regex in fish) #
set -g _watson_dir "$HOME/.config/watson"
end
set -g _watson_frame_file "$_watson_dir/frames"
set -g _watson_projects_cache "$_watson_dir/projects_cache"
set -g _watson_tags_cache "$_watson_dir/tags_cache"
set -g _watson_frames_cache "$_watson_dir/frames_cache"
end
function __get_date_num -d "return last modified time of file"
date -r $argv[1] +%s
end
function __fish_watson_check_if_refresh_cache -d "see if cache file needs refreshing"
if begin not test -e $argv[1];
or test (__get_date_num $_watson_frame_file) \
-gt (__get_date_num $argv[1]); end
return 1
else
return 0
end
end
function __fish_watson_get_projects -d "return a list of projects"
command watson projects
__fish_watson_set_cache_vars
__fish_watson_check_if_refresh_cache $_watson_projects_cache
if test $status -eq 1
command watson projects | tee $_watson_projects_cache
else
cat $_watson_projects_cache
end
end
function __fish_watson_get_tags -d "return a list of tags"
command watson tags
__fish_watson_set_cache_vars
__fish_watson_check_if_refresh_cache $_watson_tags_cache
if test $status -eq 1
command watson tags | tee $_watson_tags_cache
else
cat $_watson_tags_cache
end
end
function __fish_watson_get_frames -d "return a list of frames" #TODO, use watson logs to get more info
__fish_watson_set_cache_vars
__fish_watson_check_if_refresh_cache $_watson_frames_cache
if test $status -eq 1
command watson frames | tee $_watson_frames_cache
else
cat $_watson_frames_cache
end
end
function __fish_watson_has_project -d "determine if watson is using a passed command and if it has a project"
@@ -51,10 +100,6 @@ function __fish_watson_has_from -d "determine if watson is using a passed comman
return 1
end
function __fish_watson_get_frames -d "return a list of frames" #TODO, use watson logs to get more info
command watson frames
end
function __fish_watson_needs_project -d "check if we need a project"
set cmd (commandline -opc)
if [ (count $cmd) -ge 2 -a $cmd[1] = 'watson' ]

View File

@@ -10,12 +10,12 @@ set -x GPG_TTY (tty)
# }}} login to X #
# input
xset r rate 200 70
fish_vi_key_bindings
set -x EDITOR nvim
set -x VISUAL nvim
builtin cd $last_dir
bind \ce edit_command_buffer
# fish-specific
source /home/kevin/.config/fish/key_abbr.fish
@@ -25,6 +25,7 @@ abbr f.. "cd ../.."
# spv
set -U spv_dir "/home/kevin/coding/spotify-lib-vis"
set -U mfs_dir "/home/kevin/coding/mf-site"
source $spv_dir/src/api-keys.sh
# set -U PATH /usr/local/sbin /usr/local/bin /usr/bin /usr/bin/site_perl /usr/bin/vendor_perl /usr/bin/core_perl /home/kevin/linux-config/scripts
@@ -35,9 +36,22 @@ set -x PASSWORD_STORE_CLIP_TIME 120
# fxn abbr's
abbr ag "grep-aliases"
abbr ev "evince-silent"
# git {{{ #
abbr gcamp "git-amend-push"
abbr gdf "git-diff-files"
abbr gpsmt "git-push-multiple"
abbr grmb "git-delete-branch"
# }}} git #
abbr hs "scan-history"
abbr ut "unix-timestamp"
abbr z "zathura-silent"
set -U BROWSER "chromium"
abbr hm "cd $mfs_dir && hugo serve -D --disableFastRender"
abbr ga2 "gdb-a2"
abbr grc "grep-c"
abbr grh "grep-headers"
abbr cs "carsim"

View File

@@ -0,0 +1,5 @@
function carsim
printf '\033c'
# and ./carsim stop $argv[1] $argv[2]
and ./carsim light $argv[1] $argv[2]
end

View File

@@ -0,0 +1,10 @@
function gdb-a2
gdb -ex "b safeStopSign.c:40" -ex "b safeStopSign.c:44" -ex "run" \
# gdb -ex "run" \
# -ex "p cur_lane_queue.count" \
# -ex "p cur_front->car->index" \
# -ex "p cur_front->car" \
--args ./carsim stop 1 4
# --args ./carsim light 1 4
# gdb -ex "b safeStopSign.c:86" -ex "run" --args ./carsim stop 1 10
end

View File

@@ -0,0 +1,4 @@
function git-delete-branch
git push origin --delete $argv[1]
and git branch -D $argv[1]
end

View File

@@ -0,0 +1,3 @@
function grep-c
grep -nr --include \*.c $argv[1] ./
end

View File

@@ -0,0 +1,3 @@
function grep-headers
grep --color=auto -nr --include \*.h $argv[1] ./
end

View File

@@ -1,5 +1,6 @@
function scan-history
sudo systemctl start postgresql.service
and systemctl status postgresql.service
and $spv_dir/src/update-history.sh
and cat $spv_dir/src/api/management/commands/update-history.log | tail -n 1
end