Skip to content

Instantly share code, notes, and snippets.

@skaravind
Forked from osmszk/Mount Drive on Colab
Created September 8, 2018 10:32
Show Gist options
  • Select an option

  • Save skaravind/7fad4bfbfb02d2ef6be7f6f92f7a1b99 to your computer and use it in GitHub Desktop.

Select an option

Save skaravind/7fad4bfbfb02d2ef6be7f6f92f7a1b99 to your computer and use it in GitHub Desktop.
#colab
# google-drive-ocamlfuseのインストール
# https://github.com/astrada/google-drive-ocamlfuse
!apt-get install -y -qq software-properties-common python-software-properties module-init-tools
!add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null
!apt-get update -qq 2>&1 > /dev/null
!apt-get -y install -qq google-drive-ocamlfuse fuse
# Colab用のAuth token作成
from google.colab import auth
auth.authenticate_user()
# Drive FUSE library用のcredential生成
from oauth2client.client import GoogleCredentials
creds = GoogleCredentials.get_application_default()
import getpass
!google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL
vcode = getpass.getpass()
!echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}
# drive/ を作り、そこにGoogle Driveをマウントする
!mkdir -p drive
!google-drive-ocamlfuse drive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment