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
/* | |
Created by CR11CS | |
https://github.com/CR11CS | |
Generates an SSH keypair and stores SSH key to local folder, then outputs your server public IP for quick reference. | |
Linux Compatible version (using BASH) | |
*/ | |
############################ Generic Terraform AWS EC2 Config | |
terraform { |
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
/* | |
Created by CR11CS | |
https://github.com/CR11CS | |
Generates an SSH keypair and stores SSH key to local folder, then outputs your server public IP for quick reference. | |
Windows Compatible version (using PowerShell) | |
*/ | |
############################ Generic Terraform AWS EC2 Config | |
terraform { |
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
# Jankily configures environment variables at global scope for Windows or Linux but doesn't inherit to child process without extra steps | |
def set_environment_variables(access_key, secret_key): | |
"""Sets the required environment variables for Terraform to make API calls to AWS.""" | |
if os.name == "posix": | |
with open(os.path.expanduser("~/.bashrc"), "a") as linux_environment_variables: | |
linux_environment_variables.write(f"export AWS_ACCESS_KEY_ID={access_key}") | |
linux_environment_variables.write(f"export AWS_SECRET_ACCESS_KEY={secret_key}") | |
if os.name == "nt": | |
windows_environment_variables = f'''Windows Registry Editor Version 5.00\n[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]\n"AWS_ACCESS_KEY_ID"="{access_key}"\n"AWS_SECRET_ACCESS_KEY"="{secret_key}"''' |
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
from __future__ import print_function | |
import os.path | |
import base64 | |
from google.auth.transport.requests import Request | |
from google.oauth2.credentials import Credentials | |
from google_auth_oauthlib.flow import InstalledAppFlow | |
from googleapiclient.discovery import build | |
from googleapiclient.errors import HttpError |
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
sed -E 's/(\S)(\s*?)(\S)?/\U\1\2\L\3/g' |
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
import os | |
import shutil | |
def recreate_directory_structure(source_directory, target_directory): | |
for root, dirs, files in os.walk(source_directory): | |
for dir_name in dirs: | |
source_dir = os.path.join(root, dir_name) | |
target_dir = os.path.join(target_directory, os.path.relpath(source_dir, source_directory)) | |
os.makedirs(target_dir, exist_ok=True) | |
for file_name in files: |