@sebastienrousseau/dotfiles 0.2.468 → 0.2.469
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/Makefile +126 -43
- package/dist/bin/constants.d.ts +2 -2
- package/dist/bin/constants.d.ts.map +1 -1
- package/dist/bin/constants.js +1 -1
- package/dist/filesizes.txt +146 -144
- package/dist/lib/README.md +79 -5
- package/dist/lib/aliases/README.md +44 -42
- package/dist/lib/aliases/archives/README.md +120 -34
- package/dist/lib/aliases/archives/archives.aliases.sh +106 -149
- package/dist/lib/aliases/cd/README.md +119 -38
- package/dist/lib/aliases/cd/cd.aliases.sh +37 -59
- package/dist/lib/aliases/chmod/README.md +146 -95
- package/dist/lib/aliases/chmod/chmod.aliases.sh +71 -55
- package/dist/lib/aliases/clear/README.md +2 -2
- package/dist/lib/aliases/clear/clear.aliases.sh +4 -4
- package/dist/lib/aliases/configuration/README.md +2 -2
- package/dist/lib/aliases/configuration/configuration.aliases.sh +3 -6
- package/dist/lib/aliases/default/README.md +2 -2
- package/dist/lib/aliases/default/default.aliases.sh +3 -3
- package/dist/lib/aliases/dig/README.md +2 -2
- package/dist/lib/aliases/dig/dig.aliases.sh +4 -4
- package/dist/lib/aliases/disk-usage/README.md +2 -2
- package/dist/lib/aliases/disk-usage/du.aliases.sh +2 -2
- package/dist/lib/aliases/editor/README.md +2 -2
- package/dist/lib/aliases/editor/editor.aliases.sh +4 -4
- package/dist/lib/aliases/find/README.md +2 -2
- package/dist/lib/aliases/find/find.aliases.sh +4 -4
- package/dist/lib/aliases/gcloud/README.md +2 -2
- package/dist/lib/aliases/gcloud/gcloud.aliases.sh +4 -4
- package/dist/lib/aliases/git/README.md +2 -2
- package/dist/lib/aliases/git/git.aliases.sh +3 -3
- package/dist/lib/aliases/gnu/README.md +2 -2
- package/dist/lib/aliases/gnu/gnucoreutils-aliases.sh +2 -2
- package/dist/lib/aliases/heroku/README.md +2 -2
- package/dist/lib/aliases/heroku/heroku.aliases.sh +3 -3
- package/dist/lib/aliases/interactive/README.md +2 -2
- package/dist/lib/aliases/interactive/interactive.aliases.sh +3 -3
- package/dist/lib/aliases/list/README.md +112 -23
- package/dist/lib/aliases/list/list.aliases.sh +130 -84
- package/dist/lib/aliases/macOS/README.md +2 -2
- package/dist/lib/aliases/macOS/macos.aliases.sh +3 -3
- package/dist/lib/aliases/make/README.md +2 -2
- package/dist/lib/aliases/make/make.aliases.sh +3 -3
- package/dist/lib/aliases/mkdir/README.md +2 -2
- package/dist/lib/aliases/mkdir/mkdir.aliases.sh +3 -3
- package/dist/lib/aliases/npm/README.md +2 -2
- package/dist/lib/aliases/npm/npm.aliases.sh +3 -3
- package/dist/lib/aliases/permission/README.md +2 -2
- package/dist/lib/aliases/permission/permission.aliases.sh +3 -3
- package/dist/lib/aliases/pnpm/README.md +2 -2
- package/dist/lib/aliases/pnpm/pnpm.aliases.sh +3 -3
- package/dist/lib/aliases/ps/README.md +2 -2
- package/dist/lib/aliases/ps/ps.aliases.sh +3 -3
- package/dist/lib/aliases/python/python.aliases.sh +141 -0
- package/dist/lib/aliases/rsync/README.md +2 -2
- package/dist/lib/aliases/rsync/rsync.aliases.sh +3 -3
- package/dist/lib/aliases/rust/README.md +165 -44
- package/dist/lib/aliases/rust/rust.aliases.sh +109 -117
- package/dist/lib/aliases/subversion/README.md +2 -2
- package/dist/lib/aliases/subversion/subversion.aliases.sh +3 -3
- package/dist/lib/aliases/sudo/README.md +2 -2
- package/dist/lib/aliases/sudo/sudo.aliases.sh +3 -3
- package/dist/lib/aliases/tmux/README.md +2 -2
- package/dist/lib/aliases/tmux/tmux.aliases.sh +3 -3
- package/dist/lib/aliases/update/README.md +2 -2
- package/dist/lib/aliases/update/update.aliases.sh +307 -66
- package/dist/lib/aliases/uuid/README.md +2 -2
- package/dist/lib/aliases/uuid/uuid.aliases.sh +3 -3
- package/dist/lib/aliases/wget/README.md +2 -2
- package/dist/lib/aliases/wget/wget.aliases.sh +3 -3
- package/dist/lib/aliases.sh +2 -2
- package/dist/lib/configurations/README.md +2 -2
- package/dist/lib/configurations/bash/bashrc +163 -35
- package/dist/lib/configurations/curl/curlrc +3 -6
- package/dist/lib/configurations/default/color.sh +3 -3
- package/dist/lib/configurations/default/constants.sh +4 -4
- package/dist/lib/configurations/default/editor.sh +3 -3
- package/dist/lib/configurations/default/prompt.sh +20 -11
- package/dist/lib/configurations/input/inputrc +3 -3
- package/dist/lib/configurations/nano/nanorc +3 -3
- package/dist/lib/configurations/profile/profile +3 -3
- package/dist/lib/configurations/prompt/prompt.sh +81 -0
- package/dist/lib/configurations/tmux/default +3 -3
- package/dist/lib/configurations/tmux/display +3 -3
- package/dist/lib/configurations/tmux/linux +3 -3
- package/dist/lib/configurations/tmux/navigation +3 -3
- package/dist/lib/configurations/tmux/panes +3 -3
- package/dist/lib/configurations/tmux/theme +4 -4
- package/dist/lib/configurations/tmux/tmux +3 -3
- package/dist/lib/configurations/vim/vimrc +191 -71
- package/dist/lib/configurations/wget/wgetrc +3 -3
- package/dist/lib/configurations/zsh/zshrc +3 -4
- package/dist/lib/configurations.sh +19 -7
- package/dist/lib/functions/README.md +68 -54
- package/dist/lib/functions/apihealth.sh +277 -0
- package/dist/lib/functions/apilatency.sh +157 -0
- package/dist/lib/functions/apiload.sh +165 -0
- package/dist/lib/functions/backup.sh +143 -0
- package/dist/lib/functions/cdls.sh +52 -6
- package/dist/lib/functions/curlheader.sh +66 -10
- package/dist/lib/functions/curlstatus.sh +64 -7
- package/dist/lib/functions/curltime.sh +56 -14
- package/dist/lib/functions/encode64.sh +87 -7
- package/dist/lib/functions/environment.sh +65 -25
- package/dist/lib/functions/extract.sh +79 -27
- package/dist/lib/functions/freespace.sh +55 -9
- package/dist/lib/functions/genpwd.sh +93 -29
- package/dist/lib/functions/goto.sh +59 -8
- package/dist/lib/functions/hexdump.sh +96 -0
- package/dist/lib/functions/hiddenfiles.sh +77 -0
- package/dist/lib/functions/hostinfo.sh +92 -21
- package/dist/lib/functions/hstats.sh +69 -5
- package/dist/lib/functions/httpdebug.sh +109 -5
- package/dist/lib/functions/kebabcase.sh +61 -0
- package/dist/lib/functions/keygen.sh +188 -25
- package/dist/lib/functions/last.sh +106 -5
- package/dist/lib/functions/logout.sh +114 -6
- package/dist/lib/functions/lowercase.sh +49 -17
- package/dist/lib/functions/matrix.sh +205 -30
- package/dist/lib/functions/mount_read_only.sh +3 -3
- package/dist/lib/functions/myproc.sh +3 -3
- package/dist/lib/functions/prependpath.sh +3 -3
- package/dist/lib/functions/ql.sh +3 -3
- package/dist/lib/functions/rd.sh +3 -3
- package/dist/lib/functions/remove_disk.sh +3 -3
- package/dist/lib/functions/ren.sh +68 -8
- package/dist/lib/functions/sentencecase.sh +63 -0
- package/dist/lib/functions/showhiddenfiles.sh +3 -3
- package/dist/lib/functions/size.sh +6 -5
- package/dist/lib/functions/snakecase.sh +61 -0
- package/dist/lib/functions/stopwatch.sh +3 -3
- package/dist/lib/functions/sysinfo.sh +145 -0
- package/dist/lib/functions/titlecase.sh +65 -0
- package/dist/lib/functions/uppercase.sh +51 -19
- package/dist/lib/functions/view-source.sh +3 -3
- package/dist/lib/functions/vscode.sh +3 -3
- package/dist/lib/functions/whoisport.sh +3 -3
- package/dist/lib/functions/zipf.sh +3 -3
- package/dist/lib/functions.sh +21 -7
- package/dist/lib/history.sh +36 -88
- package/dist/lib/paths/README.md +52 -0
- package/dist/lib/paths/custom.paths.sh +40 -0
- package/dist/lib/paths/default.paths.sh +37 -0
- package/dist/lib/paths.sh +27 -14
- package/dist/scripts/backup.sh +3 -3
- package/dist/scripts/banner.sh +3 -3
- package/dist/scripts/build.sh +3 -3
- package/dist/scripts/clean.sh +3 -3
- package/dist/scripts/compile.sh +3 -3
- package/dist/scripts/copy.sh +3 -3
- package/dist/scripts/dotfiles.sh +3 -3
- package/dist/scripts/download.sh +3 -3
- package/dist/scripts/help.sh +3 -3
- package/dist/scripts/ssh.sh +3 -3
- package/dist/scripts/unpack.sh +3 -3
- package/package.json +10 -10
- package/dist/lib/aliases/jekyll/README.md +0 -41
- package/dist/lib/aliases/jekyll/jekyll.aliases.sh +0 -54
- package/dist/lib/functions/filehead.sh +0 -4
- package/dist/lib/functions/hidehiddenfiles.sh +0 -14
- package/dist/lib/paths/ant/ant.paths.sh +0 -15
- package/dist/lib/paths/default/default.paths.sh +0 -19
- package/dist/lib/paths/homebrew/homebrew.paths.sh +0 -27
- package/dist/lib/paths/java/java.paths.sh +0 -19
- package/dist/lib/paths/maven/maven.paths.sh +0 -18
- package/dist/lib/paths/node/node.paths.sh +0 -15
- package/dist/lib/paths/nvm/nvm.paths.sh +0 -23
- package/dist/lib/paths/pnpm/pnpm.paths.sh +0 -15
- package/dist/lib/paths/python/python.paths.sh +0 -36
- package/dist/lib/paths/ruby/ruby.paths.sh +0 -25
- package/dist/lib/paths/tmux/tmux.paths.sh +0 -12
|
@@ -1,27 +1,98 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
#
|
|
3
|
+
################################################################################
|
|
4
|
+
# 🅳🅾🆃🅵🅸🅻🅴🆂 - Host Information Viewer (hostinfo)
|
|
5
|
+
# Made with ♥ by Sebastien Rousseau
|
|
6
6
|
# License: MIT
|
|
7
|
+
#
|
|
8
|
+
# Description:
|
|
9
|
+
# hostinfo is a utility function to display detailed information about the
|
|
10
|
+
# current host in a structured table format. This includes system stats,
|
|
11
|
+
# network configuration, and public-facing IP address.
|
|
12
|
+
#
|
|
13
|
+
# Usage:
|
|
14
|
+
# hostinfo
|
|
15
|
+
# hostinfo --help
|
|
16
|
+
#
|
|
17
|
+
# Arguments:
|
|
18
|
+
# --help Displays this help menu and exits.
|
|
19
|
+
#
|
|
20
|
+
# Examples:
|
|
21
|
+
# hostinfo
|
|
22
|
+
# # Displays detailed host information in a table format.
|
|
23
|
+
#
|
|
24
|
+
# hostinfo --help
|
|
25
|
+
# # Displays the help menu.
|
|
26
|
+
#
|
|
27
|
+
################################################################################
|
|
7
28
|
|
|
8
|
-
# hostinfo: Function to display useful host related informaton
|
|
9
29
|
hostinfo() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
# Display help menu
|
|
31
|
+
if [[ "$1" == "--help" ]]; then
|
|
32
|
+
echo "hostinfo: Host Information Viewer"
|
|
33
|
+
echo
|
|
34
|
+
echo "Usage:"
|
|
35
|
+
echo " hostinfo"
|
|
36
|
+
echo " hostinfo --help"
|
|
37
|
+
echo
|
|
38
|
+
echo "Arguments:"
|
|
39
|
+
echo " --help Displays this help menu and exits."
|
|
40
|
+
echo
|
|
41
|
+
echo "Examples:"
|
|
42
|
+
echo " hostinfo"
|
|
43
|
+
echo " # Displays detailed host information in a table format."
|
|
44
|
+
echo
|
|
45
|
+
echo " hostinfo --help"
|
|
46
|
+
echo " # Displays the help menu."
|
|
47
|
+
echo
|
|
48
|
+
return 0
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
# Fetch host information
|
|
52
|
+
local username
|
|
53
|
+
local hostname
|
|
54
|
+
local system_info
|
|
55
|
+
local users_logged_on
|
|
56
|
+
local current_date
|
|
57
|
+
local machine_stats
|
|
58
|
+
local network_location="Not available"
|
|
59
|
+
local public_ip="Not available"
|
|
60
|
+
local dns_config="Not available"
|
|
61
|
+
|
|
62
|
+
username=$(whoami)
|
|
63
|
+
hostname=$(hostname)
|
|
64
|
+
system_info=$(uname -a)
|
|
65
|
+
users_logged_on=$(w -h | awk '{print $1}' | sort | uniq | paste -sd ", " -)
|
|
66
|
+
current_date=$(date)
|
|
67
|
+
machine_stats=$(uptime | sed 's/^ *//')
|
|
68
|
+
|
|
69
|
+
# Check if scselect is available (macOS specific)
|
|
70
|
+
if command -v scselect &>/dev/null; then
|
|
71
|
+
network_location=$(scselect | grep '^ *\*' | sed 's/^ *\* //')
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
# Fetch public IP address using a reliable service
|
|
75
|
+
if command -v curl &>/dev/null; then
|
|
76
|
+
public_ip=$(curl -s https://api.ipify.org || echo "Not available")
|
|
77
|
+
elif command -v wget &>/dev/null; then
|
|
78
|
+
public_ip=$(wget -qO- https://api.ipify.org || echo "Not available")
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
# Fetch DNS configuration (macOS specific)
|
|
82
|
+
if command -v scutil &>/dev/null; then
|
|
83
|
+
dns_config=$(scutil --dns | awk '/nameserver/ {print $3}' | paste -sd ", " -)
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
# Display information in a table format
|
|
87
|
+
echo "====================================="
|
|
88
|
+
printf "%-25s : %s\n" "Username" "$username"
|
|
89
|
+
printf "%-25s : %s\n" "Hostname" "$hostname"
|
|
90
|
+
printf "%-25s : %s\n" "System Information" "$system_info"
|
|
91
|
+
printf "%-25s : %s\n" "Users Logged On" "${users_logged_on:-None}"
|
|
92
|
+
printf "%-25s : %s\n" "Current Date" "$current_date"
|
|
93
|
+
printf "%-25s : %s\n" "Machine Stats" "$machine_stats"
|
|
94
|
+
printf "%-25s : %s\n" "Network Location" "$network_location"
|
|
95
|
+
printf "%-25s : %s\n" "Public IP Address" "$public_ip"
|
|
96
|
+
printf "%-25s : %s\n" "DNS Servers" "${dns_config:-None}"
|
|
97
|
+
echo "====================================="
|
|
27
98
|
}
|
|
@@ -1,11 +1,75 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
#
|
|
3
|
+
################################################################################
|
|
4
|
+
# 🅳🅾🆃🅵🅸🅻🅴🆂 - History Statistics Viewer (hstats)
|
|
5
|
+
# Made with ♥ by Sebastien Rousseau
|
|
6
6
|
# License: MIT
|
|
7
|
+
#
|
|
8
|
+
# Description:
|
|
9
|
+
# hstats is a utility function to display statistics about the most commonly
|
|
10
|
+
# used commands from the shell history. It shows the top 20 commands along
|
|
11
|
+
# with their usage count and the full command.
|
|
12
|
+
#
|
|
13
|
+
# Usage:
|
|
14
|
+
# hstats
|
|
15
|
+
# hstats --help
|
|
16
|
+
#
|
|
17
|
+
# Arguments:
|
|
18
|
+
# --help Displays this help menu and exits.
|
|
19
|
+
#
|
|
20
|
+
# Examples:
|
|
21
|
+
# hstats
|
|
22
|
+
# # Displays the top 20 most commonly used commands from shell history.
|
|
23
|
+
#
|
|
24
|
+
# hstats --help
|
|
25
|
+
# # Displays the help menu.
|
|
26
|
+
#
|
|
27
|
+
################################################################################
|
|
7
28
|
|
|
8
|
-
# hstats: Function to display Ze Shell history stats informaton
|
|
9
29
|
hstats() {
|
|
10
|
-
|
|
30
|
+
# Display help menu
|
|
31
|
+
if [[ "$1" == "--help" ]]; then
|
|
32
|
+
echo "hstats: History Statistics Viewer"
|
|
33
|
+
echo
|
|
34
|
+
echo "Usage:"
|
|
35
|
+
echo " hstats"
|
|
36
|
+
echo " hstats --help"
|
|
37
|
+
echo
|
|
38
|
+
echo "Arguments:"
|
|
39
|
+
echo " --help Displays this help menu and exits."
|
|
40
|
+
echo
|
|
41
|
+
echo "Examples:"
|
|
42
|
+
echo " hstats"
|
|
43
|
+
echo " # Displays the top 20 most commonly used commands from shell history."
|
|
44
|
+
echo
|
|
45
|
+
echo " hstats --help"
|
|
46
|
+
echo " # Displays the help menu."
|
|
47
|
+
echo
|
|
48
|
+
return 0
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
# Ensure the history command is available
|
|
52
|
+
if ! command -v history &>/dev/null; then
|
|
53
|
+
echo "[ERROR] 'history' command is not available in this shell." >&2
|
|
54
|
+
return 1
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
# Extract only the commands from history, removing timestamps or extra metadata
|
|
58
|
+
if [[ "$SHELL" =~ "zsh" ]]; then
|
|
59
|
+
# For zsh, use `fc -l` to get clean commands
|
|
60
|
+
history_output=$(fc -l 1 | awk '{$1=""; print $0}')
|
|
61
|
+
else
|
|
62
|
+
# For bash, use `history` directly
|
|
63
|
+
history_output=$(history | awk '{$1=""; print $0}')
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
# Generate statistics
|
|
67
|
+
echo "============================================"
|
|
68
|
+
echo "Commonly Used Commands"
|
|
69
|
+
echo "============================================"
|
|
70
|
+
echo "$history_output" | awk '{CMD[$1]++; count++;} END {for (a in CMD) printf "%-15s %s\n", CMD[a], a;}' \
|
|
71
|
+
| sort -nr \
|
|
72
|
+
| head -n20 \
|
|
73
|
+
| nl
|
|
74
|
+
echo "============================================"
|
|
11
75
|
}
|
|
@@ -1,9 +1,113 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
#
|
|
3
|
+
################################################################################
|
|
4
|
+
# 🅳🅾🆃🅵🅸🅻🅴🆂 - HTTP Debugging Utility (httpdebug)
|
|
5
|
+
# Made with ♥ by Sebastien Rousseau
|
|
6
6
|
# License: MIT
|
|
7
|
+
#
|
|
8
|
+
# Description:
|
|
9
|
+
# httpdebug is a utility function to debug HTTP requests by measuring the
|
|
10
|
+
# timing of various stages of the request process in milliseconds. This
|
|
11
|
+
# includes DNS lookup, connection establishment, SSL handshake, and total
|
|
12
|
+
# request time. It also provides details like the server IP address.
|
|
13
|
+
#
|
|
14
|
+
# Usage:
|
|
15
|
+
# httpdebug [options] [url]
|
|
16
|
+
# httpdebug --help
|
|
17
|
+
#
|
|
18
|
+
# Arguments:
|
|
19
|
+
# options Additional curl options (optional).
|
|
20
|
+
# url The URL to debug.
|
|
21
|
+
# --help Displays this help menu and exits.
|
|
22
|
+
#
|
|
23
|
+
# Examples:
|
|
24
|
+
# httpdebug https://example.com
|
|
25
|
+
# # Debugs the HTTP request to https://example.com and displays timing info.
|
|
26
|
+
#
|
|
27
|
+
# httpdebug -v https://example.com
|
|
28
|
+
# # Debugs the HTTP request with verbose output from curl.
|
|
29
|
+
#
|
|
30
|
+
# httpdebug --help
|
|
31
|
+
# # Displays the help menu.
|
|
32
|
+
#
|
|
33
|
+
################################################################################
|
|
34
|
+
|
|
35
|
+
httpdebug() {
|
|
36
|
+
# Display help menu
|
|
37
|
+
if [[ "$1" == "--help" ]]; then
|
|
38
|
+
echo "httpdebug: HTTP Debugging Utility"
|
|
39
|
+
echo
|
|
40
|
+
echo "Usage:"
|
|
41
|
+
echo " httpdebug [options] [url]"
|
|
42
|
+
echo " httpdebug --help"
|
|
43
|
+
echo
|
|
44
|
+
echo "Arguments:"
|
|
45
|
+
echo " options Additional curl options (optional)."
|
|
46
|
+
echo " url The URL to debug."
|
|
47
|
+
echo " --help Displays this help menu and exits."
|
|
48
|
+
echo
|
|
49
|
+
echo "Examples:"
|
|
50
|
+
echo " httpdebug https://example.com"
|
|
51
|
+
echo " # Debugs the HTTP request to https://example.com and displays timing info."
|
|
52
|
+
echo
|
|
53
|
+
echo " httpdebug -v https://example.com"
|
|
54
|
+
echo " # Debugs the HTTP request with verbose output from curl."
|
|
55
|
+
echo
|
|
56
|
+
echo " httpdebug --help"
|
|
57
|
+
echo " # Displays the help menu."
|
|
58
|
+
echo
|
|
59
|
+
return 0
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
# Ensure curl is available
|
|
63
|
+
if ! command -v curl &>/dev/null; then
|
|
64
|
+
echo "[ERROR] 'curl' command is required but not installed. Please install it and try again." >&2
|
|
65
|
+
return 1
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
# Check if a URL or options are provided
|
|
69
|
+
if [[ -z "$1" ]]; then
|
|
70
|
+
echo "[ERROR] No URL provided. Use 'httpdebug --help' for usage information." >&2
|
|
71
|
+
return 1
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
# Perform HTTP request and measure timing
|
|
75
|
+
echo "[INFO] Debugging HTTP request to: ${*}"
|
|
76
|
+
curl_output=$(/usr/bin/curl "$@" -o /dev/null -s -w "\
|
|
77
|
+
IP Address: %{remote_ip}\n\
|
|
78
|
+
DNS Lookup: %{time_namelookup}\n\
|
|
79
|
+
TCP Connection: %{time_connect}\n\
|
|
80
|
+
SSL Handshake: %{time_appconnect}\n\
|
|
81
|
+
Server Processing: %{time_pretransfer}\n\
|
|
82
|
+
Time to First Byte: %{time_starttransfer}\n\
|
|
83
|
+
Total Time: %{time_total}\n")
|
|
84
|
+
|
|
85
|
+
# Display results in a clean table format
|
|
86
|
+
printf "%-25s %-25s %-45s\n" "Metric" "Details" "Description"
|
|
87
|
+
printf "%-25s %-25s %-45s\n" "------------------------" "------------------------" "---------------------------------------------"
|
|
88
|
+
|
|
89
|
+
echo "$curl_output" | while IFS= read -r line; do
|
|
90
|
+
metric=$(echo "$line" | awk -F: '{print $1}')
|
|
91
|
+
value=$(echo "$line" | awk -F: '{print $2}' | xargs)
|
|
92
|
+
description=""
|
|
93
|
+
|
|
94
|
+
case "$metric" in
|
|
95
|
+
"IP Address") description="IP address of the server" ;;
|
|
96
|
+
"DNS Lookup") description="Time to resolve the domain name to an IP address" ;;
|
|
97
|
+
"TCP Connection") description="Time to establish a TCP connection to the server" ;;
|
|
98
|
+
"SSL Handshake") description="Time to complete the SSL/TLS handshake (if applicable)" ;;
|
|
99
|
+
"Server Processing") description="Time from connection to server readiness to transfer data" ;;
|
|
100
|
+
"Time to First Byte") description="Time until the first byte of the response is received" ;;
|
|
101
|
+
"Total Time") description="Total time for the request, including all stages" ;;
|
|
102
|
+
esac
|
|
103
|
+
|
|
104
|
+
if [[ "$metric" == "IP Address" ]]; then
|
|
105
|
+
printf "%-25s %-25s %-45s\n" "$metric" "$value" "$description"
|
|
106
|
+
else
|
|
107
|
+
# Convert time values to milliseconds for consistency
|
|
108
|
+
time_in_milliseconds=$(awk "BEGIN {printf \"%.2f\", $value * 1000}")
|
|
109
|
+
printf "%-25s %-25s %-45s\n" "$metric" "$time_in_milliseconds ms" "$description"
|
|
110
|
+
fi
|
|
111
|
+
done
|
|
112
|
+
}
|
|
7
113
|
|
|
8
|
-
# httpdebug: Function to download a web page and show info on what took time
|
|
9
|
-
httpdebug() { /usr/bin/curl "$@" -o /dev/null -w "dns: %{time_namelookup} connect: %{time_connect} pretransfer: %{time_pretransfer} starttransfer: %{time_starttransfer} total: %{time_total}\\n"; }
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
################################################################################
|
|
4
|
+
# 🅳🅾🆃🅵🅸🅻🅴🆂 - Cross-Platform Kebabcase Utility (kebabcase)
|
|
5
|
+
# Made with ♥ by Sebastien Rousseau
|
|
6
|
+
# License: MIT
|
|
7
|
+
#
|
|
8
|
+
# Description:
|
|
9
|
+
# kebabcase converts file or directory names to kebab-case. All letters
|
|
10
|
+
# are lowercase and spaces or other non-alphanumeric characters are replaced
|
|
11
|
+
# by hyphens.
|
|
12
|
+
#
|
|
13
|
+
# Usage:
|
|
14
|
+
# kebabcase <file_or_directory> [<file_or_directory> ...]
|
|
15
|
+
#
|
|
16
|
+
# Arguments:
|
|
17
|
+
# <file_or_directory> One or more file or directory paths to rename
|
|
18
|
+
# to kebab-case.
|
|
19
|
+
#
|
|
20
|
+
# Notes:
|
|
21
|
+
# - Already kebab-case files are skipped.
|
|
22
|
+
# - Non-existent paths will produce an error message.
|
|
23
|
+
# - Special characters (other than alphanumeric and '.') are replaced
|
|
24
|
+
# with hyphens.
|
|
25
|
+
#
|
|
26
|
+
################################################################################
|
|
27
|
+
|
|
28
|
+
kebabcase() {
|
|
29
|
+
if [[ "$#" -lt 1 ]]; then
|
|
30
|
+
echo "[ERROR] Please provide at least one file or directory to convert to kebab-case." >&2
|
|
31
|
+
return 1
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
for file in "$@"; do
|
|
35
|
+
if [[ ! -e "$file" ]]; then
|
|
36
|
+
echo "[ERROR] The file or directory '$file' does not exist." >&2
|
|
37
|
+
continue
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
dirname=$(dirname "$file")
|
|
41
|
+
filename=$(basename "$file")
|
|
42
|
+
|
|
43
|
+
# Convert to lowercase and replace non-alphanumeric chars (except '.') with hyphens
|
|
44
|
+
kc_filename=$(printf "%s" "$filename" \
|
|
45
|
+
| tr '[:upper:]' '[:lower:]' \
|
|
46
|
+
| sed 's/[^[:alnum:].]/-/g')
|
|
47
|
+
|
|
48
|
+
# If already kebab-case, skip
|
|
49
|
+
if [[ "$filename" == "$kc_filename" ]]; then
|
|
50
|
+
echo "[INFO] '$file' is already in kebab-case."
|
|
51
|
+
continue
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
newname="${dirname}/${kc_filename}"
|
|
55
|
+
if mv "$file" "$newname"; then
|
|
56
|
+
echo "[INFO] Renamed '$file' to '$newname'."
|
|
57
|
+
else
|
|
58
|
+
echo "[ERROR] Failed to rename '$file'." >&2
|
|
59
|
+
fi
|
|
60
|
+
done
|
|
61
|
+
}
|
|
@@ -1,31 +1,194 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
#
|
|
3
|
+
################################################################################
|
|
4
|
+
# 🅳🅾🆃🅵🅸🅻🅴🆂 - SSH Key Generator (keygen)
|
|
5
|
+
# Made with ♥ by Sebastien Rousseau
|
|
6
6
|
# License: MIT
|
|
7
|
+
#
|
|
8
|
+
# Description:
|
|
9
|
+
# keygen is a utility function to generate high-quality SSH key pairs with
|
|
10
|
+
# strong encryption and entropy. Supports ed25519, RSA, ECDSA, and DSA keys
|
|
11
|
+
# with configurable key lengths.
|
|
12
|
+
#
|
|
13
|
+
# Usage:
|
|
14
|
+
# keygen [name] [email] [type] [bits]
|
|
15
|
+
# keygen --help
|
|
16
|
+
#
|
|
17
|
+
# Arguments:
|
|
18
|
+
# name The name for the SSH key (e.g., username, service name)
|
|
19
|
+
# email The email address associated with the key
|
|
20
|
+
# type Key type (ed25519, rsa, ecdsa, dsa). Default: ed25519
|
|
21
|
+
# bits Key length in bits (RSA: 2048-8192, ECDSA: 256/384/521)
|
|
22
|
+
# --help Displays this help menu and exits
|
|
23
|
+
#
|
|
24
|
+
################################################################################
|
|
25
|
+
|
|
26
|
+
log_info() {
|
|
27
|
+
echo "[INFO] $*"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
log_warning() {
|
|
31
|
+
echo "[WARNING] $*" >&2
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
log_error() {
|
|
35
|
+
echo "[ERROR] $*" >&2
|
|
36
|
+
exit 1
|
|
37
|
+
}
|
|
7
38
|
|
|
8
|
-
# keygen: Function to generates SSH key
|
|
9
39
|
keygen() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
# Display help menu
|
|
41
|
+
if [[ "$1" == "--help" ]]; then
|
|
42
|
+
cat << 'EOH'
|
|
43
|
+
SSH Key Generator (keygen)
|
|
44
|
+
|
|
45
|
+
Description:
|
|
46
|
+
keygen is a utility function to generate high-quality SSH key pairs with
|
|
47
|
+
strong encryption and entropy. Supports ed25519, RSA, ECDSA, and DSA keys
|
|
48
|
+
with configurable key lengths.
|
|
49
|
+
|
|
50
|
+
Usage:
|
|
51
|
+
keygen [name] [email] [type] [bits]
|
|
52
|
+
keygen --help
|
|
53
|
+
|
|
54
|
+
Arguments:
|
|
55
|
+
name The name for the SSH key (e.g., username, service name).
|
|
56
|
+
This name is used to create a unique file path for the key.
|
|
57
|
+
email The email address associated with the key.
|
|
58
|
+
type Key type (ed25519, rsa, ecdsa, dsa). Default: ed25519.
|
|
59
|
+
bits Key length in bits:
|
|
60
|
+
- RSA: 2048-8192 bits (default: 4096).
|
|
61
|
+
- ECDSA: 256, 384, or 521 bits (default: 256).
|
|
62
|
+
- DSA: 1024, 2048, or 3072 bits (default: 3072).
|
|
63
|
+
- ED25519: Fixed length.
|
|
64
|
+
--help Displays this help menu and exits.
|
|
65
|
+
|
|
66
|
+
Examples:
|
|
67
|
+
keygen
|
|
68
|
+
# Interactive mode with prompts.
|
|
69
|
+
|
|
70
|
+
keygen mykey myemail@example.com
|
|
71
|
+
# Generates an ed25519 key pair named 'mykey'.
|
|
72
|
+
|
|
73
|
+
keygen mykey myemail@example.com rsa 4096
|
|
74
|
+
# Generates a 4096-bit RSA key pair named 'mykey'.
|
|
75
|
+
|
|
76
|
+
keygen mykey myemail@example.com ecdsa 256
|
|
77
|
+
# Generates a 256-bit ECDSA key pair named 'mykey'.
|
|
78
|
+
|
|
79
|
+
keygen mykey myemail@example.com dsa 1024
|
|
80
|
+
# Generates a 1024-bit DSA key pair named 'mykey'.
|
|
81
|
+
|
|
82
|
+
Notes:
|
|
83
|
+
- Keys are stored in ~/.ssh with the specified name.
|
|
84
|
+
- Public keys are copied to the clipboard for convenience.
|
|
85
|
+
- The private key is never exposed; keep it secure.
|
|
86
|
+
|
|
87
|
+
EOH
|
|
88
|
+
return 0
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
# Ensure ~/.ssh directory exists
|
|
92
|
+
mkdir -p -m 700 ~/.ssh || log_error "Failed to create ~/.ssh directory."
|
|
93
|
+
|
|
94
|
+
# Collect inputs
|
|
95
|
+
local name email key_type key_bits
|
|
96
|
+
if [[ $# -eq 0 ]]; then
|
|
97
|
+
echo "Enter a unique name for the SSH key (e.g., 'myserver' or 'username'):"
|
|
98
|
+
read -r name
|
|
99
|
+
echo "Enter an email address associated with the key:"
|
|
100
|
+
read -r email
|
|
101
|
+
echo "Enter key type (ed25519, rsa, ecdsa, dsa) [default: ed25519]:"
|
|
102
|
+
read -r key_type
|
|
103
|
+
key_type="${key_type:-ed25519}"
|
|
104
|
+
|
|
105
|
+
if [[ "${key_type}" != "ed25519" ]]; then
|
|
106
|
+
case "${key_type}" in
|
|
107
|
+
"rsa") echo "Enter RSA key length (2048-8192) [default: 4096]:" && read -r key_bits ;;
|
|
108
|
+
"ecdsa") echo "Enter ECDSA key length (256/384/521) [default: 256]:" && read -r key_bits ;;
|
|
109
|
+
"dsa") echo "Enter DSA key length (1024/2048/3072) [default: 3072]:" && read -r key_bits ;;
|
|
110
|
+
*) log_error "Invalid key type: ${key_type}" ;;
|
|
111
|
+
esac
|
|
112
|
+
fi
|
|
113
|
+
elif [[ $# -ge 2 ]]; then
|
|
114
|
+
name="$1"
|
|
115
|
+
email="$2"
|
|
116
|
+
key_type="${3:-ed25519}"
|
|
117
|
+
key_bits="$4"
|
|
118
|
+
else
|
|
119
|
+
log_error "Usage: keygen [name] [email] [type] [bits] or keygen --help"
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
# Validate inputs
|
|
123
|
+
[[ ! "${name}" =~ ^[a-zA-Z0-9_-]+$ ]] && log_error "Invalid name format. Only alphanumeric, _, and - are allowed."
|
|
124
|
+
[[ ! "${email}" =~ ^[^@]+@[^@]+\.[^@]+$ ]] && log_error "Invalid email format."
|
|
125
|
+
|
|
126
|
+
# Key validation
|
|
127
|
+
key_type="${key_type:-ed25519}"
|
|
128
|
+
case "${key_type}" in
|
|
129
|
+
"ed25519") ;;
|
|
130
|
+
"rsa")
|
|
131
|
+
key_bits="${key_bits:-4096}"
|
|
132
|
+
[[ ! "${key_bits}" =~ ^[0-9]+$ ]] && log_error "RSA key length must be a number."
|
|
133
|
+
[[ "${key_bits}" -lt 2048 || "${key_bits}" -gt 8192 ]] && log_error "RSA key length must be between 2048 and 8192 bits."
|
|
134
|
+
;;
|
|
135
|
+
"ecdsa")
|
|
136
|
+
key_bits="${key_bits:-256}"
|
|
137
|
+
[[ ! "${key_bits}" =~ ^(256|384|521)$ ]] && log_error "ECDSA key length must be 256, 384, or 521 bits."
|
|
138
|
+
;;
|
|
139
|
+
"dsa")
|
|
140
|
+
key_bits="${key_bits:-3072}"
|
|
141
|
+
[[ ! "${key_bits}" =~ ^(1024|2048|3072)$ ]] && log_error "DSA key length must be 1024, 2048, or 3072 bits."
|
|
142
|
+
;;
|
|
143
|
+
*) log_error "Invalid key type: ${key_type}. Use 'ed25519', 'rsa', 'ecdsa', or 'dsa'." ;;
|
|
144
|
+
esac
|
|
145
|
+
|
|
146
|
+
# Set file paths
|
|
147
|
+
local key_path="${HOME}/.ssh/id_${key_type}_${name}"
|
|
148
|
+
|
|
149
|
+
# Generate key pair
|
|
150
|
+
log_info "Generating ${key_type} SSH key named '${name}'..."
|
|
151
|
+
if [[ "${key_type}" == "ed25519" ]]; then
|
|
152
|
+
ssh-keygen -t ed25519 -f "${key_path}" -C "${email}"
|
|
153
|
+
else
|
|
154
|
+
ssh-keygen -t "${key_type}" -b "${key_bits}" -f "${key_path}" -C "${email}"
|
|
155
|
+
fi
|
|
156
|
+
|
|
157
|
+
# Set permissions
|
|
158
|
+
chmod 600 "${key_path}" && chmod 644 "${key_path}.pub"
|
|
159
|
+
|
|
160
|
+
# Add to SSH agent
|
|
161
|
+
if ! ssh-add "${key_path}" &>/dev/null; then
|
|
162
|
+
log_warning "SSH agent not running. Start it and run 'ssh-add ${key_path}'."
|
|
163
|
+
fi
|
|
164
|
+
|
|
165
|
+
# Copy to clipboard
|
|
166
|
+
copy_to_clipboard "${key_path}.pub"
|
|
167
|
+
|
|
168
|
+
# Display success message
|
|
169
|
+
log_info "SSH key successfully generated!"
|
|
170
|
+
echo " Private key: ${key_path}"
|
|
171
|
+
echo " Public key: ${key_path}.pub"
|
|
172
|
+
|
|
173
|
+
# Display fingerprint
|
|
174
|
+
ssh-keygen -l -f "${key_path}.pub"
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
copy_to_clipboard() {
|
|
178
|
+
local pub_key_file="$1"
|
|
179
|
+
if command -v pbcopy &>/dev/null; then
|
|
180
|
+
pbcopy < "${pub_key_file}"
|
|
181
|
+
log_info "Public key copied to clipboard (macOS)."
|
|
182
|
+
elif command -v xclip &>/dev/null; then
|
|
183
|
+
xclip -selection clipboard < "${pub_key_file}"
|
|
184
|
+
log_info "Public key copied to clipboard (Linux)."
|
|
185
|
+
elif command -v wl-copy &>/dev/null; then
|
|
186
|
+
wl-copy < "${pub_key_file}"
|
|
187
|
+
log_info "Public key copied to clipboard (Wayland)."
|
|
188
|
+
elif command -v clip.exe &>/dev/null; then
|
|
189
|
+
clip.exe < "${pub_key_file}"
|
|
190
|
+
log_info "Public key copied to clipboard (Windows)."
|
|
191
|
+
else
|
|
192
|
+
log_warning "Clipboard tool not available. Public key not copied."
|
|
193
|
+
fi
|
|
31
194
|
}
|