@sebastienrousseau/dotfiles 0.2.469 → 0.2.499
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/docs/ARCHITECTURE.md +62 -0
- package/docs/COMPLIANCE.md +47 -0
- package/docs/COPYRIGHT +6 -0
- package/docs/OPERATIONS.md +103 -0
- package/docs/PLAN.md +161 -0
- package/docs/PR_DESCRIPTION.md +150 -0
- package/docs/ROADMAP.md +148 -0
- package/docs/ROADMAP_legacy.md +556 -0
- package/docs/SECURITY_CHECKLIST.md +25 -0
- package/docs/TASK.md +99 -0
- package/docs/WALKTHROUGH.md +46 -0
- package/package.json +64 -76
- package/scripts/backup.sh +142 -0
- package/{dist/scripts → scripts}/banner.sh +1 -1
- package/scripts/benchmark.sh +20 -0
- package/{dist/scripts → scripts}/build.sh +1 -1
- package/{dist/scripts → scripts}/clean.sh +1 -1
- package/{dist/scripts → scripts}/compile.sh +1 -1
- package/{dist/scripts → scripts}/copy.sh +1 -1
- package/scripts/detect-collisions.py +84 -0
- package/scripts/doctor.sh +79 -0
- package/{dist/scripts → scripts}/dotfiles.sh +1 -1
- package/{dist/scripts → scripts}/download.sh +1 -1
- package/{dist/scripts → scripts}/help.sh +1 -1
- package/scripts/lock-configs.sh +57 -0
- package/scripts/package.sh +46 -0
- package/{dist/scripts → scripts}/ssh.sh +1 -1
- package/scripts/teleport.sh +23 -0
- package/scripts/test-aliases.sh +25 -0
- package/scripts/test_smoke.sh +88 -0
- package/{dist/scripts → scripts}/unpack.sh +1 -1
- package/scripts/verify_state.sh +60 -0
- package/templates/projects/go/README.md +3 -0
- package/templates/projects/go/cmd/__PROJECT_NAME__/main.go +7 -0
- package/templates/projects/go/go.mod +3 -0
- package/templates/projects/node/README.md +3 -0
- package/templates/projects/node/package.json +10 -0
- package/templates/projects/node/src/index.js +2 -0
- package/templates/projects/python/README.md +3 -0
- package/templates/projects/python/pyproject.toml +10 -0
- package/templates/projects/python/src/__PROJECT_NAME__/__init__.py +1 -0
- package/templates/projects/python/tests/test_basic.py +2 -0
- package/LICENSE +0 -1283
- package/README.md +0 -398
- package/dist/Makefile +0 -140
- package/dist/bin/backup.d.ts +0 -3
- package/dist/bin/backup.d.ts.map +0 -1
- package/dist/bin/backup.js +0 -4
- package/dist/bin/backup.js.map +0 -1
- package/dist/bin/constants.d.ts +0 -7
- package/dist/bin/constants.d.ts.map +0 -1
- package/dist/bin/constants.js +0 -2
- package/dist/bin/constants.js.map +0 -1
- package/dist/bin/copy.d.ts +0 -3
- package/dist/bin/copy.d.ts.map +0 -1
- package/dist/bin/copy.js +0 -3
- package/dist/bin/copy.js.map +0 -1
- package/dist/bin/dotfiles.d.ts +0 -3
- package/dist/bin/dotfiles.d.ts.map +0 -1
- package/dist/bin/dotfiles.js +0 -2
- package/dist/bin/dotfiles.js.map +0 -1
- package/dist/bin/download.d.ts +0 -3
- package/dist/bin/download.d.ts.map +0 -1
- package/dist/bin/download.js +0 -2
- package/dist/bin/download.js.map +0 -1
- package/dist/bin/index.d.ts +0 -2
- package/dist/bin/index.d.ts.map +0 -1
- package/dist/bin/index.js +0 -1
- package/dist/bin/index.js.map +0 -1
- package/dist/bin/transfer.d.ts +0 -3
- package/dist/bin/transfer.d.ts.map +0 -1
- package/dist/bin/transfer.js +0 -4
- package/dist/bin/transfer.js.map +0 -1
- package/dist/bin/unpack.d.ts +0 -3
- package/dist/bin/unpack.d.ts.map +0 -1
- package/dist/bin/unpack.js +0 -3
- package/dist/bin/unpack.js.map +0 -1
- package/dist/filesizes.txt +0 -382
- package/dist/lib/README.md +0 -86
- package/dist/lib/aliases/README.md +0 -57
- package/dist/lib/aliases/archives/README.md +0 -145
- package/dist/lib/aliases/archives/archives.aliases.sh +0 -114
- package/dist/lib/aliases/cd/README.md +0 -146
- package/dist/lib/aliases/cd/cd.aliases.sh +0 -51
- package/dist/lib/aliases/chmod/README.md +0 -160
- package/dist/lib/aliases/chmod/chmod.aliases.sh +0 -107
- package/dist/lib/aliases/clear/README.md +0 -37
- package/dist/lib/aliases/clear/clear.aliases.sh +0 -71
- package/dist/lib/aliases/configuration/README.md +0 -39
- package/dist/lib/aliases/configuration/configuration.aliases.sh +0 -70
- package/dist/lib/aliases/default/README.md +0 -40
- package/dist/lib/aliases/default/default.aliases.sh +0 -139
- package/dist/lib/aliases/dig/README.md +0 -37
- package/dist/lib/aliases/dig/dig.aliases.sh +0 -43
- package/dist/lib/aliases/disk-usage/README.md +0 -36
- package/dist/lib/aliases/disk-usage/du.aliases.sh +0 -84
- package/dist/lib/aliases/editor/README.md +0 -53
- package/dist/lib/aliases/editor/editor.aliases.sh +0 -26
- package/dist/lib/aliases/find/README.md +0 -46
- package/dist/lib/aliases/find/find.aliases.sh +0 -60
- package/dist/lib/aliases/gcloud/README.md +0 -63
- package/dist/lib/aliases/gcloud/gcloud.aliases.sh +0 -335
- package/dist/lib/aliases/git/README.md +0 -153
- package/dist/lib/aliases/git/git.aliases.sh +0 -544
- package/dist/lib/aliases/gnu/README.md +0 -89
- package/dist/lib/aliases/gnu/gnucoreutils-aliases.sh +0 -150
- package/dist/lib/aliases/heroku/README.md +0 -430
- package/dist/lib/aliases/heroku/heroku.aliases.sh +0 -1053
- package/dist/lib/aliases/interactive/README.md +0 -55
- package/dist/lib/aliases/interactive/interactive.aliases.sh +0 -50
- package/dist/lib/aliases/list/README.md +0 -131
- package/dist/lib/aliases/list/list.aliases.sh +0 -132
- package/dist/lib/aliases/macOS/README.md +0 -42
- package/dist/lib/aliases/macOS/macos.aliases.sh +0 -65
- package/dist/lib/aliases/make/README.md +0 -32
- package/dist/lib/aliases/make/make.aliases.sh +0 -35
- package/dist/lib/aliases/mkdir/README.md +0 -30
- package/dist/lib/aliases/mkdir/mkdir.aliases.sh +0 -29
- package/dist/lib/aliases/npm/README.md +0 -41
- package/dist/lib/aliases/npm/npm.aliases.sh +0 -61
- package/dist/lib/aliases/permission/README.md +0 -47
- package/dist/lib/aliases/permission/permission.aliases.sh +0 -73
- package/dist/lib/aliases/pnpm/README.md +0 -53
- package/dist/lib/aliases/pnpm/pnpm.aliases.sh +0 -76
- package/dist/lib/aliases/ps/README.md +0 -29
- package/dist/lib/aliases/ps/ps.aliases.sh +0 -20
- package/dist/lib/aliases/python/python.aliases.sh +0 -141
- package/dist/lib/aliases/rsync/README.md +0 -25
- package/dist/lib/aliases/rsync/rsync.aliases.sh +0 -17
- package/dist/lib/aliases/rust/README.md +0 -182
- package/dist/lib/aliases/rust/rust.aliases.sh +0 -119
- package/dist/lib/aliases/subversion/README.md +0 -66
- package/dist/lib/aliases/subversion/subversion.aliases.sh +0 -47
- package/dist/lib/aliases/sudo/README.md +0 -27
- package/dist/lib/aliases/sudo/sudo.aliases.sh +0 -20
- package/dist/lib/aliases/tmux/README.md +0 -31
- package/dist/lib/aliases/tmux/tmux.aliases.sh +0 -36
- package/dist/lib/aliases/update/README.md +0 -38
- package/dist/lib/aliases/update/update.aliases.sh +0 -310
- package/dist/lib/aliases/uuid/README.md +0 -24
- package/dist/lib/aliases/uuid/uuid.aliases.sh +0 -19
- package/dist/lib/aliases/wget/README.md +0 -27
- package/dist/lib/aliases/wget/wget.aliases.sh +0 -22
- package/dist/lib/aliases.sh +0 -50
- package/dist/lib/configurations/README.md +0 -18
- package/dist/lib/configurations/bash/bashrc +0 -167
- package/dist/lib/configurations/curl/cacert.pem +0 -3460
- package/dist/lib/configurations/curl/curlrc +0 -53
- package/dist/lib/configurations/default/color.sh +0 -24
- package/dist/lib/configurations/default/constants.sh +0 -43
- package/dist/lib/configurations/default/editor.sh +0 -18
- package/dist/lib/configurations/default/prompt.sh +0 -48
- package/dist/lib/configurations/gem/gemrc +0 -9
- package/dist/lib/configurations/input/inputrc +0 -23
- package/dist/lib/configurations/jshint/jshintrc +0 -37
- package/dist/lib/configurations/nano/nanorc +0 -35
- package/dist/lib/configurations/profile/profile +0 -37
- package/dist/lib/configurations/prompt/prompt.sh +0 -81
- package/dist/lib/configurations/tmux/default +0 -18
- package/dist/lib/configurations/tmux/display +0 -30
- package/dist/lib/configurations/tmux/linux +0 -18
- package/dist/lib/configurations/tmux/navigation +0 -30
- package/dist/lib/configurations/tmux/panes +0 -10
- package/dist/lib/configurations/tmux/theme +0 -29
- package/dist/lib/configurations/tmux/tmux +0 -21
- package/dist/lib/configurations/vim/vimrc +0 -193
- package/dist/lib/configurations/wget/wgetrc +0 -40
- package/dist/lib/configurations/zsh/zshrc +0 -50
- package/dist/lib/configurations.sh +0 -45
- package/dist/lib/functions/README.md +0 -92
- package/dist/lib/functions/apihealth.sh +0 -277
- package/dist/lib/functions/apilatency.sh +0 -157
- package/dist/lib/functions/apiload.sh +0 -165
- package/dist/lib/functions/backup.sh +0 -143
- package/dist/lib/functions/cdls.sh +0 -60
- package/dist/lib/functions/curlheader.sh +0 -78
- package/dist/lib/functions/curlstatus.sh +0 -74
- package/dist/lib/functions/curltime.sh +0 -75
- package/dist/lib/functions/encode64.sh +0 -107
- package/dist/lib/functions/environment.sh +0 -78
- package/dist/lib/functions/extract.sh +0 -86
- package/dist/lib/functions/freespace.sh +0 -67
- package/dist/lib/functions/genpwd.sh +0 -105
- package/dist/lib/functions/goto.sh +0 -67
- package/dist/lib/functions/hexdump.sh +0 -96
- package/dist/lib/functions/hiddenfiles.sh +0 -77
- package/dist/lib/functions/hostinfo.sh +0 -98
- package/dist/lib/functions/hstats.sh +0 -75
- package/dist/lib/functions/httpdebug.sh +0 -113
- package/dist/lib/functions/kebabcase.sh +0 -61
- package/dist/lib/functions/keygen.sh +0 -194
- package/dist/lib/functions/last.sh +0 -112
- package/dist/lib/functions/logout.sh +0 -120
- package/dist/lib/functions/lowercase.sh +0 -61
- package/dist/lib/functions/matrix.sh +0 -216
- package/dist/lib/functions/mount_read_only.sh +0 -11
- package/dist/lib/functions/myproc.sh +0 -9
- package/dist/lib/functions/prependpath.sh +0 -21
- package/dist/lib/functions/ql.sh +0 -9
- package/dist/lib/functions/rd.sh +0 -17
- package/dist/lib/functions/remove_disk.sh +0 -11
- package/dist/lib/functions/ren.sh +0 -73
- package/dist/lib/functions/sentencecase.sh +0 -63
- package/dist/lib/functions/showhiddenfiles.sh +0 -14
- package/dist/lib/functions/size.sh +0 -16
- package/dist/lib/functions/snakecase.sh +0 -61
- package/dist/lib/functions/stopwatch.sh +0 -15
- package/dist/lib/functions/sysinfo.sh +0 -145
- package/dist/lib/functions/titlecase.sh +0 -65
- package/dist/lib/functions/uppercase.sh +0 -61
- package/dist/lib/functions/view-source.sh +0 -9
- package/dist/lib/functions/vscode.sh +0 -32
- package/dist/lib/functions/whoisport.sh +0 -14
- package/dist/lib/functions/zipf.sh +0 -16
- package/dist/lib/functions.sh +0 -46
- package/dist/lib/history.sh +0 -90
- package/dist/lib/paths/README.md +0 -52
- package/dist/lib/paths/custom.paths.sh +0 -40
- package/dist/lib/paths/default.paths.sh +0 -37
- package/dist/lib/paths.sh +0 -46
- package/dist/scripts/backup.sh +0 -95
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
################################################################################
|
|
4
|
-
# 🅳🅾🆃🅵🅸🅻🅴🆂 - HTTP Debugging Utility (httpdebug)
|
|
5
|
-
# Made with ♥ by Sebastien Rousseau
|
|
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
|
-
}
|
|
113
|
-
|
|
@@ -1,61 +0,0 @@
|
|
|
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,194 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
################################################################################
|
|
4
|
-
# 🅳🅾🆃🅵🅸🅻🅴🆂 - SSH Key Generator (keygen)
|
|
5
|
-
# Made with ♥ by Sebastien Rousseau
|
|
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
|
-
}
|
|
38
|
-
|
|
39
|
-
keygen() {
|
|
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
|
|
194
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
################################################################################
|
|
4
|
-
# 🅳🅾🆃🅵🅸🅻🅴🆂 - Recently Modified Files Viewer (last)
|
|
5
|
-
# Made with ♥ by Sebastien Rousseau
|
|
6
|
-
# License: MIT
|
|
7
|
-
#
|
|
8
|
-
# Description:
|
|
9
|
-
# last is a utility function to list recently modified files within a
|
|
10
|
-
# specified time range. By default, it lists files modified in the last 60
|
|
11
|
-
# minutes but allows customization.
|
|
12
|
-
#
|
|
13
|
-
# Usage:
|
|
14
|
-
# last [minutes]
|
|
15
|
-
# last --help
|
|
16
|
-
#
|
|
17
|
-
# Arguments:
|
|
18
|
-
# minutes Number of minutes to look back for modified files (default: 60)
|
|
19
|
-
# Maximum: 7 days (10080 minutes)
|
|
20
|
-
# --help Displays this help menu and exits
|
|
21
|
-
#
|
|
22
|
-
################################################################################
|
|
23
|
-
|
|
24
|
-
log_info() {
|
|
25
|
-
echo "[INFO] $*"
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
log_error() {
|
|
29
|
-
echo "[ERROR] $*" >&2
|
|
30
|
-
exit 1
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
detect_tool() {
|
|
34
|
-
if command -v /usr/bin/find &>/dev/null; then
|
|
35
|
-
echo "find"
|
|
36
|
-
elif command -v fd &>/dev/null; then
|
|
37
|
-
echo "fd"
|
|
38
|
-
elif command -v rg &>/dev/null; then
|
|
39
|
-
echo "rg"
|
|
40
|
-
else
|
|
41
|
-
log_error "No compatible tools found (find, fd, or rg)."
|
|
42
|
-
fi
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
last() {
|
|
46
|
-
# Display help menu
|
|
47
|
-
if [[ "$1" == "--help" ]]; then
|
|
48
|
-
cat << 'EOH'
|
|
49
|
-
🅳🅾🆃🅵🅸🅻🅴🆂 - Recently Modified Files Viewer
|
|
50
|
-
|
|
51
|
-
Description:
|
|
52
|
-
last is a utility function to list recently modified files within a specified
|
|
53
|
-
time range. By default, it lists files modified in the last 60 minutes.
|
|
54
|
-
|
|
55
|
-
Usage:
|
|
56
|
-
last [minutes]
|
|
57
|
-
last --help
|
|
58
|
-
|
|
59
|
-
Arguments:
|
|
60
|
-
minutes Number of minutes to look back for modified files (default: 60)
|
|
61
|
-
Maximum: 7 days (10080 minutes)
|
|
62
|
-
--help Displays this help menu and exits
|
|
63
|
-
|
|
64
|
-
Examples:
|
|
65
|
-
last
|
|
66
|
-
# Lists files modified within the last 60 minutes
|
|
67
|
-
last 120
|
|
68
|
-
# Lists files modified within the last 120 minutes
|
|
69
|
-
|
|
70
|
-
Notes:
|
|
71
|
-
- Only regular files are shown
|
|
72
|
-
- Symbolic links and directories are excluded from the results
|
|
73
|
-
- Searches recursively starting from the current directory
|
|
74
|
-
- Maximum time range is 7 days (10080 minutes)
|
|
75
|
-
EOH
|
|
76
|
-
return 0
|
|
77
|
-
fi
|
|
78
|
-
|
|
79
|
-
# Default time range (60 minutes)
|
|
80
|
-
local minutes=${1:-60}
|
|
81
|
-
|
|
82
|
-
# Validate that the input is a positive integer
|
|
83
|
-
if ! [[ "$minutes" =~ ^[0-9]+$ ]]; then
|
|
84
|
-
log_error "Invalid input: '$minutes'. Please provide a positive integer for minutes."
|
|
85
|
-
fi
|
|
86
|
-
|
|
87
|
-
# Check maximum time range (7 days = 10080 minutes)
|
|
88
|
-
if ((minutes > 10080)); then
|
|
89
|
-
log_error "Time range too large. Maximum is 7 days (10080 minutes)."
|
|
90
|
-
fi
|
|
91
|
-
|
|
92
|
-
# Detect which tool to use
|
|
93
|
-
local tool
|
|
94
|
-
tool=$(detect_tool)
|
|
95
|
-
|
|
96
|
-
# Find and list modified files
|
|
97
|
-
log_info "Listing files modified in the last ${minutes} minutes (using $tool):"
|
|
98
|
-
case "$tool" in
|
|
99
|
-
"find")
|
|
100
|
-
/usr/bin/find . -type f -mmin -"${minutes}"
|
|
101
|
-
;;
|
|
102
|
-
"fd")
|
|
103
|
-
fd --type file --changed-within "${minutes}m"
|
|
104
|
-
;;
|
|
105
|
-
"rg")
|
|
106
|
-
rg --type file --changed-within "${minutes}m"
|
|
107
|
-
;;
|
|
108
|
-
*)
|
|
109
|
-
log_error "Unknown tool detected."
|
|
110
|
-
;;
|
|
111
|
-
esac
|
|
112
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
################################################################################
|
|
4
|
-
# 🅳🅾🆃🅵🅸🅻🅴🆂 - Cross-Platform Logout Utility (logout)
|
|
5
|
-
# Made with ♥ by Sebastien Rousseau
|
|
6
|
-
# License: MIT
|
|
7
|
-
#
|
|
8
|
-
# Description:
|
|
9
|
-
# logout is a utility function to log out from macOS, Linux, or Windows via
|
|
10
|
-
# the terminal. It provides options for confirmation and forceful logout if
|
|
11
|
-
# necessary.
|
|
12
|
-
#
|
|
13
|
-
# Usage:
|
|
14
|
-
# logout [--force] [--help]
|
|
15
|
-
#
|
|
16
|
-
# Arguments:
|
|
17
|
-
# --force Skips confirmation and forces logout.
|
|
18
|
-
# --help Displays this help menu and exits.
|
|
19
|
-
#
|
|
20
|
-
################################################################################
|
|
21
|
-
|
|
22
|
-
log_info() {
|
|
23
|
-
echo "[INFO] $*"
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
log_warning() {
|
|
27
|
-
echo "[WARNING] $*" >&2
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
log_error() {
|
|
31
|
-
echo "[ERROR] $*" >&2
|
|
32
|
-
exit 1
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
logout() {
|
|
36
|
-
# Display help menu
|
|
37
|
-
if [[ "$1" == "--help" ]]; then
|
|
38
|
-
cat << 'EOH'
|
|
39
|
-
Cross-Platform Logout Utility (logout)
|
|
40
|
-
|
|
41
|
-
Description:
|
|
42
|
-
logout is a utility function to log out from macOS, Linux, or Windows via the
|
|
43
|
-
terminal. It provides options for confirmation and forceful logout if
|
|
44
|
-
necessary.
|
|
45
|
-
|
|
46
|
-
Usage:
|
|
47
|
-
logout [--force] [--help]
|
|
48
|
-
|
|
49
|
-
Arguments:
|
|
50
|
-
--force Skips confirmation and forces logout.
|
|
51
|
-
--help Displays this help menu and exits.
|
|
52
|
-
|
|
53
|
-
Examples:
|
|
54
|
-
logout
|
|
55
|
-
# Prompts for confirmation before logging out.
|
|
56
|
-
|
|
57
|
-
logout --force
|
|
58
|
-
# Logs out immediately without confirmation.
|
|
59
|
-
|
|
60
|
-
Notes:
|
|
61
|
-
- Requires administrative privileges for some systems (Linux/Windows).
|
|
62
|
-
- May prompt for a password depending on system settings.
|
|
63
|
-
EOH
|
|
64
|
-
return 0
|
|
65
|
-
fi
|
|
66
|
-
|
|
67
|
-
# Check if the user passed --force
|
|
68
|
-
local force=false
|
|
69
|
-
if [[ "$1" == "--force" ]]; then
|
|
70
|
-
force=true
|
|
71
|
-
fi
|
|
72
|
-
|
|
73
|
-
# Prompt for confirmation if not forced
|
|
74
|
-
if [[ "$force" == false ]]; then
|
|
75
|
-
echo "Are you sure you want to log out? (y/n):"
|
|
76
|
-
read -r response
|
|
77
|
-
case "$response" in
|
|
78
|
-
[Yy]*)
|
|
79
|
-
;;
|
|
80
|
-
*)
|
|
81
|
-
log_info "Logout canceled."
|
|
82
|
-
return 0
|
|
83
|
-
;;
|
|
84
|
-
esac
|
|
85
|
-
fi
|
|
86
|
-
|
|
87
|
-
# Detect operating system
|
|
88
|
-
local os
|
|
89
|
-
os=$(uname | tr '[:upper:]' '[:lower:]')
|
|
90
|
-
|
|
91
|
-
case "$os" in
|
|
92
|
-
"darwin")
|
|
93
|
-
log_info "Logging out from macOS..."
|
|
94
|
-
if ! osascript -e 'tell application "System Events" to log out'; then
|
|
95
|
-
log_error "Failed to log out using AppleScript. Try logging out manually."
|
|
96
|
-
fi
|
|
97
|
-
;;
|
|
98
|
-
"linux")
|
|
99
|
-
log_info "Logging out from Linux..."
|
|
100
|
-
if command -v gnome-session-quit &>/dev/null; then
|
|
101
|
-
gnome-session-quit --logout --no-prompt
|
|
102
|
-
elif command -v loginctl &>/dev/null; then
|
|
103
|
-
loginctl terminate-user "$USER"
|
|
104
|
-
else
|
|
105
|
-
log_error "Unable to determine logout method for your Linux system. Try logging out manually."
|
|
106
|
-
fi
|
|
107
|
-
;;
|
|
108
|
-
"msys" | "cygwin" | "mingw"*)
|
|
109
|
-
log_info "Logging out from Windows..."
|
|
110
|
-
if ! shutdown /l; then
|
|
111
|
-
log_error "Failed to log out from Windows. Try logging out manually."
|
|
112
|
-
fi
|
|
113
|
-
;;
|
|
114
|
-
*)
|
|
115
|
-
log_error "Unsupported operating system: $os"
|
|
116
|
-
;;
|
|
117
|
-
esac
|
|
118
|
-
|
|
119
|
-
return 0
|
|
120
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
################################################################################
|
|
4
|
-
# 🅳🅾🆃🅵🅸🅻🅴🆂 - Cross-Platform Lowercase Utility (lowercase)
|
|
5
|
-
# Made with ♥ by Sebastien Rousseau
|
|
6
|
-
# License: MIT
|
|
7
|
-
#
|
|
8
|
-
# Description:
|
|
9
|
-
# lowercase is a utility function that converts file or directory names to
|
|
10
|
-
# lowercase. It supports multiple arguments and provides informative messages
|
|
11
|
-
# for each operation, including errors and successful renames.
|
|
12
|
-
#
|
|
13
|
-
# Usage:
|
|
14
|
-
# lowercase <file_or_directory> [<file_or_directory> ...]
|
|
15
|
-
#
|
|
16
|
-
# Arguments:
|
|
17
|
-
# <file_or_directory> One or more file or directory paths to rename
|
|
18
|
-
# to lowercase.
|
|
19
|
-
#
|
|
20
|
-
# Notes:
|
|
21
|
-
# - This utility will skip renaming files or directories that are already
|
|
22
|
-
# in lowercase.
|
|
23
|
-
# - Invalid or non-existent paths will result in an error message.
|
|
24
|
-
#
|
|
25
|
-
################################################################################
|
|
26
|
-
|
|
27
|
-
lowercase() {
|
|
28
|
-
# Ensure at least one argument is provided
|
|
29
|
-
if [[ "$#" -lt 1 ]]; then
|
|
30
|
-
echo "[ERROR] Please provide at least one file or directory to convert to lowercase." >&2
|
|
31
|
-
return 1
|
|
32
|
-
fi
|
|
33
|
-
|
|
34
|
-
for file in "$@"; do
|
|
35
|
-
# Check if the file/directory exists
|
|
36
|
-
if [[ ! -e "$file" ]]; then
|
|
37
|
-
echo "[ERROR] The file or directory '$file' does not exist." >&2
|
|
38
|
-
continue
|
|
39
|
-
fi
|
|
40
|
-
|
|
41
|
-
dirname=$(dirname "$file")
|
|
42
|
-
filename=$(basename "$file")
|
|
43
|
-
|
|
44
|
-
# Convert filename to lowercase using tr
|
|
45
|
-
nf=$(printf "%s" "$filename" | tr '[:upper:]' '[:lower:]')
|
|
46
|
-
|
|
47
|
-
# If already lowercase, skip
|
|
48
|
-
if [[ "$filename" == "$nf" ]]; then
|
|
49
|
-
echo "[INFO] '$file' is already in lowercase."
|
|
50
|
-
continue
|
|
51
|
-
fi
|
|
52
|
-
|
|
53
|
-
newname="${dirname}/${nf}"
|
|
54
|
-
|
|
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
|
-
}
|