whoami

gn // get notes

Zero-dependency markdown notes, synced to WebDAV, GitHub, or Dropbox.

gn is a simple bash script that pulls a markdown note from cloud storage, opens it in $EDITOR, and pushes it back if you changed anything. Supports WebDAV (Koofr, Nextcloud, etc.), GitHub, and Dropbox. No git, no daemons, no heavy apps to install - just curl and a local folder.

Download

gn.sh - save to ~/bin/gn, chmod +x

Setup

  1. Download gn.sh above and make it run this to make it executable:
mv gn.sh ~/bin/gn && chmod +x ~/bin/gn
  1. Prepare your storage provider credentials:

Option A: Koofr Cloud Storage

  • Sign up free or log in at app.koofr.net.
  • Go to Account settings → Password and generate an App Password. The script needs this specific app-token, not your main web portal login password.

Option B: General WebDAV (Nextcloud, ownCloud, etc.)

  • Locate your service's primary WebDAV connection URL. (e.g., Nextcloud users can find this via Files → Files settings in the lower-left sidebar corner).
  • Ensure you have a dedicated App Password generated through your server's security settings panel for gn to use.

Option C: GitHub

  • GitHub Account: If you don't already have one, create an account.
  • Private Repository: Create a private repository (named gn, or anything you like) to hold your notes.
  • Personal Access Token: Generate a new Personal Access Token with the repo scope — this lets gn read and write files in your repository over the GitHub API. The setup menu will ask you to paste in your token, username, and repository name once; these are saved to your local config file.

Option D: Dropbox

  • Dropbox Account: If you don't already have one, create an account.
  • Create an App: Go to the Dropbox Developer Console and click Create App. Select Scoped access and choose the App folder option.
  • Set Permissions: Before finishing, click the Permissions tab of your new app. Check files.content.write and files.content.read, then click Submit.
  • Keys: Keep your app's App key and App secret handy from the settings tab. You'll also need to generate a long-lived refresh token via the OAuth flow below:
# 1. Open this URL (replace YOUR_APP_KEY) to authorise and get a one-time code:
https://www.dropbox.com/oauth2/authorize?client_id=YOUR_APP_KEY&response_type=code&token_access_type=offline

# 2. Exchange the code for a long-lived refresh token:
curl -s -X POST https://api.dropbox.com/oauth2/token \
  -d code=YOUR_AUTH_CODE \
  -d grant_type=authorization_code \
  -d client_id=YOUR_APP_KEY \
  -d client_secret=YOUR_APP_SECRET

Copy the refresh_token from the response — the setup menu will ask for it.

🔒 Privacy: Credentials are saved into ~/gn/gn.conf with chmod 600 permissions — only your local user can read the file.
  1. Run the script. If no configuration file is found, it will run an interactive setup menu to choose your backend and configure credentials:
$ gn
No config found at ~/gn/gn.conf - let's set one up.
Select your provider:
1) Koofr (WebDAV)
2) Custom WebDAV Server
3) GitHub
4) Dropbox
Choice [1-4]: 3
GitHub Personal Access Token (input hidden):
GitHub username (repo owner): your-username
Repository name: gn
Save this config for future runs? [Y/n] Y

To clear or alter your configuration later, run gn -c to wipe gn.conf and re-run setup.

Usage

gn [options] [note]
Command What it does
gn Open (or create) default note.md
gn ideas Open ideas.md - pulls, edits, pushes if changed
gn -t Open today's note, YYYY-MM-DD.md
gn -d ideas Delete a note, local and remote (with confirmation)
gn -r old new Rename a note, local and remote (WebDAV MOVE)
gn -s Sync (pull) all remote notes down to local directory
gn -c Clear saved credentials and reconfigure
gn -h Show help

Notes

Heads up Sync is last-write-wins. There's no merge or conflict detection - if you edit the same note from two machines without syncing in between, the second push overwrites the first.
Tip Notes are raw markdown files in your chosen storage backend, so you can read and edit them directly via a web browser or mobile app — e.g. Koofr, GitHub, or the Dropbox mobile app.

Source

The full script - copy it directly if you'd rather not download the file.

Loading gn.sh...