From e42c80e553a5c169d84ca1fbcc407aeb214150de Mon Sep 17 00:00:00 2001 From: Jim Richter Date: Tue, 15 Jun 2021 14:03:42 +0200 Subject: [PATCH] feat: add sum function --- configs/init.vim | 7 +++++++ configs/zsh/functions.zsh | 3 ++- configs/zsh/functions/sum.zsh | 22 ++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 configs/zsh/functions/sum.zsh diff --git a/configs/init.vim b/configs/init.vim index 701d309..d83f3bd 100644 --- a/configs/init.vim +++ b/configs/init.vim @@ -26,6 +26,9 @@ Plug 'evanleck/vim-svelte', {'branch': 'main'} Plug 'mattn/emmet-vim' Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' } +" Display IMages in Vim +Plug 'ashisha/image.vim' + " Svelte support Plug 'leafOfTree/vim-svelte-plugin' @@ -73,6 +76,10 @@ nmap j nmap k nmap l +nnoremap H gT +nnoremap L gt + + autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft() " Close all open buffers on entering a window if the only diff --git a/configs/zsh/functions.zsh b/configs/zsh/functions.zsh index c701202..29c218e 100644 --- a/configs/zsh/functions.zsh +++ b/configs/zsh/functions.zsh @@ -4,5 +4,6 @@ source $(dirname "$0")/functions/start.zsh; source $(dirname "$0")/functions/wp.zsh; source $(dirname "$0")/functions/y.zsh; source $(dirname "$0")/functions/fp.zsh; +source $(dirname "$0")/functions/rn.zsh; +source $(dirname "$0")/functions/sum.zsh; source $(dirname "$0")/functions/mke.zsh; -source $(dirname "$0")/functions/rn.zsh; \ No newline at end of file diff --git a/configs/zsh/functions/sum.zsh b/configs/zsh/functions/sum.zsh new file mode 100644 index 0000000..87390bf --- /dev/null +++ b/configs/zsh/functions/sum.zsh @@ -0,0 +1,22 @@ +function sum(){ + + URL=$1 + + #echo "URL: $URL"; + + TEXT=$(lynx -notitle -nonumbers -trim_input_fields -nobrowse -hiddenlinks=ignore --dump $URL | xargs | sed -e 's!http\(s\)\{0,1\}://[^[:space:]]*!!g' | sed -e 's/\[[^][]*\]//g') + DEEP_API_KEY="a2de657c-75d0-4a7c-acdf-3b886f860282" + + #echo "--------------------"; + #echo $TEXT + #echo "--------------------"; + + RESULT_JSON=$(curl --silent -F "text=$TEXT" -H "api-key:$DEEP_API_KEY" https://api.deepai.org/api/summarization ) + + #echo "JSON: $RESULT_JSON" + + RESULT=$(echo $RESULT_JSON | tr '\r\n' ' ' | jq ".output") + + echo $RESULT + +}