Several script adjustments

main
Nils Gerstner 1 year ago
parent 9d6c2b97df
commit 2fbbbbd40a

@ -176,3 +176,5 @@ test -d ansible-setup/dotfiles/bin/ && export PATH="/Users/nige/.cargo/bin:$PATH
# which brew && export GOROOT="$(brew --prefix golang)/libexec"
# export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin"
export OPENAI_API_KEY='---------------------------------------------------'
export DENO_INSTALL="/home/nige/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"

@ -19,21 +19,21 @@ function M.prune_search_db()
local json = require('json')
local hits = {}
-- local res, err = pcall(curl.get(server .. '/indexes/notes/documents?limit=99999999&fields=title,id', {
-- accept = "application/json",
-- }))
--
-- if err ~= nil and res.status ~= 404 then
-- local tab = json.parse(res.body)
-- if tab and tab['total'] > 0 then
-- for i, v in ipairs(tab['results']) do
-- if not file_exists(prefix .. v['title']) then
-- print('Delete ' .. v['title'] .. ' from search index')
-- curl.delete('http://localhost:7700/indexes/notes/documents/' .. v['id'], {})
-- end
-- end
-- end
-- end
local res, err = pcall(curl.get(server .. '/indexes/notes/documents?limit=99999999&fields=title,id', {
accept = "application/json",
}))
if er ~= nil and res.status ~= 404 then
local tab = json.parse(res.body)
if tab and tab['total'] > 0 then
for i, v in ipairs(tab['results']) do
if not file_exists(prefix .. v['title']) then
print('Delete ' .. v['title'] .. ' from search index')
curl.delete('http://localhost:7700/indexes/notes/documents/' .. v['id'], {})
end
end
end
end
end
return M

@ -4,7 +4,7 @@ vim.api.nvim_create_autocmd({ "BufWritePost" }, {
group = neorgAutoCmd,
callback = function()
if vim.bo.filetype == "norg" or vim.bo.filetype == "markdown" then
io.popen("updateNotes.sh &>/dev/null")
io.popen("updateNotes.sh 2>&1>/dev/null")
end
end,
desc = "Trigger meilisearch update via bash script",

@ -1,4 +0,0 @@
#!/bin/bash
exec "~/lua/lua-language-server/bin/lua-language-server" "$@"
~/lua/lua-language-server

@ -1,4 +1,4 @@
#!/opt/homebrew/bin/bash
#!/bin/bash
source_file="$1"; shift;
format="${2:-html5}"; shift;

@ -1,4 +1,4 @@
#!/opt/homebrew/bin/bash
#!/bin/bash
MEILISEARCH_URL=http://localhost:7700
INDEXNAME=notes

File diff suppressed because it is too large Load Diff

@ -1,4 +1,4 @@
#!/opt/homebrew/bin/bash
#!/bin/bash
getChanged() {
local file="$1"
@ -7,7 +7,8 @@ getChanged() {
getCreated() {
local d=$(basename $1 | grep -oe "^[0-9]\{12\}")
date -j -f "%Y-%m-%d %H:%M" "${d:0:4}-${d:4:2}-${d:6:2} ${d:8:2}:${d:10:2}" '+%s'
date -d "${d:0:4}-${d:4:2}-${d:6:2} ${d:8:2}:${d:10:2}" '+%s'
# date -j -f "%Y-%m-%d %H:%M" "${d:0:4}-${d:4:2}-${d:6:2} ${d:8:2}:${d:10:2}" '+%s'
#date -j -f "%Y-%m-%d" "$(getDocumentMetadataValue "$1" 'created')" "+%s"
}

@ -1,4 +1,4 @@
#!/opt/homebrew/bin/bash
#!/bin/bash
getDocumentMetadataHeader() {
local file="$1"
@ -14,7 +14,7 @@ getDocumentMetadataHeader() {
#Example header:
#
getDocumentMetadataHeader "$file" | ggrep -oP "(?<=${key}: ).*"
getDocumentMetadataHeader "$file" | grep -oP "(?<=${key}: ).*"
}
splitValuesByComma() {
@ -56,7 +56,8 @@ NorgGetDescription() {
NorgGetCreated() {
local file="$1"
#date --date="$(getDocumentMetadataValue "$1" 'created')" +"%s"
date -j -f "%Y-%m-%d" "$(getDocumentMetadataValue "$1" 'created')" "+%s"
# date -j -f "%Y-%m-%d" "$(getDocumentMetadataValue "$1" 'created')" "+%s"
date -d "$(getDocumentMetadataValue "$1" 'created')" "+%s"
}

@ -1,4 +1,4 @@
#!/opt/homebrew/bin/bash
#!/bin/bash
ROOT_FOLDER="$HOME/Documents"

@ -1,4 +1,4 @@
#!/opt/homebrew/bin/bash
#!/bin/bash
# Author: Nils Gerstner
# Last revision: 26st Januray 2019

@ -1,6 +0,0 @@
#!/bin/bash
test01="ett"
echo $test01
test01="två"
echo $test01

@ -1,7 +1,7 @@
#!/bin/bash
all=$1
notes=/Users/nige/notes/
marker=/Users/nige/lua/.marker
notes=/home/nige/notes/
marker=/home/nige/.local/.marker
[ -f $marker ] || touch $marker
@ -19,11 +19,11 @@ updateNote() {
if [[ "${i}" == *.norg ]]; then
echo
echo "Current filetype: NEORG"
/Users/nige/bin/norg-functions.sh "$i" $count > /tmp/update.json
/home/nige/bin/norg-functions.sh "$i" $count > /tmp/update.json
elif [[ "${i}" == *.md ]]; then
echo
echo "Current filetype: MARKDOWN"
/Users/nige/bin/md-functions.sh "$i" $count > /tmp/update.json
/home/nige/bin/md-functions.sh "$i" $count > /tmp/update.json
else
echo
echo "Unsupported filetype..."
@ -41,7 +41,7 @@ updateNote() {
update() {
echo "Start Update"
update=false
for i in $( [ "$all" == "all" ] && find ~/notes/ -type f || find ~/notes/ -type f -newer "$marker"); do
for i in $( [ "$all" == "all" ] && find /home/nige/notes/ -type f || find /home/nige/notes/ -type f -newer "$marker"); do
time updateNote $i
echo "-----------------------"
done

@ -1,4 +1,4 @@
#!/opt/homebrew/bin/bash
#!/bin/bash
#Example for bash split string without $IFS
xpath="$(echo "$2"| sed -e "s/\/\([^/]\+\)/\/*[local-name()='\1']/g" | sed -e "s/^\([^\/]\+\)/\/\/*[local-name() = '\1']/")"

Loading…
Cancel
Save