<jupyter_start><jupyter_text>setup notebookThese commands will configure the current noteboook to be able to commit to the host repo<jupyter_code>import os
import json
from osbot_aws.apis.Secrets import Secrets
from pbx_gs_python_utils.utils.Files import Files
repo_name  = os.environ['repo_name']
key_name   = 'git__{0}'.format(repo_name)
ssh_folder = '/root/.ssh'
data = Secrets(key_name).value_from_json_string()
Files.folder_create(ssh_folder)
Files.write(ssh_folder + '/id_rsa'    , data.get('private_key'))
Files.write(ssh_folder + '/id_rsa.pub', data.get('public_key' ))
!chmod 600 /root/.ssh/id_rsa
# change remote
!git remote set-url origin <EMAIL>:OpenSecuritySummit/$repo_name.git
!git remote -v
#setup user
!echo "github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" >> /root/.ssh/known_hosts
!git config --global user.email "<EMAIL>"
!git config --global user.name "$user"
# pulling latest changes (and double check that setup worked)
!git pull origin master
!git checkout master<jupyter_output>From github.com:OpenSecuritySummit/jp-tests
 * branch            master     -> FETCH_HEAD
Already up to date.
Already on 'master'<jupyter_text>---- --- Create secretthis commands only needs to be executed once per repo<jupyter_code># !mkdir /root/.ssh
# !rm /root/.ssh/id_rsa
# !rm /root/.ssh/id_rsa.pub
# !ssh-keygen -f /root/.ssh/id_rsa -t rsa -N ''

# !echo "github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" >> /root/.ssh/known_hosts

# import os
# import json
# from osbot_aws.apis.Secrets import Secrets
# from pbx_gs_python_utils.utils.Files import Files

# ssh_folder  = '/root/.ssh'
# repo_name   = os.environ['repo_name']
# secret_key  = "git__{0}".format(repo_name) 
# repo_path   = "<EMAIL>:pbx-gs/{0}.git".format(repo_name)
# public_key  = Files.contents(ssh_folder + '/id_rsa.pub'   )
# private_key = Files.contents(ssh_folder + '/id_rsa'   )
# data        = { "repo_name" : repo_name, 
#                 "repo_url"	: "https://github.com/pbx-gs/{0}.git".format(repo_name),
#                 "public_key": public_key , 
#                "private_key": private_key}
# Secrets(secret_key).update(json.dumps(data))

# print(public_key)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11060711793440335, 'fraction_numerical': 0.038032100488485696, 'mean_word_length': 5.858851674641149, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 16, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '337680', 'license': 'Apache-2.0', 'n_tokens_mistral': 1384, 'n_tokens_neox': 1291, 'n_words': 165, 'path': 'setup/setup.ipynb', 'repo_name': 'dariovillalon/jp-2020', 'size': '2891'}