Skip to content

Instantly share code, notes, and snippets.

@IAmSuyogJadhav
Last active July 28, 2018 12:34
Show Gist options
  • Save IAmSuyogJadhav/283f89ba67c67c6d7c09ef957a016b2a to your computer and use it in GitHub Desktop.
Save IAmSuyogJadhav/283f89ba67c67c6d7c09ef957a016b2a to your computer and use it in GitHub Desktop.
Use Google Drive with Google Colaboratory. Copy and paste the code given below in your notebook and run it to access the files from your Google Drive storage in Google Colaboratory, . It will mount your drive under folder /content/drive. More details on how to setup Google Colab: https://medium.com/deep-learning-turkey/google-colab-free-gpu-tuto…
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"!apt-get install -y -qq software-properties-common python-software-properties module-init-tools\n",
"!add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null\n",
"!apt-get update -qq 2>&1 > /dev/null\n",
"!apt-get -y install -qq google-drive-ocamlfuse fuse\n",
"from google.colab import auth\n",
"auth.authenticate_user()\n",
"from oauth2client.client import GoogleCredentials\n",
"creds = GoogleCredentials.get_application_default()\n",
"import getpass\n",
"!google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL\n",
"vcode = getpass.getpass()\n",
"!echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}\n",
"!mkdir -p drive\n",
"!google-drive-ocamlfuse drive"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment