cheat.sh
cheat.sh copied to clipboard
Cite source at the end
Is there a way to have a last line with the source of the cheatsheet? Example:
user:~# curl cheat.sh/iptables
Answer:
# iptables
# Program that allows configuration of tables, chains and rules provided by the Linux kernel firewall.
# View chains, rules, and packet/byte counters for all tables:
sudo iptables -vnL
... # Restore iptables configuration from a file:
sudo iptables-restore < path/to/iptables_file
[Source: tldr pages]
Or
[Source: stackoverlow]
It would be helpful to know "hum ok, if I go on tldr.sh, will I see the same content, ... or maybe is this already the content from tldr.sh?"
Yes, it is a fair idea.
We already have this for the answers fetched from StackOverflow:
$ curl cheat.sh/python/read+json+file
# python - Parsing values from a JSON file?
#
...
import json
from pprint import pprint
with open('data.json') as f:
data = json.load(f)
pprint(data)
# With data, you can now also find values like so:
data["maps"][0]["id"]
data["masks"]["id"]
data["om_points"]
# Try those out and see if it starts to make sense.
#
# [Justin Peel] [so/q/2835559] [cc by-sa 3.0]
But we need the same for all cheat sheets. And even more than that, if we have the same page in several upstreams, we should show all of them:
$ curl cheat.sh/ls
[tldr]
....
[cheat]
...
[cheat.sheets]
....
See also: #147
I'd like to bump this as sources would be super useful when answers are sources from StackOverflow