You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote a basic plugin for locally sharing notes; it's nothing fancy. It creates a temp file with the note content and then serves it through HTTP using netcat.
Code Here
#!/usr/bin/env bash################################################################################ share## A plugin for `nb` ## Author: rooyca (https://github.com/rooyca)###############################################################################
_subcommands add "share"
_subcommands describe "share"<<HEREDOCUsage: nb share <ID>Description: Share your notes locally.Examples: nb share 101HEREDOC# Define the port to listen on
PORT=8833
TEMP_FILE_NAME="/tmp/nb-share-temp.txt"_share() {
local _selector="${1:-}"
[[ -z"${_selector:-}" ]] &&printf"Usage: share <selector>\\n"&&exit 1
local content
content=$(_show "$_selector" --print | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g')# save content to a tmp fileecho"$content">$TEMP_FILE_NAME# Start a simple HTTP server to share the contentwhiletrue;do
{
echo -ne "HTTP/1.1 200 OK\r\n"echo -ne "Content-Type: text/plain\r\n\r\n"
cat $TEMP_FILE_NAME
} | nc -l -p "$PORT" -q 1
done
}
I was wondering if something like this could be implemented natively?
P.S. Thank you so much for this awesome tool.
The text was updated successfully, but these errors were encountered:
I wrote a basic plugin for locally sharing notes; it's nothing fancy. It creates a temp file with the note content and then serves it through HTTP using
netcat
.Code Here
I was wondering if something like this could be implemented natively?
P.S. Thank you so much for this awesome tool.
The text was updated successfully, but these errors were encountered: