Last active
March 5, 2023 21:06
-
-
Save brainfucksec/56acb77fba3b6001e5592bbf6350e0d3 to your computer and use it in GitHub Desktop.
Revisions
-
brainfucksec revised this gist
Apr 10, 2021 . 1 changed file with 25 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,29 +1,32 @@ #!/usr/bin/env bash ##################################################################### # note.sh # KISS Terminal note taker # Copyright (C) 2021 Brainfuck # # # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE # # This work is free. You can redistribute it and/or modify it under the # terms of the Do What The Fuck You Want To Public License, Version 2, # as published by Sam Hocevar. See http://www.wtfpl.net/ for more details. ##################################################################### # Program information readonly prog_name="note" readonly version="0.4" readonly signature="Copyright (C) 2021 Brainfuck" # Set program directory and files # # insert the directory where to save notes readonly note_dir="${HOME}/documents/notes" readonly todo="${note_dir}/todo.md" readonly quicknote="${note_dir}/quicknote.md" readonly commands="${note_dir}/commands.md" # Function for error handling, print an error message and exit with (1). @@ -37,8 +40,8 @@ die() { open_file() { local cwfile="$1" if [[ -f "${cwfile}" ]]; then "${EDITOR}" "${cwfile}" exit 0 else die @@ -49,16 +52,16 @@ open_file() { # help menù help_menu() { cat << EOF ${prog_name} ${version} KISS Terminal note taker ${signature} Usage: ${prog_name} <argument> Arguments: -h, help Show this help menù and exit -t, todo Edit/add todo -m, quicknote Edit/add note (quick note) -c, commands Edit/add commands EOF } @@ -67,8 +70,8 @@ EOF # Main function main() { if [[ "$#" == 0 ]]; then echo "${prog_name}: please insert an argument" echo "Try '${prog_name} help' for more information." exit 1 fi @@ -79,17 +82,17 @@ main() { exit 0 ;; -t | todo) open_file "${todo}" ;; -q | quicknote) open_file "${quicknote}" ;; -c | commands) open_file "${commands}" ;; -* | *) echo "${prog_name}: invalid argument!" echo "Try '${prog_name} help' for more information." exit 1 ;; esac -
brainfucksec revised this gist
Aug 5, 2020 . 1 changed file with 49 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ # note [KISS](https://en.wikipedia.org/wiki/KISS_principle) Terminal note taker. This script consists of only 4 components: * note.sh (The executable file) * todo.md (A TODO file) * quicknote.md (For the quick notes) * commands.md (Your list of commands/cheat sheets) ## Install Create the default directory and files: ```bash mkdir -p ~/documents/notes/ touch ~/documents/notes/todo.md touch ~/documents/notes/quicknote.md touch ~/documents/notes/commands.md ``` Copy executable in your 'bin' folder ($HOME/bin is preferable): ```bash cp notes.sh ~/bin/note chmod +x ~/bin/note ``` ## Usage ### Edit/add TODO ```bash note -t | todo ``` ### Edit/add quick note ```bash note -q | quicknote ``` ### Edit/add commands ```bash note -c | commands ``` _IN KISS WE TRUST_ -
brainfucksec revised this gist
Jun 17, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -58,7 +58,7 @@ Usage: $prog_name <argument> Arguments: -h, help Show this help menù and exit -t, todo Edit/add todo -q, quicknote Edit/add note (quick note) -c, commands Edit/add commands EOF } -
brainfucksec revised this gist
Nov 9, 2019 . 1 changed file with 28 additions and 43 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,65 +2,46 @@ ########################################################################## # note.sh # KISS Terminal note taker # Copyright (C) 2019 Brainfuck # # # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE # # This work is free. You can redistribute it and/or modify it under the # terms of the Do What The Fuck You Want To Public License, Version 2, # as published by Sam Hocevar. See http://www.wtfpl.net/ for more details. ########################################################################## # Program information readonly prog_name="note" readonly version="0.3" readonly signature="Copyright (C) 2019 Brainfuck" # Set program directory and files readonly note_dir="$HOME/documents/notes" readonly todo="$note_dir/todo.md" readonly quicknote="$note_dir/quicknote.md" readonly commands="$note_dir/commands.md" # Function for error handling, print an error message and exit with (1). die() { echo "Error: file not exists :(" >&2 exit 1 } # Edit/add (files will be opened with your $EDITOR) open_file() { local cwfile="$1" if [[ -f "$cwfile" ]]; then "$EDITOR" "$cwfile" exit 0 else die fi } @@ -70,13 +51,15 @@ help_menu() { cat << EOF $prog_name $version KISS Terminal note taker $signature Usage: $prog_name <argument> Arguments: -h, help Show this help menù and exit -t, todo Edit/add todo -m, quicknote Edit/add note (quick note) -c, commands Edit/add commands EOF } @@ -96,10 +79,13 @@ main() { exit 0 ;; -t | todo) open_file "$todo" ;; -q | quicknote) open_file "$quicknote" ;; -c | commands) open_file "$commands" ;; -* | *) echo "$prog_name: invalid argument!" @@ -110,5 +96,4 @@ main() { done } main "$@" -
brainfucksec revised this gist
May 2, 2019 . No changes.There are no files selected for viewing
-
brainfucksec revised this gist
May 1, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -111,4 +111,4 @@ main() { } main "$@" -
brainfucksec revised this gist
May 1, 2019 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,6 @@ # # Copyright (C) 2019 Brainfuck # # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE # # This work is free. You can redistribute it and/or modify it under the -
brainfucksec created this gist
May 1, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,115 @@ #!/usr/bin/env bash ########################################################################## # note.sh # # KISS Terminal note taker # # Copyright (C) 2019 Brainfuck # # # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE # # This work is free. You can redistribute it and/or modify it under the # terms of the Do What The Fuck You Want To Public License, Version 2, # as published by Sam Hocevar. See http://www.wtfpl.net/ for more details. # ########################################################################## # Program information readonly prog_name="note" readonly version="0.1" readonly signature="Copyright (C) 2019 Brainfuck" # Settings readonly note_dir="$HOME/documents/notes" readonly todofile="$note_dir/todo.md" readonly notefile="$note_dir/quicknote.txt" # Check if note directory exists checkdir() { if [[ ! -d $note_dir ]]; then echo "Error: note directory not exists :(" echo "Please read the instructions in the README file" exit 1 fi } # Edit/add todo (files will be opened with your $EDITOR) todo() { checkdir if [[ -f "$todofile" ]]; then "$EDITOR" "$todofile" exit 0 else echo "Error: todo file not exists :(" exit 1 fi } # Edit/add note quicknote() { checkdir if [[ -f "$notefile" ]]; then "$EDITOR" "$notefile" exit 0 else echo "Error: note file not exists :(" exit 1 fi } # help menù help_menu() { cat << EOF $prog_name $version KISS Terminal note taker Usage: $prog_name <argument> Arguments: -h, help Show this help menù and exit -t, todo Edit/add todo -m, mark Edit/add note (quick note) EOF } # Main function main() { if [[ "$#" == 0 ]]; then echo "$prog_name: please insert an argument" echo "Try '$prog_name help' for more information." exit 1 fi while [[ "$#" -gt 0 ]]; do case "$1" in -h | help) help_menu exit 0 ;; -t | todo) todo ;; -m | mark) quicknote ;; -* | *) echo "$prog_name: invalid argument!" echo "Try '$prog_name help' for more information." exit 1 ;; esac done } main "$@"