Compare commits

..

2 commits

Author SHA1 Message Date
2e07b6fa54 tmux is actually so cool 2023-01-13 22:48:35 -06:00
ed7bd87ff6 improvements to ssh-serve-files 2023-01-13 22:48:30 -06:00
2 changed files with 48 additions and 29 deletions

View file

@ -1,6 +1,10 @@
#!/usr/bin/env bash
#colors
BOLD="\033[1m"
CYAN="\033[1;36m"
GREEN="\033[1;33m"
END="\033[0m"
help() {
cat <<EOF
@ -21,19 +25,27 @@ if [[ $# -eq 0 ]]; then
exit 1
fi
if [[ -z $BROWSER ]]; then
echo 'please set $BROWSER'
exit 1
fi
PORT=8090
DIR="~/"
DIR='~/'
USER_HOST=$1
shift
while [[ $1 =~ ^- && $1 != "--" ]]; do
echo checking $1
case $1 in
-h | --help)
case $USER_HOST in
-h | --help)
help
exit 0
;;
*)
shift
;;
esac
while [[ $1 =~ ^- && $1 != "--" ]]; do
case $1 in
-p | --port)
shift
PORT=${PORT:+$1}
@ -42,8 +54,8 @@ while [[ $1 =~ ^- && $1 != "--" ]]; do
shift
DIR=${DIR:+$1}
;;
-* | --*)
echo "Invalid option: $opt"
-*)
echo "Invalid option: $1"
help
exit 1
;;
@ -53,13 +65,15 @@ done
URL="http://localhost:$PORT"
echo "connecting to $USER_HOST with port $PORT"
printf "connecting to ${BOLD}%s${END} with port ${GREEN}%s${END}\n" \
"$USER_HOST" "$PORT"
echo "serving directory:"
echo "->>$DIR"
printf " ${BOLD}->>${CYAN} %s${END}\n" "${DIR}"
echo "opening $URL using $BROWSER"
$BROWSER $URL >/dev/null 2>&1 &
printf "opening ${BOLD}%s${END} using %s\n" "$URL" "$BROWSER"
echo '---------------'
"$BROWSER" "$URL" >/dev/null 2>&1 &
# first change directory in case python<3.7
ssh -tL localhost:$PORT:localhost:$PORT $USER_HOST \
ssh -tL localhost:"$PORT":localhost:"$PORT" "$USER_HOST" \
"cd $DIR && python3 -m http.server $PORT"

View file

@ -7,6 +7,7 @@ set -g mouse on
# smart pane switching with awareness of vim splits
set -g prefix C-a
unbind C-b
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
@ -38,21 +39,26 @@ thm_blue="#89b4fa"
thm_orange="#fab387"
thm_black4="#585b70"
set -g status "on"
set -g status-bg "${thm_bg}"
set -g status-style "fg=${thm_magenta}"
set-option -g status on
set-option -g status-interval 2
set-option -g status-justify "centre"
set-option -g status-left-length 60
set-option -g status-right-length 60
set -g status-right '[#S]'
set-option -g window-status-current-style "fg=${thm_orange}"
set-option -g window-status-last-style "fg=${thm_yellow}"
set -g status on
set -g status-style "fg=magenta,bg=default"
set -g status-interval 2
set -g status-justify "centre"
set -g status-left "working on#[fg=cyan,bold] #S"
set -g status-left-length 60
# set -g status-right '[#S]'
set -g status-right "%b %d %Y %l:%M %p"
set -g status-right-length 60
set -g window-status-last-style "fg=${thm_yellow}"
set -g pane-border-lines heavy
active_marker="#[fg=red,bold] λ "
set -g window-status-current-format "#[bg=${thm_bg}]${active_marker}#[fg=green,bold]#W${active_marker}"
# messages
set -g message-style "fg=${thm_orange},bg=${thm_gray},align=centre"
set -g message-command-style "fg=${thm_cyan},bg=${thm_gray},align=centre"
set -g message-style "fg=${thm_orange},bg=${thm_bg},align=centre"
set -g message-command-style "fg=${thm_cyan},bg=${thm_bg},align=centre"
# panes
set -g pane-border-style "fg=${thm_gray}"
@ -63,6 +69,5 @@ setw -g window-status-activity-style "fg=${thm_fg},bg=${thm_bg},none"
setw -g window-status-separator " | "
setw -g window-status-style "fg=${thm_fg},bg=${thm_bg},none"
setw -g clock-mode-colour "${thm_blue}"
setw -g mode-style "fg=${thm_pink} bg=${thm_black4} bold"