• Stars
    star
    103
  • Rank 333,046 (Top 7 %)
  • Language
    Python
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 2 years ago

Reviews

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

Repository Details

🖥️ Easily download any file from a GitHub Gist, with one single command.

Travis CI Coveralls PyPI Version Python Version

GetGist

Easily download any file from a GitHub Gist, with one single command.

Why?

Because of reasons I do not have a dotfiles repository. I prefer to store my init.vim, .gitconfig, .bashrc etc. as Gists.

I wrote this CLI so I could update my dotfiles with one single command: getmy vim.init, for example — and it's done.

Install

$ pip install getgist

GetGist works with Python 3.6+.

To update it just run $ pip install --upgrade getgist.

Usage

Getting Gists from GitHub

Just run getgist <username> <filename>. For example:

$ getgist cuducos .vimrc
  Fetching https://api.github.com/users/cuducos/gists
  Reading https://gist.githubusercontent.com/cuducos/409fac6ac23bf515f495/raw/666d7d01a0058e4fd898ff752db66160f10a60bb/.vimrc
  Saving .vimrc
  Done!

GetGist asks you what to do when a local file (with the same name) exists. If you decide not to delete your local copy of the file, it will be renamed with extensions such as .bkp, .bkp1, .bkp2 etc.

Updating Gists at GitHub

Just run putgist <username> <filename> to update the remote Gist with the contents of the local file. It requires an OAuth token (see Using OAuth authentication below). For example:

$ putgist cuducos .vimrc
  User cuducos authenticated
  Fetching https://api.github.com/gists
  Sending contents of .vimrc to https://api.github.com/gists/409fac6ac23bf515f495
  Done!
  The URL to this Gist is: https://gist.github.com/cuducos/409fac6ac23bf515f495

GetGist asks you what to do when it finds the different files with the same name in different Gists.

Listing Gist files from GitHub

Just run lsgists <username>. For example:

$ lsgists cuducos
  Gist           File               URL
  -------------  ------------------ -------------------------
  First Gist     file.md            https://gist.github.com/…
  My Gist #2     another_file.md    https://gist.github.com/…
  My Gist #2     README.md          https://gist.github.com/…

Secret Gists (when user is authenticated) are listed with [Secret Gist] tag next to their names.

Using OAuth authentication

Why?

Add your personal access token as as environment variable to allow:

  1. downloading private gists
  2. updating existing gists
  3. listing private gists

How?

  1. Get a personal access token with permission to manage your gists from GitHub settings
  2. Set an environment variable called GETGIST_TOKEN with your personal access token

This article might help you create an environment variable in a Unix-based operational system with Bash, but feel free to search alternatives for other systems and shells.

Example

$ export GETGIST_TOKEN=whatever1234
$ getgist cuducos .vimrc
  User cuducos authenticated
  Fetching https://api.github.com/gists
  Reading https://gist.githubusercontent.com/cuducos/409fac6ac23bf515f495/raw/666d7d01a0058e4fd898ff752db66160f10a60bb/.vimrc
  Saving .vimrc
  Done!
  The URL to this Gist is: https://gist.github.com/cuducos/409fac6ac23bf515f495

This will work even if the file you are trying to download is a private gist (surely the user name has to match the GETGIST_TOKEN account).

Setting a default user

Why?

Set a default user to avoid typing your GitHub user name all the time.

How?

  1. Set an environment variable called GETGIST_USER with your GitHub user name
  2. Use the shortcut getmy <filename>, putmy <filename> or mygists

Example

$ export GETGIST_USER=cuducos
$ getmy .vimrc
  Fetching https://api.github.com/users/cuducos/gists
  Reading https://gist.githubusercontent.com/cuducos/409fac6ac23bf515f495/raw/666d7d01a0058e4fd898ff752db66160f10a60bb/.vimrc
  Saving .vimrc
  Done!
  The URL to this Gist is: https://gist.github.com/cuducos/409fac6ac23bf515f495

Contributing

We use Poetry to manage our development environment:

  1. poetry install will get you a virtualenv with all the dependencies for you
  2. poetry shell will activate this virtualenv
  3. exit deactivates this virtualenv

Feel free to report an issue, open a pull request, or drop a line.

Don't forget to format your code with Black, and to write and run tests:

$ tox

More Repositories

1

minha-receita

🏢 Sua API web para consulta de informações do CNPJ da Receita Federal
Go
1,204
star
2

twitter-cleanup

🛁 Clean-up inactive accounts and bots from your Twitter
Python
288
star
3

yaml.nvim

🍒 YAML toolkit for Neovim users
Lua
169
star
4

calculadora-do-cidadao

💵 Tool for Brazilian Reais monetary adjustment/correction
Python
149
star
5

my-internet-speed

🛎️ Monitor the speed your ISP is delivering
Python
135
star
6

alchemydumps

SQLAlchemy backup/dump tool for Flask
Python
116
star
7

bot-followers

🍊 Find out how many bots follow any given Twitter acount
Python
115
star
8

docs-cpi-pandemia

😷 Dowload dos documentos da CPI da Pandemia
Go
99
star
9

whiskyton

Whiskyton, find whiskies that you like!
Python
84
star
10

fio-de-ariadne

🪁 Structuiring data on missing kids in Brazil
Python
77
star
11

elm-format-number

✨Format numbers as pretty strings
Elm
60
star
12

chunk

🧱 Chunk is a download manager for slow and unstable servers
Go
53
star
13

pwned-antifas

HTML
50
star
14

brazilian-cities

A script to generate list with all Brazilian cities and states
Python
48
star
15

createnv

🧞‍♀️Automagically creates .env files
Python
40
star
16

django-public-admin

🔓 A public and read-only version of the Django Admin
Python
37
star
17

webassets-elm

📦Filter for compiling Elm files using webassets
Python
36
star
18

cunhajacaiu

Brazilian website counting the days to the fall of Cunha
Elm
27
star
19

django-ajax-contacts

Web app to discuss responsabilities of backend and frontend code
Python
26
star
20

raspadorlegislativo

Testes de código para integrar, futuramente, o Radar Legislativo
Python
19
star
21

go-cpf

CPF validation in Go
Go
17
star
22

go-cnpf

🇧🇷 CPF and CNPJ validation in Go
Go
16
star
23

fuckoff-twitter

Fuck off @twitter, let me have "latest tweets" as a default.
Rust
14
star
24

PhD

My PhD writings
CSS
14
star
25

cara-de-nordestino

Você tem cara de nordestino?
Elm
14
star
26

grupy-python-tdd-flask

Palestra para encontro do Grupy-SP em 12 de março de 2016.
Python
14
star
27

dotfiles

🥰 My dot files
Lua
13
star
28

em-nome-da-lai

🧑‍⚖️ Em nome da LAI! Gerador de petições com base na LAI.
Elm
13
star
29

hangouts-django-ajax

Source for a Hangouts On Air about Django & AJAX
Python
11
star
30

UOLEsportesSexista

Chrome Extension that redacts sexist contents from UOL sports coverage.
CoffeeScript
11
star
31

ezz

🎦 ezz is a simple CLI tool to schedule Zoom meetings
Rust
10
star
32

scrapy-memcached-cache

🗂Memcached HTTP cache storage backend for Scrapy
Python
10
star
33

hangouts-mock

Source code for a live coding session about Python's unittest.mock
Python
9
star
34

findaconf

Mock-up for Find a Conference
Python
7
star
35

vamos-aprender-elm-api

API created for educational purposes while teaching Elm
Python
7
star
36

wed

🌤 Track the weather for event days
Rust
7
star
37

lista-de-compras

🛒 Bot de lista de compras compartilhada para o Telegram
Python
6
star
38

its-wednesday

Captain, it's Wednesday!
Go
5
star
39

vamos-aprender-elm

Source codes from a series of live coding in Elm
Elm
5
star
40

pagamentos-alesc

Python
5
star
41

from-my-ex

💕 Sending all the love from my ex to my new happy and promisucous social media life
Python
4
star
42

spellfile.nvim

🌕 Port of spellfile.vim to Lua without depending on netrw
Lua
4
star
43

go-cnpj

CNPJ validation in Go
Go
4
star
44

boteco

CLI to create redirections in CloudFlare to Zoom meetings.
Rust
4
star
45

grrs

This is me studying Rust having Command Line Applications in Rust book as a starting point.
Rust
4
star
46

triathlon-live-calendar

📅 Calendar file generator for triathlonlive.tv upcoming events
Python
4
star
47

grupy-porque-elm

Código fonte para a palestra que ofereci no encontro do Grupy-SP, em 17 de setembro de 2016.
Elm
3
star
48

sortimages

Python
3
star
49

twitter-filtered-stream-client

🏞️ Twitter Filtered Stream API Client
Go
3
star
50

hangouts-django-react

Source for a Hangouts On Air about Django & ReactJS
Python
3
star
51

filterss

FilteRSS - More power over your feeds
HTML
3
star
52

palestra-relampago-git-bisect

Mini-calculadora escrita como exemplo para uma palestra relâmpago sobre `git bisect`
Python
3
star
53

ironbot

🚵 CLI to get information about Ironman professional races
Python
2
star
54

repo-birthday

🎂 Know when your repos are celebrating their birthdays!
Rust
2
star
55

MeDontLikeFB

Make your Facebook better, stop liking things.
JavaScript
2
star
56

astronomer

⭐️ Astronomer looks at the stars. At all the stars you’ve got on GitHub.
Rust
1
star
57

not-my-ex

🐝 Tiny CLI to post simultaneously to Mastodon and Bluesky
Python
1
star
58

minha-receita-mirror

Simple UI for R2 objects
1
star
59

ftp-based-zones

⚡ Cycling FTP-based training zones
Elm
1
star
60

cuducos.me

Source files of my personal webpage
HTML
1
star
61

manifestacoes-no-twitter

Python
1
star
62

airnope

☔ AirNope keeps Telegram groups clean from ”airdrop” spam
Rust
1
star