Autosave: 2023-02-21 07:39:26
This commit is contained in:
parent
50f9cef354
commit
2bbd42f5de
3 changed files with 17 additions and 17 deletions
|
@ -4,22 +4,22 @@
|
|||
|
||||
# It is aliased to `cs-update` in .zshrc
|
||||
|
||||
NOTES_PATH="/home/thomas/repos/computer_science"
|
||||
SPACE_TO_UNDERSCORE="/home/thomas/repos/computer_science/_scripts/space_to_underscore_filename.sh"
|
||||
CLEAN_IMAGE_DIRECTORY="/home/thomas/repos/computer_science/_scripts/clean_image_directory.sh"
|
||||
notes_path="/home/thomas/repos/computer_science"
|
||||
space_to_underscore="/home/thomas/repos/computer_science/_scripts/space_to_underscore_filename.sh"
|
||||
clean_image_directory="/home/thomas/repos/computer_science/_scripts/clean_image_directory.sh"
|
||||
|
||||
cd "$NOTES_PATH"
|
||||
cd "$notes_path"
|
||||
|
||||
# Loop through directories and convert spaces in filenames to underscores
|
||||
source ${SPACE_TO_UNDERSCORE}
|
||||
source ${CLEAN_IMAGE_DIRECTORY}
|
||||
source ${space_to_underscore}
|
||||
source ${clean_image_directory}
|
||||
|
||||
git pull >/dev/null 2>&1
|
||||
|
||||
CHANGES_EXIST="$(git status --porcelain | wc -l)"
|
||||
changes_exist="$(git status --porcelain | wc -l)"
|
||||
|
||||
# If no changes, exit. Else commit and push with timestamp
|
||||
if [ "$CHANGES_EXIST" -eq 0 ]; then
|
||||
if [ "$changes_exist" -eq 0 ]; then
|
||||
echo "No changes"
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
# It is aliased to `cs-update` in .zshrc
|
||||
|
||||
NOTES_PATH="/Users/thomasbishop/prepos/computer_science"
|
||||
notes_path="/Users/thomasbishop/prepos/computer_science"
|
||||
# SPACE_TO_UNDERSCORE="/home/thomas/repos/computer_science/_scripts/space_to_underscore_filename.sh"
|
||||
# CLEAN_IMAGE_DIRECTORY="/home/thomas/repos/computer_science/_scripts/clean_image_directory.sh"
|
||||
|
||||
cd "$NOTES_PATH"
|
||||
cd "$notes_path"
|
||||
|
||||
# Loop through directories and convert spaces in filenames to underscores
|
||||
# source ${SPACE_TO_UNDERSCORE}
|
||||
|
@ -16,10 +16,10 @@ cd "$NOTES_PATH"
|
|||
|
||||
git pull >/dev/null 2>&1
|
||||
|
||||
CHANGES_EXIST="$(git status --porcelain | wc -l)"
|
||||
changes_exist="$(git status --porcelain | wc -l)"
|
||||
|
||||
# If no changes, exit. Else commit and push with timestamp
|
||||
if [ "$CHANGES_EXIST" -eq 0 ]; then
|
||||
if [ "$changes_exist" -eq 0 ]; then
|
||||
echo "No changes"
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
# It is aliased to cs-revise in .zshrc
|
||||
|
||||
# Choose source directories...
|
||||
DIRS_TO_PARSE="../Computer_Architecture ../Databases ../Electronics_and_Hardware ../Operating_Systems ../Programming_Languages/Shell ../Logic"
|
||||
directories_to_parse="../Computer_Architecture ../Databases ../Electronics_and_Hardware ../Operating_Systems ../Programming_Languages/Shell ../Logic"
|
||||
|
||||
# Return array of all files belonging to source dirs...
|
||||
for ele in $DIRS_TO_PARSE; do
|
||||
FILE_MATCHES+=( $(find $ele -name "*.md" -type f) )
|
||||
for ele in $directories_to_parse; do
|
||||
file_matches+=( $(find $ele -name "*.md" -type f) )
|
||||
done
|
||||
|
||||
# Generate a random integer between 0 and the match array length...
|
||||
RANDOM_FILE_INDEX=$(( $RANDOM % ${#FILE_MATCHES[@]} + 0 ))
|
||||
random_file_index=$(( $RANDOM % ${#file_matches[@]} + 0 ))
|
||||
|
||||
# Return file matching that index...
|
||||
echo "Revise this topic: ${FILE_MATCHES[$RANDOM_FILE_INDEX]}"
|
||||
echo "Revise this topic: ${file_matches[$random_file_index]}"
|
||||
|
|
Loading…
Add table
Reference in a new issue