Last active
July 28, 2022 19:11
-
-
Save lukaszlach/f92a12de5157a08ed04184b20b290765 to your computer and use it in GitHub Desktop.
description
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[snippets]] | |
description = "Find source files matching pattern in content" | |
command = "find . -type f -name '<name=*>' -exec grep -Hn <pattern> {} \\;" | |
output = "" | |
[[snippets]] | |
description = "List opened ports and owner process (OSX)" | |
command = "sudo lsof -PiTCP -sTCP:LISTEN" | |
output = "" | |
[[snippets]] | |
description = "Show current weather" | |
command = "curl v2.wttr.in/Warsaw -sSf" | |
output = "" | |
[[snippets]] | |
description = "Run remote shell listening for connections on :5000" | |
command = "nc -l -p 5000 -e /bin/bash" | |
output = "" | |
[[snippets]] | |
description = "Resolve domain using Google DNS over HTTP" | |
command = "curl -s 'https://dns.google.com/resolve?name=<domain>&type=A' | jq '.'" | |
output = "" | |
[[snippets]] | |
description = "Preview all files" | |
command = "find . -type f 2>/dev/null | fzf -m --reverse --height 100% --preview 'bat --color always --style full {}' --preview-window down:23 --header $(pwd) --inline-info | xargs" | |
tag = ["fzf", "ls", "bat"] | |
output = "" | |
[[snippets]] | |
description = "Edit selected file with vim" | |
command = "vim $(fzf --height 50% --reverse --border --preview 'bat --color always --style plain {}' --header $(pwd) --inline-info)" | |
tag = ["fzf", "ls", "bat", "vim"] | |
output = "" | |
[[snippets]] | |
description = "Inspect Docker containers" | |
command = "echo $(docker ps --format \"{{.Names}}\t{{.ID}}\" | fzf --height 100% --reverse --border --header-lines 0 --preview 'docker container inspect $(echo {} | cut -d\" \" -f1) | jq --indent 2 -C \".[0]\"' --header \"Containers (running)\" --inline-info --preview-window right:70%) | awk '{print $1}' | pbcopy" | |
tag = ["docker", "ps", "container", "inspect", "clipboard"] | |
output = "" | |
[[snippets]] | |
description = "Inspect Docker images" | |
command = "echo $(docker images --format '{{.Repository}}:{{.Tag}}' | grep -v 'none>' | sort | fzf --height 100% --reverse --border --header-lines 0 --preview 'docker image inspect {} | jq --indent 2 -C \".[0]\"' --header \"Images\" --inline-info --preview-window right:70%) | pbcopy" | |
tag = ["docker", "image", "inspect", "clipboard"] | |
output = "" | |
[[snippets]] | |
description = "Dump container network traffic" | |
command = "docker run --rm -it -u 0 --net container:$(docker ps --format \"{{.Names}}\" | fzf --height 40% --reverse --preview 'docker inspect --format \"{{json .NetworkSettings}}\" {} | jq -C \".\"' --preview-window right:70%) bretfisher/netshoot ngrep -d <device=any> -x -q \"\" \"<filter=ip>\"" | |
tag = ["docker", "container", "netshoot", "ngrep"] | |
output = "" | |
[[snippets]] | |
description = "Netshoot the selected container" | |
command = "docker run --rm -it -u 0 --net container:$(docker ps --format \"{{.Names}}\" | fzf --height 40% --reverse --preview 'docker inspect --format \"{{json .NetworkSettings}}\" {} | jq -C \".\"' --preview-window right:70%) bretfisher/netshoot bash" | |
tag = ["docker", "container", "netshoot"] | |
output = "" | |
[[snippets]] | |
description = "Enter container shell picking the best one" | |
command = "docker exec -it $(docker ps --format \"{{.Names}}\" | fzf --height 40% --reverse --preview 'docker top {}' --preview-window right:70%) sh -c \"which zsh && exec zsh; which bash && exec bash; which pwsh && exec pwsh; exec sh\"" | |
tag = ["docker", "container", "shell", "sh", "bash", "zsh", "pwsh"] | |
output = "" | |
[[snippets]] | |
description = "Run htop in selected container" | |
command = "docker run --rm -it -u 0 --pid container:$(docker ps --format \"{{.Names}}\" | fzf --height 40% --reverse --preview 'docker top {}' --preview-window right:70%) lukaszlach/htop" | |
tag = ["docker", "container", "htop"] | |
output = "" | |
[[snippets]] | |
description = "Run lazydocker interface" | |
command = "docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v \"$HOME/.lazydocker/\":/.config/jesseduffield/lazydocker -v $PWD:$PWD:ro lazyteam/lazydocker" | |
tag = ["docker"] | |
output = "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment