{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.12.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"gpu","dataSources":[{"sourceId":112509,"databundleVersionId":14254895,"sourceType":"competition"}],"dockerImageVersionId":31234,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"!pip install pyngrok","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-13T08:55:23.446601Z","iopub.execute_input":"2026-01-13T08:55:23.447234Z","iopub.status.idle":"2026-01-13T08:55:26.763790Z","shell.execute_reply.started":"2026-01-13T08:55:23.447194Z","shell.execute_reply":"2026-01-13T08:55:26.762843Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from kaggle_secrets import UserSecretsClient\n\nngrok_auth_token = UserSecretsClient().get_secret('NGROK_AUTH_TOKEN')\nsolveit_pub_key = UserSecretsClient().get_secret('SOLVEIT_PUB_KEY')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-13T08:55:26.765405Z","iopub.execute_input":"2026-01-13T08:55:26.765702Z","iopub.status.idle":"2026-01-13T08:55:26.988707Z","shell.execute_reply.started":"2026-01-13T08:55:26.765672Z","shell.execute_reply":"2026-01-13T08:55:26.987956Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from pyngrok import ngrok\nimport subprocess\n\n# Set your ngrok token (get from ngrok.com dashboard)\nngrok.set_auth_token(ngrok_auth_token)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-13T08:55:26.989773Z","iopub.execute_input":"2026-01-13T08:55:26.990005Z","iopub.status.idle":"2026-01-13T08:55:27.034409Z","shell.execute_reply.started":"2026-01-13T08:55:26.989983Z","shell.execute_reply":"2026-01-13T08:55:27.033842Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!mkdir -p /root/.ssh\n!chmod 700 /root/.ssh","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-13T08:55:27.035929Z","iopub.execute_input":"2026-01-13T08:55:27.036294Z","iopub.status.idle":"2026-01-13T08:55:27.266178Z","shell.execute_reply.started":"2026-01-13T08:55:27.036271Z","shell.execute_reply":"2026-01-13T08:55:27.265096Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"with open('/root/.ssh/authorized_keys', 'w') as f:\n    f.write(solveit_pub_key)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-13T08:55:27.267617Z","iopub.execute_input":"2026-01-13T08:55:27.267979Z","iopub.status.idle":"2026-01-13T08:55:27.272746Z","shell.execute_reply.started":"2026-01-13T08:55:27.267934Z","shell.execute_reply":"2026-01-13T08:55:27.271972Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!chmod 600 /root/.ssh/authorized_keys","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-13T08:55:27.273723Z","iopub.execute_input":"2026-01-13T08:55:27.274085Z","iopub.status.idle":"2026-01-13T08:55:27.399763Z","shell.execute_reply.started":"2026-01-13T08:55:27.274057Z","shell.execute_reply":"2026-01-13T08:55:27.398805Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!ps aux | grep sshd","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-13T08:55:27.401053Z","iopub.execute_input":"2026-01-13T08:55:27.401323Z","iopub.status.idle":"2026-01-13T08:55:27.522842Z","shell.execute_reply.started":"2026-01-13T08:55:27.401295Z","shell.execute_reply":"2026-01-13T08:55:27.522093Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!apt-get update && apt-get install -y openssh-server\n!service ssh start","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-13T08:55:27.524119Z","iopub.execute_input":"2026-01-13T08:55:27.524397Z","iopub.status.idle":"2026-01-13T08:55:33.594449Z","shell.execute_reply.started":"2026-01-13T08:55:27.524361Z","shell.execute_reply":"2026-01-13T08:55:33.593423Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!service ssh status","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-13T08:55:33.595925Z","iopub.execute_input":"2026-01-13T08:55:33.596236Z","iopub.status.idle":"2026-01-13T08:55:33.729347Z","shell.execute_reply.started":"2026-01-13T08:55:33.596192Z","shell.execute_reply":"2026-01-13T08:55:33.728516Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"tunnel = ngrok.connect(22, \"tcp\")\nprint(f\"New tunnel: {tunnel.public_url}\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-13T08:55:33.731637Z","iopub.execute_input":"2026-01-13T08:55:33.731926Z","iopub.status.idle":"2026-01-13T08:55:34.272104Z","shell.execute_reply.started":"2026-01-13T08:55:33.731896Z","shell.execute_reply":"2026-01-13T08:55:34.271194Z"}},"outputs":[],"execution_count":null}]}