Skip to content

Instantly share code, notes, and snippets.

@prachauthit
Last active October 18, 2019 01:38
Show Gist options
  • Save prachauthit/77cc27322552e5fa022c55dfd5677157 to your computer and use it in GitHub Desktop.
Save prachauthit/77cc27322552e5fa022c55dfd5677157 to your computer and use it in GitHub Desktop.
startup_project.sh
# Add this to bashrc (may be zshrc) to force run terminal with tmux by default
if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then
tmux attach -t default || tmux new -s default
fi
#!/bin/bash
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
cat <<EOT >> $HOME/.tmux.conf
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-logging'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'
EOT
# prefix + I for first run
#!/bin/bash
ROOT_PATH="$HOME/Documents"
create_dir () {
mkdir $1
cd $1
}
while getopts u:p: option
do
case "${option}"
in
p) PROJECT=${OPTARG};;
esac
done
if [ -z "$PROJECT" ]
then
echo "[-] Please use -p to specify a project's name"
exit
else
## Setting up path
destination="$ROOT_PATH/$PROJECT"
if [ -d "$destination" ]; then
echo "[-] The directory exists, please change the project name"
exit
fi
mkdir -p $destination
cd $destination
nmap="$destination/nmap"
nikto="$destination/nikto"
gobuster="$destination/gobuster"
tmux new-session -d -s $PROJECT
#nmap
create_dir $nmap
tmux new-window -n nmap
#nikto
create_dir $nikto
tmux new-window -d -n nitko
#gobuster
create_dir $gobuster
tmux new-window -d -n gobuster
tmux attach-session -d -t $PROJECT
fi
set -g prefix C-a
bind C-a send-prefix
unbind C-b
#Logging
set -g history-limit 10000
set -g allow-rename off
bind-key j command-prompt -p "join pane from: " "join-pane -s '%%'"
bind-key s command-prompt -p "send pane from: " "join-pane -t '%%'"
#new tab with current path
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
#set color
set -g default-terminal "screen-256color"
set-window-option -g mode-keys vi
set-window-option -g xterm-keys on
set-option -g pane-active-border-fg blue
set-window-option -g window-status-current-bg yellow
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-logging'
#set -g @plugin 'thewtex/tmux-mem-cpu-load'
set -g status-interval 2
set -g status-left "#S #[fg=green,bg=black]#(tmux-mem-cpu-load --colors --interval 2)#[default]"
set -g status-left-length 60
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment