<jupyter_start><jupyter_text>[View in Colaboratory](https://colab.research.google.com/github/todun/googlecolab/blob/master/TensorBoard_GoogleColab.ipynb)  1 Get TensorBoard running in the background. *(Inspired by [this answer](https://stackoverflow.com/a/33838211/5222402).)*<jupyter_code>LOG_DIR = '/tmp/log'
get_ipython().system_raw(
    'tensorboard --logdir {} --host 0.0.0.0 --port 6006 &'
    .format(LOG_DIR)
)<jupyter_output><empty_output><jupyter_text>Make sure we're able to connect to the TensorBoard service.<jupyter_code>! curl http://localhost:6006<jupyter_output><empty_output><jupyter_text>2 Download and unzip [ngrok](https://ngrok.com).<jupyter_code>! wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip > /dev/null 2>&1
! unzip ngrok-stable-linux-amd64.zip > /dev/null 2>&1<jupyter_output><empty_output><jupyter_text>3 Launch ngrok background process...<jupyter_code>get_ipython().system_raw('./ngrok http 6006 &')<jupyter_output><empty_output><jupyter_text>...and retrieve public url. ([Source](https://stackoverflow.com/a/1955555/5222402))<jupyter_code>! curl -s http://localhost:4040/api/tunnels | python3 -c \
    "import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])"<jupyter_output><empty_output><jupyter_text>Note I was running against ngrok rate limits. Instead, I'm giving [localtunnel](https://github.com/localtunnel/localtunnel) a go:<jupyter_code># Install
! npm install -g localtunnel
# Tunnel port 6006 (TensorBoard assumed running)
get_ipython().system_raw('lt --port 6006 >> url.txt 2>&1 &')
# Get url
! cat url.txt<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1566933991363356, 'fraction_numerical': 0.04565083281924738, 'mean_word_length': 6.273542600896861, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 32, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '231131', 'license': 'MIT', 'n_tokens_mistral': 654, 'n_tokens_neox': 611, 'n_words': 100, 'path': 'TensorBoard_GoogleColab.ipynb', 'repo_name': 'todun/googlecolab', 'size': '1621'}