• Stars
    star
    187
  • Rank 206,464 (Top 5 %)
  • Language
    Shell
  • License
    Apache License 2.0
  • Created about 11 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

command line tool to sync github gists

gister

gister is a command line tool for managing GitHub gists.

Based on gist.rb by @defunkt, this tool helps you to manage a local copy of your gists.

After publishing files to gist.github.com, this tool will:

  • automatically clone the gist repository to local
  • index the content of your gist for code search
  • fetch meta info (e.g. description, url) of the gist from GitHub and add them to gists.list.

You can also use gister to sync your gists (created and starred) between gist.github.com and your machine.

Dependencies

For Linux, BSD, etc, you also need xclip or xsel. For Cygwin, you need putclip/getclip provided by cygutils-extra. (Mas OS X users should be fine with the preinstalled pbcopy/pbpaste.)

Mac OS X users also need GNU versions of sed and date, a.k.a gsed and gdate.

Note: xsel users should use gist.rb v4.1.2+, since there is a bug bitting xsel users in previous versions.

Optional Dependencies

  • csearch

    To search gists on your local machine. If not available, fallbacks to grep.

  • legit

    If available, invokes legit sync to sync gist repository. Legit will stash, fetch, rebase/merge, push, and unstash if necessary.

    The develop branch of legit allows configuration for merge policy:

      * The default smart merge (rebase when suitable)
      * Always merge, never rebase (since [21bb7ed])
      * Always rebase, never merge (since [252b1eb])
      * Fast forward merge only (since [4782928])
    

    If legit is not available, gister will report dirty gist repositories (DIRTY $gist_id) when the environment variable GISTER_AUTO_COMMIT does not exist, and will commit files automatically when GISTER_AUTO_COMMIT exists.

Install

Note that the following instructions only install gister itself. You need to install its dependencies mentioned before yourself.

git clone https://github.com/weakish/gister.git
cd gister
make install
  • Edit config.mk if you do not want to install it to /usr/local.
  • Compatible with both GNU and BSD make.

To uninstall:

; cd gister
; make uninstall

You can also install/uninstall gister via basher.

Usage

init

For the first time, you need to run gister init to associate your GitHub account and configure the directory to store local copies of your gists.

After that, you may run gister sync to fetch all your gists (created and starred) to local.

Warn: sync can only fetch up to 10 million gists for you. If you have more than 10 million gists, you need to modify the source of gister to lift the limit.

Configuration

GISTER_USE_HTTPS: If you need to use https for some reason, set the env var GISTER_USE_HTTPS, but please note this isn't necessarily more secure than ssh, it's just a different option in case your network blocks all traffic other than http/s.

GISTER_AUTO_COMMIT: If you'd like the sync command to automatically commit any local changes you've made before pulling and pushing to gist.github.com, set the GISTER_AUTO_COMMIT env var to anything.

publish

Whenever you want to publish a gist, just use

gister description file.txt ...

This will create the gist with the provided description, clone the gist repo, and put the gistid to clipborad.

Note: you must provide gist description, otherwise gister will fail.

Hint: gister will pass all arguments to gist as gist -c -o -d description ..., so you can use other options that gist understands, e.g. gister description -P will work.

If you've edited your gists at gist.github.com or local machine, without pull/push changesets, you can sync all your gists via gister sync.

If you've deleted your gists at gist.github.com, after gister sync, the directories of deleted gists at your local machine will be marked with a prefix _.

search

Search all of your gists:

gister search regexp

If codesearch is installed, regexp is RE2 (nearly PCRE). Otherwise it is ERE, a.k.a grep -E.

export

Export a gist (available at local) to a git repository, with its full history:

; cd git-repo-root
; gister export gist_id sub_directory_name branch_name

The content of the gist will be exported to sub_directory_name, and the merging message will use branch_name.

migrate

From version 1.0.0, gister uses a different storage structure. If you have used gister <1.0.0, then you need to run this command to migrate:

gister migrate

Storage

/path/to/your/gists
|-- gists.list  # a list of all your gists (including meta info)
|-- repo # git repositories of your gists
|-- tree # working directory of your gist repositories
    |-- 123456 # an example of gist
    |-- _123567890 # an example of gist which you have deleted on gist.github.com
    |-- ...
`-- .csearchindex # code search index (optional)

Contributing

Send pull requests or issues at:

https://github.com/weakish/gister

Tips

Setting environment variable GISTER_DEBUG to true (or any non-empty string) will enable debug mode (set -x).

More Repositories

1

vscode-complete-statement

Complete Statement with semicolon in vscode.
TypeScript
14
star
2

fm163

Download mp3 files and metadata from NetEase cloud music a.k.a. music.163.com
Python
9
star
3

pomodoro-timer

a simple command line pomodoro timer
Shell
6
star
4

rcshell.vim

syntax highlight file for the rc shell scripting language
Vim Script
6
star
5

kernel-monthly-zh

Chinese kernel monthly fetcher
Ruby
4
star
6

creole2md

Convert creole to markdown.
Ruby
4
star
7

weakish.github.com

map memories to web pages
Liquid
4
star
8

md2man

md2man - convert markdown to manpage
Groff
4
star
9

sicp

SICP resources
4
star
10

js

Experimenting with git and monorepo for JavaScript Projects.
JavaScript
3
star
11

blm

software sites with the black lives matter banner
3
star
12

arxiv-url

Firefox extension to replace arxiv pdf links on web pages to arxiv abstract link.
JavaScript
3
star
13

0me-hubs-snapshots

Snapshots of ZeroMe hubs.
JavaScript
3
star
14

migemo-dict-zh

A dictionary to use cmigemo with Chinese.
Vim Script
2
star
15

whci

WHCI stands for WHCI Human Computer Interaction. It makes my code easy to read FOR MYSELF.
Python
2
star
16

viconf

visudo for all commands
Shell
2
star
17

command-line-wrappers

A collection of wrappers of command line tools.
Shell
2
star
18

cheat

A cheat.rb clone in shell (use git repo to store cheatsheets).
Shell
2
star
19

telegraphet

command line tool to post content on telegra.ph
Python
2
star
20

fastify-getting-started

LeanEngine fastify getting started
JavaScript
1
star
21

fileup

A file uploader demo powered by LeanCloud and Svelte.
JavaScript
1
star
22

scrapbook

A scrapbook of some articles I've read.
CSS
1
star
23

coding-style

This is for personal reference only.
1
star
24

yummy

an anonymous fictional review database for hex numbers
Python
1
star
25

greylist

little effort to make corporations accountable
1
star
26

weakish

README
Shell
1
star
27

baidupan-cli

Shell
1
star
28

hubsh

command line GitHub/gogs API client in sh
Shell
1
star
29

micro-gh-page

micro github pages repository template
CSS
1
star
30

teapot

starlette & vert.x http server example
Python
1
star
31

z85rb

z85rb - pure Ruby implementation of Z85 encoding
Ruby
1
star
32

douban-cite

Generate book reference based on douban.
Go
1
star
33

pfhs

Persnoal Filesystem Hierarchy Standard
1
star
34

jump-or-exec

shell script to jump or exec an application under X window manager
Shell
1
star
35

mpm

Minimalistic command line password manager
Shell
1
star
36

ceylon-sexp

S-expression subset as a data-interchange format
Ceylon
1
star
37

DnD5e-ported-spells

Port some "ancient" spells to DnD fifth edition.
1
star
38

dotfiles

This repo is compatible with github.com/MikeMcQuaid/strap
Go
1
star
39

kwplayer

酷我音乐盒的 Gtk/Linux 实现
Python
1
star
40

nest-getting-started

LeanEngine Nest.js getting started
TypeScript
1
star
41

tinycore-usb

A sh script to install TinyCore Linux on a tiny usb disk or SD/CF card, for x86 compatible machines.
Shell
1
star
42

minify-jre

Minify JRE distribution.
Makefile
1
star
43

hello-cycle

Hello World in Cycle.js with TypeScript and JSX
TypeScript
1
star
44

playground

JavaScript
1
star
45

xkcd936

xkcd936 style passphrase generator.
Go
1
star
46

discourse-analyser

a naive discourse forum posts analyser
JavaScript
1
star
47

typecho-framework-exercise

Exercises for learning typecho framework
PHP
1
star
48

suzhou-numerals

Encoding and decoding Suzhou numerals.
TypeScript
1
star
49

0net-snapshot

sh scripts to take snapshots of ZeroNet sites
Shell
1
star
50

zhanguoce

Ancient Chinese book 戰國策 in markdown
Shell
1
star
51

ceylon-zhihu

A ceylon client to zhihu.com API.
Ceylon
1
star
52

unicode-vo

ReScript
1
star
53

htm

convert plain text to HTML 2.0, auto-linked
TypeScript
1
star
54

learn-thai-with-chatgpt

A demo to show that ChatGPT often make stuff up.
Astro
1
star
55

ZeroMeHubList

A list of ZeroMe hubs.
1
star
56

pyinfra-unix

abstract layer for unix provision with pyinfra
Python
1
star