-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkspace-intro.sh
More file actions
executable file
Β·237 lines (177 loc) Β· 9.47 KB
/
workspace-intro.sh
File metadata and controls
executable file
Β·237 lines (177 loc) Β· 9.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
#!/usr/bin/env bash
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# ARAS Workspace - Terminal Intro Animation
# Dynamic version - fetches data from GitHub API
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
set -euo pipefail
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# CONFIGURATION - Edit these values
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# GitHub
GITHUB_ORG="ARAS-Workspace"
# Excluded repositories
specialExcludedRepos=("wireguard-apple" "homebrew-tap" ".github")
# Domain & SSH
DOMAIN="aras.tc"
SSH_USER="workspace"
SSH_HOST="aras"
GUEST_USER="guest"
GUEST_HOST="local"
# Branding
AUTHOR_NAME="RΔ±za Emre ARAS"
AUTHOR_EMAIL="r.emrearas@proton.me"
SLOGAN="Turkish engineering, universal code."
# ASCII Art Banner (no leading whitespace for proper alignment)
ASCII_BANNER='
ββββββ βββββββ ββββββ ββββββββ
ββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββ
βββ ββββββ ββββββ βββββββββββ
βββ ββββββ ββββββ βββββββββββ
'
# Animation Timing
TYPING_SPEED=0.05
TYPING_VARIANCE=0.03
COMMAND_PAUSE=0.4
LINE_PAUSE=0.2
SECTION_PAUSE=1.2
# Colors
C_RESET='\033[0m'
C_BOLD='\033[1m'
C_DIM='\033[2m'
C_GREEN='\033[32m'
C_CYAN='\033[36m'
C_YELLOW='\033[33m'
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# GITHUB API FUNCTIONS
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
fetch_repositories() {
local repos
local jq_filter
# Build jq filter from excluded repos array
jq_filter=$(printf '"%s",' "${specialExcludedRepos[@]}")
jq_filter="[${jq_filter%,}]"
repos=$(curl -sf "https://api.github.com/orgs/${GITHUB_ORG}/repos?sort=updated&per_page=10" | \
jq -r --argjson excluded "$jq_filter" \
'[.[] | select(.fork == false) | select(.name as $n | $excluded | index($n) | not)] | .[].name // empty' | head -10)
if [[ -z "$repos" ]]; then
echo "no-repos-found"
return
fi
echo "$repos"
}
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# ANIMATION FUNCTIONS
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
type_text() {
local text="$1"
local speed="${2:-$TYPING_SPEED}"
for ((i=0; i<${#text}; i++)); do
printf '%s' "${text:$i:1}"
local variance
variance=$(printf "%.3f" "$(echo "scale=3; ($RANDOM % 100) * $TYPING_VARIANCE / 100" | bc)")
sleep "$(echo "$speed + $variance" | bc)"
done
}
type_command() {
local prompt="$1"
local command="$2"
local output="$3"
printf '%b' "$prompt"
sleep 0.2
type_text "$command"
sleep "$COMMAND_PAUSE"
printf '\n'
if [[ -n "$output" ]]; then
sleep 0.15
printf '%b' "$output"
[[ "$output" != *$'\n' ]] && printf '\n'
fi
sleep "$LINE_PAUSE"
}
instant() {
printf '%b' "$1"
}
progress_dots() {
local message="$1"
local count="${2:-3}"
printf '%s' "$message"
for ((i=0; i<count; i++)); do
sleep 0.3
printf '.'
done
printf '\n'
}
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# MAIN ANIMATION
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
main() {
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Fetch dynamic data from GitHub API
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
echo "Fetching data from GitHub API..." >&2
local repos_raw
repos_raw=$(fetch_repositories)
# Format repos for display (colorized, space-separated)
local repos_display=""
while IFS= read -r repo; do
[[ -n "$repo" ]] && repos_display+="${C_YELLOW}${repo}${C_RESET} "
done <<< "$repos_raw"
echo "Data fetched. Starting animation..." >&2
sleep 1
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Animation Start
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
clear
sleep 0.5
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# PHASE 1: SSH Connection
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
local guest_prompt="${C_GREEN}${GUEST_USER}${C_RESET}@${C_CYAN}${GUEST_HOST}${C_RESET}:~\$ "
printf '%b' "$guest_prompt"
sleep 0.2
type_text "ssh ${SSH_USER}@${DOMAIN}"
sleep "$COMMAND_PAUSE"
printf '\n'
sleep 0.4
progress_dots "Connecting to ${DOMAIN}"
sleep 0.2
instant "${C_DIM}Authenticating...${C_RESET}\n"
sleep 0.5
instant "${C_GREEN}Connection established.${C_RESET}\n"
sleep "$SECTION_PAUSE"
clear
sleep 0.3
local ws_prompt="${C_GREEN}${SSH_USER}${C_RESET}@${C_CYAN}${SSH_HOST}${C_RESET}:~\$ "
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# PHASE 2: Welcome Banner
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
type_command "$ws_prompt" "cat /etc/motd" "${C_BOLD}${ASCII_BANNER}${C_RESET}"
sleep 0.4
type_command "$ws_prompt" "motto --prompt 'What is this?'" "${SLOGAN}"
sleep "$SECTION_PAUSE"
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# PHASE 3: Interactive Session
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Command: whoami
type_command "$ws_prompt" "whoami" "${C_BOLD}${AUTHOR_NAME}${C_RESET} ${C_DIM}<${AUTHOR_EMAIL}>${C_RESET}"
sleep 0.6
# Command: pwd
type_command "$ws_prompt" "pwd" "/home/${C_CYAN}${GITHUB_ORG}${C_RESET}"
sleep 0.6
# Command: ls projects (dynamic from API)
type_command "$ws_prompt" "ls projects/" "$repos_display"
sleep "$SECTION_PAUSE"
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# PHASE 4: Final prompt with blinking cursor
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
printf '%b' "$ws_prompt"
sleep 2
printf '\n'
sleep 0.5
}
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# RUN
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
main "$@"