Skip to content

Latest commit

 

History

History
130 lines (88 loc) · 3.53 KB

usage.md

File metadata and controls

130 lines (88 loc) · 3.53 KB

Midgard Usage

English | 中文

Midgard CLI offers several command to interact with the midgard server and daemon.

Status Check

Check if everything is setup correctly:

$ mg status
server status: OK
daemon status: OK

List Active Daemons

Check all connected daemon users:

$ mg daemon ls
id      name
1       changkun-perflock
2       changkun-air-arm
3       changkun-pro-intel
4       changkun-ubuntu
5       changkun-win

Backup Data using Git

Midgard uses Git to backup all the data. All data are stored in the ./data folder with some naming convention. Midgard server will sync with the configured Git repository, see settings in ../config.yml

Note, to sync the data, use git instead of https protocol:

git config --global url."git@github.com:".insteadOf "https://github.com/"

Allocate Global URL

Allocate a global url to persist the data:

$ mg alloc /awesome/filename -f /path/to/the/file # alloc link for file
https://changkun.de/midgard/awesome/filename

$ mg alloc /awesome/clipboard/content             # alloc for clipboard data
https://changkun.de/midgard/awesome/clipboard/content

$ mg alloc                          # alloc a random link for clipboard data
https://changkun.de/midgard/random/fboVP8u4xNMHfvsv2EeLzL.txt

Keyboard hotkey:

  • Linux: Ctrl+Mod4+s
  • macOS: Ctrl+Option+s

Hint: The allocated link will be write back to the clipboard and ready for paste.

iOS, iPadOS, macOS Shortcut - Alloc

Shared Clipboard

midgard daemon watches system clipboard and automatically sync with the midgard server. Thus, a possible use case of midgard is:

  1. Take a screenhot
  2. Use mg alloc or Use Ctrl+Option+s
  3. Ctrl+v

This returns a public accessible URL and write back into local clipboard so that one can immediately paste to anywhere.

Furthermore, with the built-in universal clipboard, one can even share clipboard cross platforms (e.g. between Mac and Linux).

iOS, iPadOS, macOS Shortcut - Clipboard

Code2image

Convert copied code to an image:

$ mg code2img
https://changkun.de/midgard/code/201218-204010
https://changkun.de/midgard/code/201218-204010.png

Or convert specify a given file:

$ mg code2img /path/to/your/file
https://changkun.de/midgard/code/201218-204010
https://changkun.de/midgard/code/201218-204010.png

Or convert specify a given file with line numbers:

$ mg code2img /path/to/your/file/ -l 5:10 # line 5 to 10
https://changkun.de/midgard/code/201218-204010
https://changkun.de/midgard/code/201218-204010.png

Summary page at https://changkun.de/midgard/code.

iOS, iPadOS, macOS Shortcut - code2img

License

Copyright 2020-2021 Changkun Ou. All rights reserved.