There are a few options for setting up a macro to compress your notes before git push
'ing.
- 7Zip and the 7Zip CLI (It's not installed by default for windows) for your operating system.
- Use a system I designed called ahd (requires Python 3.6+) see [here] for setup
- Add a bash or powershell script to your path see here for setup
- Run
7za a -t7z Handouts.7z Handouts\* && 7za a -t7z Readings.7z Readings\* && 7za a -t7z Assignments.7z Assignments\*
in each course beforegit push
'ing.
Remember you will need python 3.6+ installed for this. Download here: https://www.python.org/downloads/
- Install ahd on windows using
pip install ahd
or on linux/Macsudo pip3 install ahd
- Run
ahd register compress-folder "7za a -t7z Handouts.7z Handouts\* && 7za a -t7z Readings.7z Readings\* && 7za a -t7z Assignments.7z Assignments\*" "."
or on linux addsudo
to the beginning of the command - Go to a course folder and type
ahd register compress-folder
This will setup a script called compress-folder
that can be run by just going into a course folder and running compress-folder
.
If you don't care about knowing how to do this, then the below steps can be done in one line. Just run: echo "7za a -t7z Handouts.7z Handouts\* && 7za a -t7z Readings.7z Readings\* && 7za a -t7z Assignments.7z Assignments\*" > ~/compress-folder.sh && sudo chmod 777 ~/compress-folder.sh && printf '\n\nalias compress-folder:"~/compress-folder.sh"' >> ~/.bashrc && source ~/.bashrc
- Create a file called
compress-folder.sh
: run commandecho "7za a -t7z Handouts.7z Handouts\* && 7za a -t7z Readings.7z Readings\* && 7za a -t7z Assignments.7z Assignments\*" > ~/compress-folder.sh
chmod
the file to make it runable:sudo chmod 777 ~/compress-folder.sh
- Add the file to your bashrc file so it can be run anywhere:
printf '\n\nalias compress-folder:"~/compress-folder.sh"' >> ~/.bashrc && source ~/.bashrc
- Create a file called
compress.bat
in your primary hard drive, typicallyC:
in a folder. So for exampleC:\compress\compress.bat
- Fill the
compress.bat
file with:7za a -t7z Handouts.7z Handouts\* && 7za a -t7z Readings.7z Readings\* && 7za a -t7z Assignments.7z Assignments\*
- Add
C:\compress
to your PATH. A guide to do this can be found here: https://stackoverflow.com/questions/44272416/how-to-add-a-folder-to-path-environment-variable-in-windows-10-with-screensho
Before git push
ing go to each course and run 7za a -t7z Handouts.7z Handouts\* && 7za a -t7z Readings.7z Readings\* && 7za a -t7z Assignments.7z Assignments\*