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 #!/usr/bin/env bash
#colors BOLD="\033[1m"
CYAN="\033[1;36m"
GREEN="\033[1;33m"
END="\033[0m"
help() { help() {
cat <<EOF cat <<EOF
@ -21,19 +25,27 @@ if [[ $# -eq 0 ]]; then
exit 1 exit 1
fi fi
if [[ -z $BROWSER ]]; then
echo 'please set $BROWSER'
exit 1
fi
PORT=8090 PORT=8090
DIR="~/" DIR='~/'
USER_HOST=$1 USER_HOST=$1
shift case $USER_HOST in
while [[ $1 =~ ^- && $1 != "--" ]]; do
echo checking $1
case $1 in
-h | --help) -h | --help)
help help
exit 0 exit 0
;; ;;
*)
shift
;;
esac
while [[ $1 =~ ^- && $1 != "--" ]]; do
case $1 in
-p | --port) -p | --port)
shift shift
PORT=${PORT:+$1} PORT=${PORT:+$1}
@ -42,8 +54,8 @@ while [[ $1 =~ ^- && $1 != "--" ]]; do
shift shift
DIR=${DIR:+$1} DIR=${DIR:+$1}
;; ;;
-* | --*) -*)
echo "Invalid option: $opt" echo "Invalid option: $1"
help help
exit 1 exit 1
;; ;;
@ -53,13 +65,15 @@ done
URL="http://localhost:$PORT" 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 "serving directory:"
echo "->>$DIR" printf " ${BOLD}->>${CYAN} %s${END}\n" "${DIR}"
echo "opening $URL using $BROWSER" printf "opening ${BOLD}%s${END} using %s\n" "$URL" "$BROWSER"
$BROWSER $URL >/dev/null 2>&1 & echo '---------------'
"$BROWSER" "$URL" >/dev/null 2>&1 &
# first change directory in case python<3.7 # 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" "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 # smart pane switching with awareness of vim splits
set -g prefix C-a set -g prefix C-a
unbind C-b unbind C-b
bind h select-pane -L bind h select-pane -L
bind j select-pane -D bind j select-pane -D
bind k select-pane -U bind k select-pane -U
@ -38,21 +39,26 @@ thm_blue="#89b4fa"
thm_orange="#fab387" thm_orange="#fab387"
thm_black4="#585b70" thm_black4="#585b70"
set -g status "on" set -g status on
set -g status-bg "${thm_bg}" set -g status-style "fg=magenta,bg=default"
set -g status-style "fg=${thm_magenta}" set -g status-interval 2
set-option -g status on set -g status-justify "centre"
set-option -g status-interval 2
set-option -g status-justify "centre" set -g status-left "working on#[fg=cyan,bold] #S"
set-option -g status-left-length 60 set -g status-left-length 60
set-option -g status-right-length 60 # set -g status-right '[#S]'
set -g status-right '[#S]' set -g status-right "%b %d %Y %l:%M %p"
set-option -g window-status-current-style "fg=${thm_orange}" set -g status-right-length 60
set-option -g window-status-last-style "fg=${thm_yellow}"
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 # messages
set -g message-style "fg=${thm_orange},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_gray},align=centre" set -g message-command-style "fg=${thm_cyan},bg=${thm_bg},align=centre"
# panes # panes
set -g pane-border-style "fg=${thm_gray}" 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-separator " | "
setw -g window-status-style "fg=${thm_fg},bg=${thm_bg},none" setw -g window-status-style "fg=${thm_fg},bg=${thm_bg},none"
setw -g clock-mode-colour "${thm_blue}" setw -g clock-mode-colour "${thm_blue}"
setw -g mode-style "fg=${thm_pink} bg=${thm_black4} bold" setw -g mode-style "fg=${thm_pink} bg=${thm_black4} bold"