Compare commits
5 commits
09cea560dc
...
ee9d0986ed
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ee9d0986ed | ||
![]() |
76f3896338 | ||
![]() |
a0e18c57ae | ||
![]() |
63d0532b85 | ||
![]() |
4f3cb4c5a7 |
14 changed files with 482 additions and 2 deletions
1
chezmoi.roots/_home.macos/private_dot_config/sz.env/971_tv.env
Symbolic link
1
chezmoi.roots/_home.macos/private_dot_config/sz.env/971_tv.env
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../_home/private_dot_config/sz.env/971_tv.env
|
|
@ -0,0 +1 @@
|
|||
../../../_home/private_dot_config/sz.env/remove_ID_truenas_scale.env
|
|
@ -0,0 +1 @@
|
|||
../../../_home/private_dot_config/sz.env/remove_truenas-scale.env
|
|
@ -0,0 +1 @@
|
|||
../../../_home/private_dot_config/television/config.toml
|
|
@ -0,0 +1 @@
|
|||
../../../_home/private_dot_config/television/vast_channels.toml
|
|
@ -0,0 +1,16 @@
|
|||
layout {
|
||||
cwd "/Users/gal.szkolnik"
|
||||
tab name="CS-DBG" hide_floating_panes=true {
|
||||
pane size=1 borderless=true {
|
||||
plugin location="zellij:tab-bar"
|
||||
}
|
||||
pane command="zsh" cwd="/Users/gal.szkolnik" size="55%" {
|
||||
args "-ic" "ssh -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa cs-dbg"
|
||||
start_suspended true
|
||||
}
|
||||
pane size=1 borderless=true {
|
||||
plugin location="zellij:status-bar"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
layout {
|
||||
cwd "/Users/gal.szkolnik"
|
||||
tab name="Teleport" hide_floating_panes=true {
|
||||
pane size=1 borderless=true {
|
||||
plugin location="zellij:tab-bar"
|
||||
}
|
||||
pane command="zsh" cwd="/Users/gal.szkolnik" size="55%" {
|
||||
args "-ic" "vast-teleport launch --from-zellij"
|
||||
// start_suspended true
|
||||
}
|
||||
pane size=1 borderless=true {
|
||||
plugin location="zellij:status-bar"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,226 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_NAME="${0##*/}"
|
||||
usage() {
|
||||
printf '%s\n' \
|
||||
'VAST lab connection helper/manager for Customer Support/Success' \
|
||||
'' \
|
||||
'Usage:' \
|
||||
" ${SCRIPT_NAME} <command> [args...]" \
|
||||
'' \
|
||||
'Commands:' \
|
||||
' prerpmac Configure MacOS network interfaces for lab physcal NIC connection' \
|
||||
' cs-dbg Connect to CS-DBG' \
|
||||
' get various VAST related queries'
|
||||
'' \
|
||||
''
|
||||
exit 2
|
||||
}
|
||||
|
||||
usage-prepmac() {
|
||||
printf '%s\n' \
|
||||
'Configure MacOS network interfaces for lab physcal NIC connection' \
|
||||
'' \
|
||||
'Usage:' \
|
||||
" ${SCRIPT_NAME} prepmac <TO> [<FROM>] [<Interface>]" \
|
||||
'' \
|
||||
'Configure MacOS iface to connect to <TO> address from <FROM> address' \
|
||||
'Default <Interface> is en9' \
|
||||
'' \
|
||||
'FROM and FROM_SN will be autofilled for the following subnets:' \
|
||||
' 10.117.10.0/24' \
|
||||
' 192.168.[1 or 2].0/24' \
|
||||
'' \
|
||||
"for other subnets, you'll need to specify a FROM argument and a FROM_SN env variable" \
|
||||
'' \
|
||||
'What the script does:' \
|
||||
' 1. Attempts a ping to the destination IP.' \
|
||||
' 2. If unsuccessful:' \
|
||||
" a. if FROM (2nd arg) isn't specified or set to 'dhcp':" \
|
||||
' - tries to guess the FROM and FROM_SN based on known TO ranges.' \
|
||||
' b. if FROM was specied - uses FROM/2nd argument and FROM_SN from env' \
|
||||
' c. compares desired FROM and assigned IP on outgoing interface (IFACE env or default: en9)' \
|
||||
' d. if different, asssigns ip address to interface (temporary, using sudo)' \
|
||||
' e. Attempts ping once again' \
|
||||
' 3. If ping was successful, tries to grab hostname via ssh' \
|
||||
'' \
|
||||
" The entire process will do it's best to communicate error states and" \
|
||||
' recommend possible actions if any steps fail' \
|
||||
''\
|
||||
'Predefined CIDR and aliases' \
|
||||
' 10.117.10.254/24 ' \
|
||||
' 192.168.1.254/24 ' \
|
||||
' 192.168.2.254/24 ' \
|
||||
' 169.254.1.15/27 ' \
|
||||
' 169.254.111.15/27 ' \
|
||||
' 169.254.3.254/24 ' \
|
||||
'' \
|
||||
'Examples:' \
|
||||
" ${SCRIPT_NAME} 192.168.2.2 # connect to tech port" \
|
||||
''
|
||||
exit 2
|
||||
}
|
||||
|
||||
usage-get() {
|
||||
printf '%s\n' \
|
||||
'various VAST related queries' \
|
||||
'' \
|
||||
'Usage:' \
|
||||
" ${SCRIPT_NAME} get <sub-command> [args...]" \
|
||||
'' \
|
||||
'Commands:' \
|
||||
' s3-releases Get release names available on s3' \
|
||||
'' \
|
||||
''
|
||||
exit 2
|
||||
}
|
||||
if [ $# -eq 0 ]; then
|
||||
usage
|
||||
elif [[ $# -eq 1 && "$1" == "editme" ]]; then
|
||||
exec ${VISUAL:-${EDITOR:-vi}} "$(readlink -f "$0")"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
_myip() {
|
||||
lsip | awk "/${IFACE}/"'{split($3, a, "/"); print a[1];}'
|
||||
}
|
||||
|
||||
_ping() {
|
||||
ping -c "${PING_C:-3}" -W 250 "${TO}"
|
||||
}
|
||||
|
||||
_log() {
|
||||
printf '%s\n' \
|
||||
"${@:2}" \
|
||||
>&2
|
||||
exit ${1}
|
||||
}
|
||||
|
||||
do_prepmac() {
|
||||
local TO="${1}"
|
||||
local IFACE="${IFACE:-en9}"
|
||||
local PINGOK=1
|
||||
local CMDs=("${@:2}")
|
||||
|
||||
[ "${#CMDs}" -gt 0 ] || CMDs=( hostname )
|
||||
|
||||
if _ping &>/dev/null; then
|
||||
printf "Connection detected.\n"
|
||||
else
|
||||
PINGOK=0
|
||||
if [ "${FROM:-${2:-}}" == "dhcp" ]; then
|
||||
FROM=dhcp
|
||||
FROM_SN=auto
|
||||
SLEEP="${SLEEP:-15s}"
|
||||
else
|
||||
SLEEP="${SLEEP:-3s}"
|
||||
case "${FROM:+__}${TO}" in
|
||||
10.117.10.*)
|
||||
FROM=10.117.10.254
|
||||
FROM_SN=255.255.255.0
|
||||
;;
|
||||
192.168.1.*)
|
||||
FROM=192.168.1.254
|
||||
FROM_SN=255.255.255.0
|
||||
;;
|
||||
192.168.2.*)
|
||||
FROM=192.168.2.254
|
||||
FROM_SN=255.255.255.0
|
||||
;;
|
||||
169.254.1.*)
|
||||
FROM=169.254.1.15
|
||||
FROM_SN=255.255.255.224
|
||||
;;
|
||||
169.254.111.*)
|
||||
FROM=169.254.111.15
|
||||
FROM_SN=255.255.255.224
|
||||
;;
|
||||
169.254.3.*)
|
||||
FROM=169.254.3.253
|
||||
FROM_SN=255.255.255.0
|
||||
;;
|
||||
*)
|
||||
FROM=${FROM:-${2:?FROM and FROM_SN Must be supplied for unknown IPv4 destination $1}} || usage-prepmac
|
||||
FROM_SN=${FROM_SN:?FROM and FROM_SN Must be supplied for unknown IPv4 destination $1} || usage-prepmac
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
MYIP=''
|
||||
MYIP="$(_myip)"
|
||||
|
||||
if [ "$FROM" == "$MYIP" ]; then
|
||||
_log 2 "Already setup with $MYIP, but ping to $TO is failing, you'll need to troubleshoot this."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "$MYIP detected on $IFACE, Setting up $FROM / $FROM_SN - \`sudo\` might be prompting you for your password"
|
||||
|
||||
if [ "${FROM}" == "dhcp" ]; then
|
||||
sudo ipconfig set "${IFACE}" bootp || true
|
||||
sudo ipconfig set "${IFACE}" dhcp
|
||||
else
|
||||
sudo ipconfig set "${IFACE}" manual "${FROM}" "${FROM_SN}"
|
||||
fi \
|
||||
&& printf 'Waiting %s...' "${SLEEP}" \
|
||||
&& sleep "${SLEEP}" \
|
||||
&& MYIP="$(_myip)"
|
||||
fi
|
||||
|
||||
if [ $PINGOK -eq 0 ] && _ping &>/dev/null; then
|
||||
PINGOK=1
|
||||
fi
|
||||
|
||||
if [ $PINGOK -eq 1 ]; then
|
||||
# auto-copy-ssh-id "${TO}"
|
||||
|
||||
ssh-keygen -R "${TO}" || true
|
||||
|
||||
ssh \
|
||||
-o PasswordAuthentication=no \
|
||||
-o BatchMode=yes \
|
||||
-o ConnectTimeout=2 \
|
||||
-ttn \
|
||||
"${TO}" -- "${CMDs[*]}" \
|
||||
|| 1>&2 printf '%s\n' \
|
||||
"Could not SSH into ${TO}, you might want to run 'pull-vast.id_rsa ${TO}' or 'auto-copy-ssh-id ${TO}'"
|
||||
else
|
||||
_log 2 "Ping faild."
|
||||
fi
|
||||
}
|
||||
|
||||
do_get_s3-releases() {
|
||||
# Get the list of releases, order in reverse, where non-sp/hf are listed first.
|
||||
aws s3 ls --human-readable s3://vastdata-releases/release_bundles/service-packs/ \
|
||||
| sed -E 's|^[[:space:]]+[^[:space:]]+[[:space:]](.+)/$|999\1|; s/^999release/111release/; s/([[:digit:]])$/\1.zzz/' \
|
||||
| sort --field-separator=- -k2,2Vr -k3,3Vr -k4,4Vr -k5,5Vr \
|
||||
| sed -Ee 's/^[[:digit:]]{3}//; s/.zzz$//'
|
||||
}
|
||||
|
||||
do_get() {
|
||||
local DO_CMD='usage-get'
|
||||
if [[ $# -gt 0 ]] && declare -f "do_get_${1}" > /dev/null; then
|
||||
DO_CMD="do_get_${1}"
|
||||
shift
|
||||
fi
|
||||
${DO_CMD} "$@"
|
||||
}
|
||||
|
||||
do_cs-dbg() {
|
||||
zellij action new-tab --layout=cs-dbg
|
||||
}
|
||||
|
||||
_main_() {
|
||||
local DO_CMD='usage'
|
||||
if [[ $# -gt 0 ]] && declare -f "do_${1}" > /dev/null; then
|
||||
DO_CMD="do_${1}"
|
||||
shift
|
||||
fi
|
||||
${DO_CMD} "$@"
|
||||
}
|
||||
_main_ "$@"
|
||||
|
||||
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
||||
|
|
@ -292,6 +292,32 @@
|
|||
) -}}
|
||||
{{- end -}}{{- end -}}{{- end -}}
|
||||
|
||||
{{/*
|
||||
# valid arch strings:
|
||||
# aarch64-macos
|
||||
# x86_64-macos
|
||||
# linux-musl-arm64
|
||||
# linux-musl-x86_64
|
||||
*/}}
|
||||
|
||||
{{- if (eq .chezmoi.os "darwin" ) -}}
|
||||
{{- $myArch = list .sz.os.arch_alt "macos" | join "-" -}}
|
||||
{{- else -}}
|
||||
{{- $myArch = list .chezmoi.os .chezmoi.arch | join "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with $app_name := "lnav" -}}
|
||||
{{- with $repo := (printf "%s/%s" "tstack" $app_name) -}}
|
||||
{{- with $version := trimPrefix "v" (gitHubLatestRelease $repo).GetTagName -}}
|
||||
{{- $_ := set $externals (printf ".local/bin/%s" $app_name) (dict
|
||||
"type" "archive-file"
|
||||
"url" (printf "https://github.com/%s/releases/download/v%s/%s-%s-%s.zip" $repo $version $app_name $version $myArch)
|
||||
"path" (printf "%s-%s/%s" $app_name $version $app_name)
|
||||
"executable" true
|
||||
"refreshPeriod" $defaultRefresh
|
||||
) -}}{{- end -}}{{- end -}}{{- end -}}
|
||||
|
||||
|
||||
{{/*
|
||||
# valid arch strings:
|
||||
# darwin-amd64
|
||||
|
|
10
chezmoi.roots/_home/private_dot_config/sz.env/971_tv.env
Normal file
10
chezmoi.roots/_home/private_dot_config/sz.env/971_tv.env
Normal file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"'
|
||||
|
||||
if is_cmd tv; then
|
||||
. <( tv init "${SHELL##*/}" )
|
||||
|
||||
[[ -n "${DBG}" ]] && echo "television loaded."
|
||||
fi
|
||||
|
||||
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
||||
|
|
@ -1 +0,0 @@
|
|||
2025-04-18T10:58:50-04:00
|
|
@ -1 +0,0 @@
|
|||
2025-04-18T11:08:32-04:00
|
178
chezmoi.roots/_home/private_dot_config/television/config.toml
Normal file
178
chezmoi.roots/_home/private_dot_config/television/config.toml
Normal file
|
@ -0,0 +1,178 @@
|
|||
# CONFIGURATION FILE LOCATION ON YOUR SYSTEM:
|
||||
# -------------------------------------------
|
||||
# Defaults:
|
||||
# ---------
|
||||
# Linux: `$HOME/.config/television/config.toml`
|
||||
# macOS: `$HOME/.config/television/config.toml`
|
||||
# Windows: `%APPDATA%\television\config.toml`
|
||||
#
|
||||
# XDG dirs:
|
||||
# ---------
|
||||
# You may use XDG_CONFIG_HOME if set on your system.
|
||||
# In that case, television will expect the configuration file to be in:
|
||||
# `$XDG_CONFIG_HOME/television/config.toml`
|
||||
#
|
||||
|
||||
# General settings
|
||||
# ----------------------------------------------------------------------------
|
||||
frame_rate = 60 # DEPRECATED: this option is no longer used
|
||||
tick_rate = 50
|
||||
|
||||
[ui]
|
||||
# Whether to use nerd font icons in the UI
|
||||
# This option requires a font patched with Nerd Font in order to properly
|
||||
# display glyphs (see https://www.nerdfonts.com/ for more information)
|
||||
use_nerd_font_icons = false
|
||||
# How much space to allocate for the UI (in percentage of the screen)
|
||||
# ┌───────────────────────────────────────┐
|
||||
# │ │
|
||||
# │ Terminal screen │
|
||||
# │ ┌─────────────────────────────┐ │
|
||||
# │ │ │ │
|
||||
# │ │ │ │
|
||||
# │ │ │ │
|
||||
# │ │ Television UI │ │
|
||||
# │ │ │ │
|
||||
# │ │ │ │
|
||||
# │ │ │ │
|
||||
# │ │ │ │
|
||||
# │ └─────────────────────────────┘ │
|
||||
# │ │
|
||||
# │ │
|
||||
# └───────────────────────────────────────┘
|
||||
ui_scale = 96
|
||||
# Whether to show the top help bar in the UI by default
|
||||
# This option can be toggled with the (default) `ctrl-g` keybinding
|
||||
show_help_bar = false
|
||||
# Whether to show the preview panel in the UI by default
|
||||
# This option can be toggled with the (default) `ctrl-o` keybinding
|
||||
show_preview_panel = true
|
||||
# Where to place the input bar in the UI (top or bottom)
|
||||
input_bar_position = "top"
|
||||
# DEPRECATED: title is now always displayed at the top as part of the border
|
||||
# Where to place the preview title in the UI (top or bottom)
|
||||
# preview_title_position = "top"
|
||||
# The theme to use for the UI
|
||||
# A list of builtin themes can be found in the `themes` directory of the television
|
||||
# repository. You may also create your own theme by creating a new file in a `themes`
|
||||
# directory in your configuration directory (see the `config.toml` location above).
|
||||
theme = "default"
|
||||
|
||||
# Previewers settings
|
||||
# ----------------------------------------------------------------------------
|
||||
[previewers.file]
|
||||
# The theme to use for syntax highlighting.
|
||||
# Bulitin syntax highlighting uses the same syntax highlighting engine as bat.
|
||||
# To get a list of your currently available themes, run `bat --list-themes`
|
||||
# Note that setting the BAT_THEME environment variable will override this setting.
|
||||
theme = "TwoDark"
|
||||
|
||||
# Keybindings
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# Channel mode
|
||||
# ------------------------
|
||||
[keybindings]
|
||||
# Quit the application
|
||||
quit = ["esc", "ctrl-c"]
|
||||
# Scrolling through entries
|
||||
select_next_entry = ["down", "ctrl-n", "ctrl-j"]
|
||||
select_prev_entry = ["up", "ctrl-p", "ctrl-k"]
|
||||
select_next_page = "pagedown"
|
||||
select_prev_page = "pageup"
|
||||
# Scrolling the preview pane
|
||||
scroll_preview_half_page_down = "ctrl-d"
|
||||
scroll_preview_half_page_up = "ctrl-u"
|
||||
# Add entry to selection and move to the next entry
|
||||
toggle_selection_down = "tab"
|
||||
# Add entry to selection and move to the previous entry
|
||||
toggle_selection_up = "backtab"
|
||||
# Confirm selection
|
||||
confirm_selection = "enter"
|
||||
# Copy the selected entry to the clipboard
|
||||
copy_entry_to_clipboard = "ctrl-y"
|
||||
# Toggle the remote control mode
|
||||
toggle_remote_control = "ctrl-r"
|
||||
# Toggle the send to channel mode
|
||||
toggle_send_to_channel = "ctrl-s"
|
||||
# Toggle the help bar
|
||||
toggle_help = "ctrl-g"
|
||||
# Toggle the preview panel
|
||||
toggle_preview = "ctrl-o"
|
||||
|
||||
|
||||
# Shell integration
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# The shell integration feature allows you to use television as a picker for
|
||||
# your shell commands (as well as your shell history with <CTRL-R>).
|
||||
# E.g. typing `git checkout <CTRL-T>` will open television with a list of
|
||||
# branches to choose from.
|
||||
|
||||
[shell_integration]
|
||||
# This specifies the default fallback channel if no other channel is matched.
|
||||
fallback_channel = "files"
|
||||
|
||||
[shell_integration.channel_triggers]
|
||||
# Add your channel triggers here. Each key is a channel that will be triggered
|
||||
# by the corresponding commands.
|
||||
# Example: say you want the following commands to trigger the following channels
|
||||
# when pressing <CTRL-T>:
|
||||
# `git checkout` should trigger the `git-branches` channel
|
||||
# `ls` should trigger the `dirs` channel
|
||||
# `cat` and `cp` should trigger the `files` channel
|
||||
#
|
||||
# You would add the following to your configuration file:
|
||||
# ```
|
||||
# [shell_integration.channel_triggers]
|
||||
# "git-branches" = ["git checkout"]
|
||||
# "dirs" = ["ls"]
|
||||
# "files" = ["cat", "cp"]
|
||||
# ```
|
||||
"alias" = ["alias", "unalias"]
|
||||
"env" = ["export", "unset"]
|
||||
"dirs" = ["cd", "ls", "rmdir"]
|
||||
"files" = [
|
||||
"cat",
|
||||
"less",
|
||||
"head",
|
||||
"tail",
|
||||
"vim",
|
||||
"nano",
|
||||
"bat",
|
||||
"cp",
|
||||
"mv",
|
||||
"rm",
|
||||
"touch",
|
||||
"chmod",
|
||||
"chown",
|
||||
"ln",
|
||||
"tar",
|
||||
"zip",
|
||||
"unzip",
|
||||
"gzip",
|
||||
"gunzip",
|
||||
"xz",
|
||||
]
|
||||
"git-diff" = ["git add", "git restore"]
|
||||
"git-branch" = [
|
||||
"git checkout",
|
||||
"git branch",
|
||||
"git merge",
|
||||
"git rebase",
|
||||
"git pull",
|
||||
"git push",
|
||||
]
|
||||
"docker-images" = ["docker run"]
|
||||
"git-repos" = ["nvim", "code", "hx", "git clone"]
|
||||
|
||||
|
||||
[shell_integration.keybindings]
|
||||
# controls which key binding should trigger tv
|
||||
# for shell autocomplete
|
||||
# "smart_autocomplete" = "ctrl-b"
|
||||
# "smart_autocomplete" = "ctrl-v"
|
||||
"smart_autocomplete" = "ctrl-v"
|
||||
# controls which keybinding should trigger tv
|
||||
# for command history
|
||||
# "command_history" = "ctrl-r"
|
|
@ -0,0 +1,5 @@
|
|||
# S3
|
||||
[[cable_channel]]
|
||||
name = "vast-s3-releases"
|
||||
source_command = "vast-lab get s3-releases"
|
||||
preview_command = "aws s3 ls s3://vastdata-releases/release_bundles/service-packs/{0}/"
|
Loading…
Add table
Add a link
Reference in a new issue