added several ansible roles
This commit is contained in:
68
ansible/roles/cheat/templates/cheat/cheat.zsh
Normal file
68
ansible/roles/cheat/templates/cheat/cheat.zsh
Normal file
@@ -0,0 +1,68 @@
|
||||
#compdef cheat
|
||||
# {{ ansible_managed }}
|
||||
|
||||
local cheats taglist pathlist
|
||||
|
||||
_cheat_complete_personal_cheatsheets()
|
||||
{
|
||||
cheats=("${(f)$(cheat -l -t hacking | tail -n +3 | cut -d' ' -f1)}")
|
||||
_describe -t cheats 'cheats' cheats
|
||||
}
|
||||
|
||||
_cheat_complete_full_cheatsheets()
|
||||
{
|
||||
cheats=("${(f)$(cheat -l | tail -n +3 | cut -d' ' -f1)}")
|
||||
_describe -t cheats 'cheats' cheats
|
||||
}
|
||||
|
||||
_cheat_complete_tags()
|
||||
{
|
||||
taglist=("${(f)$(cheat -T)}")
|
||||
_describe -t taglist 'taglist' taglist
|
||||
}
|
||||
|
||||
_cheat_complete_paths()
|
||||
{
|
||||
pathlist=("${(f)$(cheat -d | cut -d':' -f1)}")
|
||||
_describe -t pathlist 'pathlist' pathlist
|
||||
}
|
||||
|
||||
_cheat() {
|
||||
|
||||
_arguments -C \
|
||||
'(--init)--init[Write a default config file to stdout]: :->none' \
|
||||
'(-c --colorize)'{-c,--colorize}'[Colorize output]: :->none' \
|
||||
'(-d --directories)'{-d,--directories}'[List cheatsheet directories]: :->none' \
|
||||
'(-e --edit)'{-e,--edit}'[Edit <sheet>]: :->personal' \
|
||||
'(-l --list)'{-l,--list}'[List cheatsheets]: :->full' \
|
||||
'(-p --path)'{-p,--path}'[Return only sheets found on path <name>]: :->pathlist' \
|
||||
'(-r --regex)'{-r,--regex}'[Treat search <phrase> as a regex]: :->none' \
|
||||
'(-s --search)'{-s,--search}'[Search cheatsheets for <phrase>]: :->none' \
|
||||
'(-t --tag)'{-t,--tag}'[Return only sheets matching <tag>]: :->taglist' \
|
||||
'(-T --tags)'{-T,--tags}'[List all tags in use]: :->none' \
|
||||
'(-v --version)'{-v,--version}'[Print the version number]: :->none' \
|
||||
'(--rm)--rm[Remove (delete) <sheet>]: :->personal'
|
||||
|
||||
case $state in
|
||||
(none)
|
||||
_cheat_complete_full_cheatsheets
|
||||
;;
|
||||
(full)
|
||||
_cheat_complete_full_cheatsheets
|
||||
;;
|
||||
(personal)
|
||||
_cheat_complete_personal_cheatsheets
|
||||
;;
|
||||
(taglist)
|
||||
_cheat_complete_tags
|
||||
;;
|
||||
(pathlist)
|
||||
_cheat_complete_paths
|
||||
;;
|
||||
(*)
|
||||
_cheat_complete_full_cheatsheets
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
compdef _cheat cheat
|
||||
83
ansible/roles/cheat/templates/cheat/conf.yml
Normal file
83
ansible/roles/cheat/templates/cheat/conf.yml
Normal file
@@ -0,0 +1,83 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
# The editor to use with 'cheat -e <sheet>'. Defaults to $EDITOR or $VISUAL.
|
||||
editor: /usr/local/bin/nvim
|
||||
|
||||
# Should 'cheat' always colorize output?
|
||||
colorize: false
|
||||
|
||||
# Which 'chroma' colorscheme should be applied to the output?
|
||||
# Options are available here:
|
||||
# https://github.com/alecthomas/chroma/tree/master/styles
|
||||
style: monokai
|
||||
|
||||
# Which 'chroma' "formatter" should be applied?
|
||||
# One of: "terminal", "terminal256", "terminal16m"
|
||||
formatter: terminal256
|
||||
|
||||
# Through which pager should output be piped?
|
||||
# 'less -FRX' is recommended on Unix systems
|
||||
# 'more' is recommended on Windows
|
||||
# pager: 'bat --lessopen --paging=never -l md -p'
|
||||
pager: "{{ lookup('env', 'XDG_CONFIG_HOME') }}/cheat/glowpager.sh"
|
||||
# Cheatpaths are paths at which cheatsheets are available on your local
|
||||
# filesystem.
|
||||
#
|
||||
# It is useful to sort cheatsheets into different cheatpaths for organizational
|
||||
# purposes. For example, you might want one cheatpath for community
|
||||
# cheatsheets, one for personal cheatsheets, one for cheatsheets pertaining to
|
||||
# your day job, one for code snippets, etc.
|
||||
#
|
||||
# Cheatpaths are scoped, such that more "local" cheatpaths take priority over
|
||||
# more "global" cheatpaths. (The most global cheatpath is listed first in this
|
||||
# file; the most local is listed last.) For example, if there is a 'tar'
|
||||
# cheatsheet on both global and local paths, you'll be presented with the local
|
||||
# one by default. ('cheat -p' can be used to view cheatsheets from alternative
|
||||
# cheatpaths.)
|
||||
#
|
||||
# Cheatpaths can also be tagged as "read only". This instructs cheat not to
|
||||
# automatically create cheatsheets on a read-only cheatpath. Instead, when you
|
||||
# would like to edit a read-only cheatsheet using 'cheat -e', cheat will
|
||||
# perform a copy-on-write of that cheatsheet from a read-only cheatpath to a
|
||||
# writeable cheatpath.
|
||||
#
|
||||
# This is very useful when you would like to maintain, for example, a
|
||||
# "pristine" repository of community cheatsheets on one cheatpath, and an
|
||||
# editable personal reponsity of cheatsheets on another cheatpath.
|
||||
#
|
||||
# Cheatpaths can be also configured to automatically apply tags to cheatsheets
|
||||
# on certain paths, which can be useful for querying purposes.
|
||||
# Example: 'cheat -t work jenkins'.
|
||||
#
|
||||
# Community cheatsheets must be installed separately, though you may have
|
||||
# downloaded them automatically when installing 'cheat'. If not, you may
|
||||
# download them here:
|
||||
#
|
||||
# https://github.com/cheat/cheatsheets
|
||||
cheatpaths:
|
||||
# Cheatpath properties mean the following:
|
||||
# 'name': the name of the cheatpath (view with 'cheat -d', filter with 'cheat -p')
|
||||
# 'path': the filesystem path of the cheatsheet directory (view with 'cheat -d')
|
||||
# 'tags': tags that should be automatically applied to sheets on this path
|
||||
# 'readonly': shall user-created ('cheat -e') cheatsheets be saved here?
|
||||
# - name: community
|
||||
# path: /home/kali/.config/cheat/cheatsheets/community
|
||||
# tags: [ community ]
|
||||
# readonly: true
|
||||
|
||||
# If you have personalized cheatsheets, list them last. They will take
|
||||
# precedence over the more global cheatsheets.
|
||||
- name: hacking
|
||||
path: "{{ lookup('env', 'XDG_CONFIG_HOME') }}/cheat/cheatsheets/hacking"
|
||||
tags: [ hacking ]
|
||||
readonly: false
|
||||
|
||||
# While it requires no configuration here, it's also worth noting that
|
||||
# cheat will automatically append directories named '.cheat' within the
|
||||
# current working directory to the 'cheatpath'. This can be very useful if
|
||||
# you'd like to closely associate cheatsheets with, for example, a directory
|
||||
# containing source code.
|
||||
#
|
||||
# Such "directory-scoped" cheatsheets will be treated as the most "local"
|
||||
# cheatsheets, and will override less "local" cheatsheets. Similarly,
|
||||
# directory-scoped cheatsheets will always be editable ('readonly: false').
|
||||
15
ansible/roles/cheat/templates/cheat/glowpager.sh
Executable file
15
ansible/roles/cheat/templates/cheat/glowpager.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#! /bin/bash
|
||||
# {{ ansible_managed }}
|
||||
|
||||
# Create a temporary file
|
||||
FILENAME=$(mktemp)
|
||||
|
||||
# Save the original file name in our temp file
|
||||
cat > $FILENAME
|
||||
# Get the file content and substitute environment variables
|
||||
TEMPCONTENT=$(command cat $FILENAME | envsubst '$LHOST')
|
||||
# Delete the tempfile again
|
||||
rm $TEMPFILE
|
||||
|
||||
# Output the content as markdown with glow
|
||||
echo "$TEMPCONTENT" | glow --style "$XDG_CONFIG_HOME/glow/dark.json"
|
||||
196
ansible/roles/cheat/templates/glow/dark.json
Normal file
196
ansible/roles/cheat/templates/glow/dark.json
Normal file
@@ -0,0 +1,196 @@
|
||||
{
|
||||
"document": {
|
||||
"block_prefix": "\n",
|
||||
"block_suffix": "\n",
|
||||
"margin": 2
|
||||
},
|
||||
"block_quote": {
|
||||
"indent": 1,
|
||||
"indent_token": "│ "
|
||||
},
|
||||
"paragraph": {},
|
||||
"list": {
|
||||
"level_indent": 2
|
||||
},
|
||||
"heading": {
|
||||
"block_suffix": "\n",
|
||||
"color": "#0f63bd",
|
||||
"bold": true
|
||||
},
|
||||
"h1": {
|
||||
"prefix": "\u001b[38;5;1;0m\u001b[m ",
|
||||
"suffix": " ",
|
||||
"color": "#0ca8fb",
|
||||
"background_color": "",
|
||||
"bold": true
|
||||
},
|
||||
"h2": {
|
||||
"prefix": " "
|
||||
},
|
||||
"h3": {
|
||||
"prefix": " - "
|
||||
},
|
||||
"h4": {
|
||||
"prefix": " - "
|
||||
},
|
||||
"h5": {
|
||||
"prefix": " - "
|
||||
},
|
||||
"h6": {
|
||||
"prefix": " - ",
|
||||
"color": "6",
|
||||
"bold": false
|
||||
},
|
||||
"text": {},
|
||||
"strikethrough": {
|
||||
"crossed_out": true
|
||||
},
|
||||
"emph": {
|
||||
"italic": true
|
||||
},
|
||||
"strong": {
|
||||
"bold": true
|
||||
},
|
||||
"hr": {
|
||||
"color": "240",
|
||||
"format": "\n--------\n"
|
||||
},
|
||||
"item": {
|
||||
"block_prefix": "• "
|
||||
},
|
||||
"enumeration": {
|
||||
"block_prefix": ". "
|
||||
},
|
||||
"task": {
|
||||
"ticked": "[✓] ",
|
||||
"unticked": "[ ] "
|
||||
},
|
||||
"link": {
|
||||
"color": "30",
|
||||
"underline": true
|
||||
},
|
||||
"link_text": {
|
||||
"color": "35",
|
||||
"bold": true
|
||||
},
|
||||
"image": {
|
||||
"color": "212",
|
||||
"underline": true
|
||||
},
|
||||
"image_text": {
|
||||
"color": "243",
|
||||
"format": "Image: {{ '{{' }}.text{{ '}}' }} →"
|
||||
},
|
||||
"code": {
|
||||
"prefix": " ",
|
||||
"suffix": " ",
|
||||
"color": "#F1F1F1",
|
||||
"background_color": "#011f2a"
|
||||
},
|
||||
"code_block": {
|
||||
"color": "244",
|
||||
"margin": 2,
|
||||
"chroma": {
|
||||
"text": {
|
||||
"color": "#C4C4C4"
|
||||
},
|
||||
"error": {
|
||||
"color": "#F1F1F1",
|
||||
"background_color": "#F05B5B"
|
||||
},
|
||||
"comment": {
|
||||
"color": "#676767"
|
||||
},
|
||||
"comment_preproc": {
|
||||
"color": "#FF875F"
|
||||
},
|
||||
"keyword": {
|
||||
"color": "#00AAFF"
|
||||
},
|
||||
"keyword_reserved": {
|
||||
"color": "#FF5FD2"
|
||||
},
|
||||
"keyword_namespace": {
|
||||
"color": "#FF5F87"
|
||||
},
|
||||
"keyword_type": {
|
||||
"color": "#6E6ED8"
|
||||
},
|
||||
"operator": {
|
||||
"color": "#EF8080"
|
||||
},
|
||||
"punctuation": {
|
||||
"color": "#E8E8A8"
|
||||
},
|
||||
"name": {
|
||||
"color": "#C4C4C4"
|
||||
},
|
||||
"name_builtin": {
|
||||
"color": "#FF8EC7"
|
||||
},
|
||||
"name_tag": {
|
||||
"color": "#B083EA"
|
||||
},
|
||||
"name_attribute": {
|
||||
"color": "#7A7AE6"
|
||||
},
|
||||
"name_class": {
|
||||
"color": "#F1F1F1",
|
||||
"underline": true,
|
||||
"bold": true
|
||||
},
|
||||
"name_constant": {},
|
||||
"name_decorator": {
|
||||
"color": "#FFFF87"
|
||||
},
|
||||
"name_exception": {},
|
||||
"name_function": {
|
||||
"color": "#00D787"
|
||||
},
|
||||
"name_other": {},
|
||||
"literal": {},
|
||||
"literal_number": {
|
||||
"color": "#6EEFC0"
|
||||
},
|
||||
"literal_date": {},
|
||||
"literal_string": {
|
||||
"color": "#C69669"
|
||||
},
|
||||
"literal_string_escape": {
|
||||
"color": "#AFFFD7"
|
||||
},
|
||||
"generic_deleted": {
|
||||
"color": "#FD5B5B"
|
||||
},
|
||||
"generic_emph": {
|
||||
"italic": true
|
||||
},
|
||||
"generic_inserted": {
|
||||
"color": "#00D787"
|
||||
},
|
||||
"generic_strong": {
|
||||
"bold": true
|
||||
},
|
||||
"generic_subheading": {
|
||||
"color": "#777777"
|
||||
},
|
||||
"background": {
|
||||
"background_color": "#373737"
|
||||
}
|
||||
}
|
||||
},
|
||||
"table": {
|
||||
"margin": 4,
|
||||
"center_separator": "\u001b[38;5;14m┼\u001b[m",
|
||||
"column_separator": "\u001b[38;5;14m│\u001b[m",
|
||||
"row_separator": "\u001b[38;5;14m─\u001b[m",
|
||||
"color":"#F1F1F1"
|
||||
},
|
||||
"definition_list": {},
|
||||
"definition_term": {},
|
||||
"definition_description": {
|
||||
"block_prefix": "\n🠶 "
|
||||
},
|
||||
"html_block": {},
|
||||
"html_span": {}
|
||||
}
|
||||
10
ansible/roles/cheat/templates/glow/glow.yml
Normal file
10
ansible/roles/cheat/templates/glow/glow.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
# style name or JSON path (default "auto")
|
||||
style: "$XDG_CONFIG_HOME/glow/dark.json"
|
||||
# show local files only; no network (TUI-mode only)
|
||||
local: true
|
||||
# mouse support (TUI-mode only)
|
||||
mouse: false
|
||||
# use pager to display markdown
|
||||
pager: false
|
||||
# word-wrap at width
|
||||
width: 150
|
||||
Reference in New Issue
Block a user