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 characters
''' | |
1) Declare the path of the file (Absolute path or relative) | |
2) Open using 'with' statement | |
3) Create the base64 bytes then "translate" to ascii format, save it to encode_string var | |
4) Print the encoded string in base64 | |
''' | |
file_path = './somefile.pdf' | |
with open(file_path, 'rb') as file: | |
encoded_string = base64.b64encode(file.read()).decode('ascii') | |
print(f"File in Base64: {encoded_string}") |
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 characters
#!/bin/bash | |
# get current date | |
now = `date +"%Y-%m-%d"` | |
# copying WordPress files inside public_html folder | |
cd ~/public_html | |
tar -zcf "~/wordpress_$_now.tar.gz" wordpress_folder | |
# Database backup with mysqldump |