Skip to content

Instantly share code, notes, and snippets.

@phongvh
Last active November 6, 2019 07:57
Show Gist options
  • Save phongvh/479d0fbb2da1a575934c5a5ebc2fc95a to your computer and use it in GitHub Desktop.
Save phongvh/479d0fbb2da1a575934c5a5ebc2fc95a to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# Setup a work space called `work` with two windows
# https://blog.damonkelley.me/2016/09/07/tmux-send-keys/
# bind -p to show C-m, C-j
# https://tmuxcheatsheet.com/
# tmux a
# tmux ls
# tmux kill-ses -t objd
# Ctrl+b d
# Ctrl+b ->
# SESSIONNAME="script"
# tmux has-session -t $SESSIONNAME &> /dev/null
# if [ $? != 0 ]
# then
# tmux new-session -s $SESSIONNAME -n script -d
# tmux send-keys -t $SESSIONNAME "~/bin/script" C-m
# fi
# tmux attach -t $SESSIONNAME
session="objd"
export APP_SETTINGS="config.DevelopmentConfig"
export DATABASE_URL="postgresql:///objectdetection_dev"
redis-server --daemonize yes
service postgresql start
# session_root "~/object-detection"
# set up tmux
tmux start-server
# create a new tmux session, starting vim from a saved session in the new window
tmux new-session -d -s $session -n base
tmux send-keys "sleep 2;python3 worker.py" C-m
# Split pane 0 vertiacally by x%
tmux selectp -t 0
tmux splitw -h -p 70
tmux send-keys "sleep 2;python3 manage.py runserver --host=0.0.0.0" C-m
# Select pane 0
# tmux selectp -t 0
# Split pane 1 horizontal by x%
# tmux splitw -v -p 50
# tmux send-keys "sleep 5;" C-m
tmux selectp -t 1
tmux splitw -h -p 60
tmux send-keys "tail -f logfile.log" C-m
# create a new window called network
# tmux new-window -t $session:1 -n network
# tmux send-keys "sleep 5;" C-m
# return to main vim window
tmux select-window -t $session:2
# Finished setup, attach to the tmux session!
tmux attach-session -t $session
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment