Documentation, show pid in x-open-ports, tweaks

This commit is contained in:
Ismo Vuorinen
2022-12-15 16:08:06 +02:00
parent 2369eae0ef
commit 7921e079da
5 changed files with 48 additions and 13 deletions

View File

@@ -17,13 +17,13 @@ indent_size = 2
indent_size = 2
tab_width = 2
shell_variant = posix # like -ln=posix
shell_variant = bash # like -ln=posix
binary_next_line = true # like -bn
switch_case_indent = true # like -ci
space_redirects = true # like -sr
keep_padding = false # like -kp
function_next_line = true # like -fn
never_split = true # like -ns
never_split = false # like -ns
[local/bin/antigen.zsh]
ignore = true

View File

@@ -1,6 +1,11 @@
# .dotfiles
The folder structure follows [XDG Base Directory Specification][xdg] where possible.
Welcome to [ivuorinen](https://github.com/ivuorinen)'s .dotfiles repository. It's a hodgepodge of scripts
and configurations, tests and mistakes I'm not aware of yet. As I find more interesting tools, configs and
other stuff, this repository will live accordingly.
Please for the love of everything good do not use these 1:1 as your own dotfiles,
fork or download the repo as a zip and go from there with your own configs.
## Setup
@@ -11,14 +16,42 @@ The folder structure follows [XDG Base Directory Specification][xdg] where possi
3. ???
4. Profit
Note: there's a bit chicken/egg situation, because settler assumes you don't have git, and you need git to clone the repo.
Note: there's a bit chicken/egg situation, because settler assumes you don't have git,
and you need git to clone the repo. This will change soon™.
## Interesting files and locations
### Special folders
| Path | Description |
|--------------------|-------------------------------------------------------------------------------------|
| `.github` | GitHub Repository configuration files. Not part of the dotfiles per se. |
| `host-{hostname}/` | Host specific dotfiles. Configurations that should apply to that host only. |
| `local/bin` | Helper scripts that I've collected or wrote to make life easier. |
| `scripts` | Setup scripts. Some can be run many times, some are meant only for the first round. |
### dotfile folders
| Repo | Destination | Description |
|-----------|-------------|------------------------------------------------------------------|
| `config/` | `.config/` | Configurations for applications. |
| `local/` | `.local/` | XDG Base folder, contains `bin`, `share` and `state` for example |
| `ssh/` | `.ssh/` | SSH Configurations. |
### dfm - the dotfiles manager
`dfm` is a shellscript that has some tools that help with dotfiles management.
`.local/bin/dfm` is a shell script that has some tools that help with dotfiles management.
### `scripts/install.sh` - dotfiles linker
The `scripts/install.sh` is a `rcm` generated shell script that does all the necessary linking.
To refresh the file, you can run `dfm dotfiles update`
## Configuration
The folder structure follows [XDG Base Directory Specification][xdg] where possible.
### XDG Variables
| Var | Default |

View File

@@ -81,15 +81,15 @@ function section_dotfiles
case "$1" in
link)
rcup -B "$HOSTNAME" -v && echo "🎉 Done!"
rcup -B "$HOSTNAME" -f -v && echo "🎉 Done!"
;;
update)
# Updates .dotfiles/scripts/install.sh and formats it
rcup -B 0 -g \
| tee "$INSTALL_SCRIPT" 1> /dev/null \
&& shfmt -w -l "$INSTALL_SCRIPT" \
&& sed -i '' "s|$HOME|\$HOME|g" "$INSTALL_SCRIPT" \
&& echo "🎉 Done!"
&& sed -i '' "s|$HOME|\$HOME|g" "$INSTALL_SCRIPT"
$0 dotfiles shfmt
echo "🎉 Done!"
;;
shfmt)
# Format shell scripts according to following rules.

View File

@@ -6,14 +6,15 @@
# Originally from: https://www.commandlinefu.com/commands/view/8951
# Original author: https://www.commandlinefu.com/commands/by/wickedcpj
#
echo 'User: Command: Port:'
echo '====================================================='
echo 'User: Command: PID: Port:'
echo '========================================================='
lsof -i 4 -P -n +c 0 \
| grep -i 'listen' \
| awk '{print $3, $1, $9}' \
| awk '{print $3, $1, $2, $9}' \
| sed 's/ [a-z0-9\.\*]*:/ /' \
| sort -k 3 -n \
| xargs printf '%-20s %-25s %-5s\n' | uniq
| xargs printf '%-15s %-25s %-8s %-5s\n' \
| uniq
echo ""

View File

@@ -79,6 +79,7 @@ handle_file_ln "$HOME/.dotfiles/git_profiles" "$HOME/.git_profiles"
handle_file_ln "$HOME/.dotfiles/huskyrc" "$HOME/.huskyrc"
handle_file_ln "$HOME/.dotfiles/local/bin/antigen.zsh" "$HOME/.local/bin/antigen.zsh"
handle_file_ln "$HOME/.dotfiles/local/bin/dfm" "$HOME/.local/bin/dfm"
handle_file_ln "$HOME/.dotfiles/local/bin/foreach" "$HOME/.local/bin/foreach"
handle_file_ln "$HOME/.dotfiles/local/bin/x-check-git-attributes" "$HOME/.local/bin/x-check-git-attributes"
handle_file_ln "$HOME/.dotfiles/local/bin/x-open-ports" "$HOME/.local/bin/x-open-ports"
handle_file_ln "$HOME/.dotfiles/rcrc" "$HOME/.rcrc"