diff --git a/Xresources b/Xresources new file mode 100644 index 0000000..a860e7f --- /dev/null +++ b/Xresources @@ -0,0 +1,9 @@ +XTerm*renderFont: true +XTerm*faceName: DejaVu Sans Mono +XTerm*faceSize: 10 +XTerm*maximized: true + +UXTerm*renderFont: true +UXTerm*faceName: DejaVu Sans Mono +UXTerm*faceSize: 10 +UXTerm*maximized: true diff --git a/bash_aliases b/bash_aliases new file mode 100644 index 0000000..dedf2fb --- /dev/null +++ b/bash_aliases @@ -0,0 +1,77 @@ +IP=$(hostname -I | cut -d' ' -f1) +HOSTNAME=`hostname -s` +# ignore +alias ls="ls -alh" + +#Django stuff +alias djrun="source /home/fergalm/dev/personal/deepsouthsounds.com/dss.docker/api_env && python manage.py runserver 0.0.0.0:8001" +alias djshell="python manage.py shell_plus --use-pythonrc --ipython" +alias djdb="python manage.py dbshell" +alias djmigrate="python manage.py schemamigration spa --auto" +alias wole="source ./env/bin/activate" + +alias dss="cd ~/dev/personal/deepsouthsounds.com/dss.api && workon dss.api" +alias dss_radio="cd ~/dev/personal/deepsouthsounds.com/dss.radio && workon dss.radio && docker start dssdocker_icecast_1" + +alias pgdo="sudo -u postgres" +alias pgadmin="docker run -it --rm -v /home/fergalm/working/pgadmin-data:/pgadmin-data --net=host fergalmoran/pgadmin4:latest; xdg-open http://localhost:5050" +alias runmssql="docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=cTXu1nJLCpC/c' -p 1433:1433 -v /home/fergalm/working/mssql-data:/var/opt/mssql -d microsoft/mssql-server-linux" +alias tor="docker run -i -t --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro paulczar/torbrowser" + +alias sqlw="/opt/SqlWorkbench/sqlworkbench.sh &" +alias se="/opt/StorageExplorer/StorageExplorer > /dev/null 2>&1 &" +alias dbv="dbeaver > /dev/null 2>&1 &" +alias rsl="rslsync --config /home/fergalm/.config/resilio-sync/config.json" + +alias reloadbashrc="source ~/.bashrc" +alias server="livereload -p 9999 --host $IP" +alias upd="sudo apt update && sudo apt dist-upgrade && sudo apt autoremove" +alias psql="sudo -u postgres psql deepsouthsounds" +alias code="/usr/bin/code-insiders" +alias c="/usr/bin/code-insiders ." + +alias dbstatus="dropbox.py status" +alias dbignore='find `pwd` -type d -regex ".*\(node_modules\|temp\|tmp\|bower_components\|cache\)$" -prune -exec dropbox exclude add {} \;' +alias dbrm="find . -name \*\'s\ conflicted\ copy\ \* -exec rm {} \;" + +alias ping="ping -O" + +alias pbcopy='xclip -selection clipboard' +alias pbpaste='xclip -selection clipboard -o' +alias iotop='sudo iotop' +alias rmq=' sudo rabbitmqctl' +alias congo='node /srv/dev/working/congo/server.js' + +alias zap='/home/fergalm/working/ZAP/zap.sh > /dev/null 2>&1 &' +alias git-browse="xdg-open \`git remote -v | grep git@github.com | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`" + +alias andconnect='adb connect 10.1.1.102:5555' + +doAgFind(){ + ag --ignore-dir node_modules --ignore-dir bower_components $1 +} +alias ag=doAgFind + +doGrepSearch(){ + find | grep $1 +} +alias f=doGrepSearch + +doPsKill(){ + sudo ps aux | grep -ie $1 | awk '{print $2}' | xargs kill -9 +} +alias pskill=doPsKill + +alias dcx="docker-compose -H podnoms.com:2376 --tlsverify --tlscacert /mnt/niles/sharing/docker-tls/podnoms/ca.pem --tlscert /mnt/niles/sharing/docker-tls/podnoms/cert.pem --tlskey /mnt/niles/sharing/docker-tls/podnoms/key.pem" + +case $HOSTNAME in + (NILES) alias dockerx="docker --tlsverify -H=podnoms.com:2376 --tlscacert=/srv/sharing/docker-tls/podnoms/ca.pem --tlscert=/srv/sharing/docker-tls/podnoms/cert.pem --tlskey=/srv/sharing/docker-tls/podnoms/key.pem";; + (EDDIE) alias dockerx="docker --tlsverify -H=podnoms.com:2376 --tlscacert=/mnt/niles/sharing/docker-tls/podnoms/ca.pem --tlscert=/mnt/niles/sharing/docker-tls/podnoms/cert.pem --tlskey=/mnt/niles/sharing/docker-tls/podnoms/key.pem";; +esac + +if type "$docker" > /dev/null; then + alias docker-nuke="docker rm $(docker ps -a -q) && docker rmi $(docker images -q)" + alias dc='docker-compose' + alias docker-rm-untagged='docker rmi -f $(docker images | grep "^" | awk "{print $3}")' +fi +alias tmux="TERM=screen-256color-bce tmux attach || TERM=screen-256color-bce tmux" diff --git a/bash_functions b/bash_functions new file mode 100644 index 0000000..4ea0f9f --- /dev/null +++ b/bash_functions @@ -0,0 +1,48 @@ +function pips() { + echo $'\n'$1 >> requirements.txt; pip install $1 +} + +<<<<<<< HEAD +function reset_webstorm(){ + cd ~/.WebStorm* + rm config/eval/WebStorm*evaluation.key + rm config/options/options.xml + cd ~/.java/.userPrefs/jetbrains + rm -rf webstorm +} + +======= +>>>>>>> parent of 02ed9ee... WS-2017.2 /dev/null 2>&1; then + echo -e "$_wrn_col""You must have the 'xclip' program installed.\e[0m" + # Check user is not root (root doesn't have access to user xorg server) + elif [[ "$USER" == "root" ]]; then + echo -e "$_wrn_col""Must be regular user (not root) to copy a file to the clipboard.\e[0m" + else + # If no tty, data should be available on stdin + if ! [[ "$( tty )" == /dev/* ]]; then + input="$(< /dev/stdin)" + # Else, fetch input from params + else + input="$*" + fi + if [ -z "$input" ]; then # If no input, print usage message. + echo "Copies a string to the clipboard." + echo "Usage: cb " + echo " echo | cb" + else + # Copy input to clipboard + echo -n "$input" | xclip -selection c + # Truncate text for status + if [ ${#input} -gt 80 ]; then input="$(echo $input | cut -c1-80)$_trn_col...\e[0m"; fi + # Print status. + echo -e "$_scs_col""Copied to clipboard:\e[0m $input" + fi + fi +} + +function gi() { curl -L -s https://www.gitignore.io/api/\$@ ;} + diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..744fec2 --- /dev/null +++ b/install.sh @@ -0,0 +1,91 @@ +# This script creates symlinks from the home directory to any desired dotfiles in ~/dotfiles +############################ +#ignore +########## Variables + +dir=~/dotfiles # dotfiles directory +olddir=~/dotfiles_old # old dotfiles backup directory +files="tmux.conf zshrc bash_aliases bash_functions sqliterc Xresources" # list of files/folders to symlink in homedir + +########## + +# create dotfiles_old in homedir +echo "Creating $olddir for backup of any existing dotfiles in ~" +mkdir -p $olddir +echo "...done" + +# change to the dotfiles directory +echo "Changing to the $dir directory" +cd $dir +echo "...done" + +# move any existing dotfiles in homedir to dotfiles_old directory, then create symlinks +for file in $files; do + echo "Moving any existing dotfiles from ~ to $olddir" + mv ~/.$file ~/dotfiles_old/ + echo "Creating symlink to $file in home directory." + ln -s $dir/$file ~/.$file +done + +# merge Xresources +xrdb -merge ~/.Xresources + +sudo cp -r fonts/* /usr/share/fonts/opentype +fc-cache -f -v +sudo fc-cache -f -v + + +git clone https://github.com/powerline/fonts.git pwfonts +cd pwfonts && ./install.sh + +OMF=~/.oh-my-zsh/oh-my-zsh.sh +if [ ! -f $OMF ]; then + sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +fi + +<<<<<<< HEAD +#install tmux plugin manager +git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm + +======= +>>>>>>> parent of 02ed9ee... WS-2017.2 resize-pane -R 1 +bind - resize-pane -D 1 +bind + resize-pane -U 1 +bind r source-file ~/.tmux.conf + +# switch panes using Alt-arrow without prefix +bind -n M-Left select-pane -L +bind -n M-Right select-pane -R +bind -n M-Up select-pane -U +bind -n M-Down select-pane -D + +set -g pane-border-bg colour235 +set -g pane-border-fg colour238 +set -g pane-active-border-bg colour236 +set -g pane-active-border-fg colour51 + +# Enable mouse control (clickable windows, panes, resizable panes) +set -g mouse on +set -g default-terminal "screen-256color" +# set-window-option -g mode-mouse on +# set-option -g mode-mouse on +# set-option -g mouse-select-pane on +# set-option -g mouse-resize-pane on + + +# } +# The statusbar { + +set -g status-position bottom +set -g status-bg colour234 +set -g status-fg colour137 +set -g status-attr dim +set -g status-left '' +set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S ' +set -g status-right-length 50 +set -g status-left-length 20 + +setw -g window-status-current-fg colour81 +setw -g window-status-current-bg colour238 +setw -g window-status-current-attr bold +setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F ' + +setw -g window-status-fg colour138 +setw -g window-status-bg colour235 +setw -g window-status-attr none +setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F ' + +setw -g window-status-bell-attr bold +setw -g window-status-bell-fg colour255 +setw -g window-status-bell-bg colour1 + +# } +# The messages { + +set -g message-attr bold +set -g message-fg colour232 +set -g message-bg colour166 + +# } + + +# Setup tmux resurrect +# List of plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'tmux-plugins/tmux-resurrect' + +<<<<<<< HEAD +run '~/.tmux/plugins/tpm/tpm' + + +======= +if "test ! -d ~/.tmux/plugins/tpm" \ + "run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'" + +run '~/.tmux/plugins/tpm/tpm' +>>>>>>> parent of 02ed9ee... WS-2017.2