Add a post on rclone
This commit is contained in:
parent
3eeb6f748c
commit
ddadffc69d
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -2,6 +2,8 @@
|
||||
"cSpell.words": [
|
||||
"Bazel",
|
||||
"DSLR",
|
||||
"Keybase",
|
||||
"Rclone",
|
||||
"Starlark",
|
||||
"libc",
|
||||
"microcontrollers",
|
||||
|
46
Gemfile.lock
46
Gemfile.lock
@ -1,31 +1,32 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activesupport (5.2.3)
|
||||
activesupport (6.0.3.3)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
zeitwerk (~> 2.2, >= 2.2.2)
|
||||
addressable (2.7.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
colorator (1.1.0)
|
||||
concurrent-ruby (1.1.5)
|
||||
concurrent-ruby (1.1.7)
|
||||
em-websocket (0.5.1)
|
||||
eventmachine (>= 0.12.9)
|
||||
http_parser.rb (~> 0.6.0)
|
||||
eventmachine (1.2.7)
|
||||
faraday (1.0.1)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
ffi (1.11.3)
|
||||
ffi (1.13.1)
|
||||
forwardable-extended (2.6.0)
|
||||
gemoji (3.0.1)
|
||||
html-pipeline (2.11.1)
|
||||
html-pipeline (2.14.0)
|
||||
activesupport (>= 2)
|
||||
nokogiri (>= 1.4)
|
||||
http_parser.rb (0.6.0)
|
||||
i18n (1.7.0)
|
||||
i18n (1.8.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jekyll (4.0.0)
|
||||
jekyll (4.0.1)
|
||||
addressable (~> 2.4)
|
||||
colorator (~> 1.0)
|
||||
em-websocket (~> 0.5)
|
||||
@ -42,23 +43,23 @@ GEM
|
||||
terminal-table (~> 1.8)
|
||||
jekyll-avatar (0.7.0)
|
||||
jekyll (>= 3.0, < 5.0)
|
||||
jekyll-feed (0.12.1)
|
||||
jekyll-feed (0.15.0)
|
||||
jekyll (>= 3.7, < 5.0)
|
||||
jekyll-github-metadata (2.13.0)
|
||||
jekyll (>= 3.4, < 5.0)
|
||||
octokit (~> 4.0, != 4.4.0)
|
||||
jekyll-mentions (1.5.1)
|
||||
jekyll-mentions (1.6.0)
|
||||
html-pipeline (~> 2.3)
|
||||
jekyll (>= 3.7, < 5.0)
|
||||
jekyll-redirect-from (0.15.0)
|
||||
jekyll-redirect-from (0.16.0)
|
||||
jekyll (>= 3.3, < 5.0)
|
||||
jekyll-sass-converter (2.0.1)
|
||||
jekyll-sass-converter (2.1.0)
|
||||
sassc (> 2.0.1, < 3.0)
|
||||
jekyll-seo-tag (2.6.1)
|
||||
jekyll (>= 3.3, < 5.0)
|
||||
jekyll-watch (2.2.1)
|
||||
listen (~> 3.0)
|
||||
jemoji (0.11.0)
|
||||
jemoji (0.12.0)
|
||||
gemoji (~> 3.0)
|
||||
html-pipeline (~> 2.2)
|
||||
jekyll (>= 3.0, < 5.0)
|
||||
@ -67,28 +68,28 @@ GEM
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
liquid (4.0.3)
|
||||
listen (3.2.0)
|
||||
listen (3.2.1)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
mercenary (0.3.6)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.11.3)
|
||||
minitest (5.14.2)
|
||||
multipart-post (2.1.1)
|
||||
nokogiri (1.10.8)
|
||||
nokogiri (1.10.10)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
octokit (4.18.0)
|
||||
faraday (>= 0.9)
|
||||
sawyer (~> 0.8.0, >= 0.5.3)
|
||||
pathutil (0.16.2)
|
||||
forwardable-extended (~> 2.6)
|
||||
public_suffix (4.0.1)
|
||||
rb-fsevent (0.10.3)
|
||||
rb-inotify (0.10.0)
|
||||
public_suffix (4.0.6)
|
||||
rb-fsevent (0.10.4)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
rexml (3.2.4)
|
||||
rouge (3.13.0)
|
||||
rouge (3.23.0)
|
||||
safe_yaml (1.0.5)
|
||||
sassc (2.2.1)
|
||||
sassc (2.4.0)
|
||||
ffi (~> 1.9)
|
||||
sawyer (0.8.2)
|
||||
addressable (>= 2.3.5)
|
||||
@ -96,12 +97,13 @@ GEM
|
||||
terminal-table (1.8.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
thread_safe (0.3.6)
|
||||
tzinfo (1.2.5)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
tzinfo-data (1.2019.2)
|
||||
tzinfo-data (1.2020.1)
|
||||
tzinfo (>= 1.0.0)
|
||||
unicode-display_width (1.6.0)
|
||||
unicode-display_width (1.7.0)
|
||||
wdm (0.1.1)
|
||||
zeitwerk (2.4.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
@ -2,7 +2,7 @@
|
||||
layout: page
|
||||
title: "Reading metadata from a bitmap file"
|
||||
description: "A project writeup"
|
||||
date: 2020-10-10 12:25:00
|
||||
date: 2020-10-01 12:25:00
|
||||
written: 2020-09-15
|
||||
categories: project c images
|
||||
excerpt: >-
|
||||
|
104
_drafts/2020-10-08-Mounting-Google-Drives.md
Normal file
104
_drafts/2020-10-08-Mounting-Google-Drives.md
Normal file
@ -0,0 +1,104 @@
|
||||
---
|
||||
layout: page
|
||||
title: "Mounting Google Drive accounts as network drives"
|
||||
description: "Easy-to-use Google Drive integration for Linux using rclone"
|
||||
date: 2020-10-08 10:00:00
|
||||
written: 2020-09-22
|
||||
categories: linux workflow google
|
||||
excerpt: >-
|
||||
I can never get the Google Drive webapp to load quickly when I need it
|
||||
to. My solution: use some command-line magic to mount my drives directly
|
||||
to my laptop's filesystem.
|
||||
redirect_from:
|
||||
- /post/XcaM0k24/
|
||||
- /XcaM0k24/
|
||||
---
|
||||
|
||||
When sharing files, I use three main services. I use [Firefox Send]() and [KeybaseFS]() to share one-off and large files with friends, and I use [Google Drive]() to store some personal files, and for everything school-related (I don't get a choice about this). For the first two services, sharing a file is as simple as calling [`ffsend`](https://github.com/timvisee/ffsend) or moving a local file into my [kbfs mountpoint](), and I am done. Google Drive, on the other hand, the process isn't as easy. While some Linux distributions have Google Drive integration out of the box (I miss daily-driving [ChromiumOS]()), Linux users generally have to go to `drive.google.com`, and deal with the Google Drive webapp. Not sure if this is an "only me" problem, but whenever I need to quickly make a change to a document through the webapp, It decides to stop working.
|
||||
|
||||
I really like the Keybase approach of mounting remote storage as a "network drive" on my laptop, and wanted to do something similar for Google Drive. This is where a great tool called [`rclone`](https://rclone.org) comes in to play. Rclone is a very easy-to-use command-line application for working with cloud storage. I originally learned about it when I used to host this website on [DigitalOcean Spaces](https://www.digitalocean.com/products/spaces/) a few years ago. Out of the box, Rclone supports [many cloud providers](https://rclone.org/#providers), including Google Drive!
|
||||
|
||||
## Setting up Rclone for use with Google Drive
|
||||
|
||||
Now for the fun part, to get started with Rclone and Google Drive on your computer, you must first install Rclone. I am going to assume you are using a Linux-based operating system here, but with some slight tweaking, this works on BSD and Windows too!
|
||||
|
||||
```sh
|
||||
# Install Rclone with the automated installer
|
||||
curl https://rclone.org/install.sh | sudo bash
|
||||
```
|
||||
|
||||
Once Rclone is installed, you need to hop on over to the [Google Cloud Developer Console](https://console.developers.google.com/), and create a new project. Under the *ENABLE APIS AND SERVICES* section, search for, and enable the `Google Drive API`. This will expose an API to your Google Drive, and let programs interact with the files (if setting up multiple accounts, you only need to enable the API on one of them). Click the *Credentials* tab in the left-side panel, then *Create credentials*. This will open a panel letting you set up access to your new API.
|
||||
|
||||
With the panel open, click *CONFIGURE CONSENT SCREEN*, *External*, then *CREATE*. Enter `rclone` as the application name, and save it. You now have set up one of those "sign in with Google" screens for yourself. Clicking the *Credentials* tab again will bring you to an area where you can generate the needed API keys for Rclone.
|
||||
|
||||
Click *+ CREATE CREDENTIALS* at the top of the panel, and select *OAuth client ID*. Set the application type to *Desktop app*, and finally, press *Create*. You will now be shown the needed info to link Rclone to your account(s).
|
||||
|
||||
<div class="center" markdown="1">
|
||||
*Note: This API project is **not verified** by Google.*<br>
|
||||
*This means that you will be greeted with a scary warning when logging in the first time. Just ignore it.*
|
||||
</div>
|
||||
|
||||
Back in the terminal, we can run `rclone config` to set up a configuration for Google Drive. You will be prompted with many options. Use the following:
|
||||
```sh
|
||||
# > rclone config
|
||||
|
||||
# Create a new config
|
||||
n) New remote
|
||||
|
||||
# Set a name
|
||||
name> my_drive
|
||||
|
||||
# Choose a storage type
|
||||
Storage> drive
|
||||
|
||||
# You will be asked for a client ID and secret. These are the strings we just generated
|
||||
...
|
||||
|
||||
# Set the scope to allow Rclone access to your files
|
||||
scope> 1
|
||||
|
||||
# Select the default option for everything until asked if you want to use "auto config"
|
||||
# When asked, say yes
|
||||
auto_config> y
|
||||
|
||||
# Set team drive to no
|
||||
team_drive> n
|
||||
|
||||
# Verify the information, then say yes
|
||||
ok> y
|
||||
```
|
||||
|
||||
Almost done. You need to run `rclone ls my_drive:` (the colon is important). This will probably ask you to go to a link, and enable an API. Do so.
|
||||
|
||||
Your Google Drive can now be mounted by running the following (feel free to change the paths to whatever you want)
|
||||
|
||||
```
|
||||
mkdir -p ~/google_drive
|
||||
rclone mount my_drive: ~/google_drive --vfs-cache-mode writes
|
||||
```
|
||||
|
||||
## Starting Rclone on boot
|
||||
|
||||
You probably don't want to run an `rclone` command every time you start your computer. This can be solved in one of two ways
|
||||
|
||||
### For i3wm users
|
||||
|
||||
On `i3wm`, just add the following line to `~/.config/i3/config`:
|
||||
|
||||
```sh
|
||||
exec --no-startup-id rclone mount my_drive: /home/<user>/google_drive --vfs-cache-mode writes
|
||||
```
|
||||
|
||||
*Make sure to replace `<user>` with your username.*
|
||||
|
||||
Keep in mind, `exec` commands are not run when reloading `i3` with <kbd>Mod</kbd>+<kbd>Shift</kbd>+<kbd>r</kbd>. You must log out (<kbd>Mod</kbd>+<kbd>Shift</kbd>+<kbd>e</kbd>), and back in again.
|
||||
|
||||
### For Ubuntu / Debian-based users
|
||||
|
||||
In pretty much any Debian-based system, you can edit `/etc/rc.local` (using `sudo`), and add the following line right before `exit 0`:
|
||||
|
||||
```sh
|
||||
rclone mount my_drive: /home/<user>/google_drive --vfs-cache-mode writes
|
||||
```
|
||||
|
||||
*Make sure to replace `<user>` with your username.*
|
55
_sass/site/kbd.scss
Normal file
55
_sass/site/kbd.scss
Normal file
@ -0,0 +1,55 @@
|
||||
kbd {
|
||||
font-family: Consolas, "Lucida Console", monospace;
|
||||
display: inline-block;
|
||||
border-radius: 3px;
|
||||
padding: 0px 4px;
|
||||
box-shadow: 1px 1px 1px #777;
|
||||
margin: 2px;
|
||||
font-size: small;
|
||||
vertical-align: text-bottom;
|
||||
background: #eee;
|
||||
font-weight: 500;
|
||||
color: #555;
|
||||
cursor: pointer;
|
||||
font-variant: small-caps;
|
||||
font-weight: 600;
|
||||
|
||||
/* This two work */
|
||||
/* letter-spacing: 0.5px; */
|
||||
letter-spacing: 1px;
|
||||
|
||||
|
||||
/* Prevent selection */
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
kbd:hover, kbd:hover * {
|
||||
color: black;
|
||||
/* box-shadow: 1px 1px 1px #333; */
|
||||
}
|
||||
kbd:active, kbd:active * {
|
||||
color: black;
|
||||
box-shadow: 1px 1px 0px #ddd inset;
|
||||
}
|
||||
|
||||
kbd kbd {
|
||||
padding: 0px;
|
||||
margin: 0 1px;
|
||||
box-shadow: 0px 0px 0px black;
|
||||
vertical-align: baseline;
|
||||
background: none;
|
||||
}
|
||||
|
||||
kbd kbd:hover {
|
||||
box-shadow: 0px 0px 0px black;
|
||||
}
|
||||
|
||||
kbd:active kbd {
|
||||
box-shadow: 0px 0px 0px black;
|
||||
background: none;
|
||||
}
|
@ -9,3 +9,4 @@
|
||||
@import "site/home.scss";
|
||||
@import "site/navigation.scss";
|
||||
@import "site/page.scss";
|
||||
@import "site/kbd.scss";
|
Loading…
x
Reference in New Issue
Block a user