Compare commits

..

44 Commits

Author SHA1 Message Date
c076a7ae9e Change supertab url 2018-11-26 13:25:01 -05:00
b2a3bb723a Updated lots of resources 2018-11-26 13:19:49 -05:00
9d05b29000 Add ssh-helper command 2018-11-04 16:20:10 -05:00
f5af1d9952 Modifications 2018-11-04 16:20:10 -05:00
e54bebad64 Add stow oneliner 2018-07-22 10:14:01 -04:00
ca2981a954 Add remote src 2018-07-08 14:54:45 -04:00
b3761b361f Changes 2018-07-08 14:09:49 -04:00
4510552267 Modifications 2018-07-08 14:03:49 -04:00
5fd630c948 Changes 2018-07-08 14:03:22 -04:00
0ba4593214 Changes 2018-07-08 13:59:17 -04:00
ef0e3c01c7 Add dunstrc 2018-07-08 01:25:18 -04:00
521cbd0c2d Continue work 2018-07-08 00:51:09 -04:00
3b1c3037f3 Add base i3status.conf 2018-07-07 16:06:38 -04:00
0af1e2d9d1 Added private again 2018-07-07 13:51:42 -04:00
8a26df4c74 Added 2018-07-07 13:48:09 -04:00
75a18fd7c6 Default to home directory 2018-07-07 00:07:24 -04:00
65252ffe9f Continue documenting 2018-07-06 23:35:28 -04:00
ce711ca6d5 Document stow 2018-07-06 23:33:43 -04:00
925065127f Merge branch 'feature/ansible' of austenwares.com:stonewareslord/sync into feature/ansible 2018-07-06 13:41:44 -04:00
a456bf734c Added venv check 2018-07-06 13:39:37 -04:00
0e928f9f34 Correctly order plug cleaning 2018-07-05 17:18:54 -04:00
7dd3ac24fc Make cleaning directory work properly 2018-07-05 17:15:28 -04:00
e0d6ead5f5 Rework home and add notes to sync.sh 2018-07-05 17:07:42 -04:00
e1d80ce73f Update sync.sh 2018-07-04 14:03:35 -04:00
f1d3ef2616 Update gitconfig 2018-07-04 13:49:36 -04:00
1c0cd58364 Use private directory 2018-07-04 13:46:43 -04:00
7f7a2c7725 Merge branch 'feature/ansible' of austenwares.com:stonewareslord/sync into feature/ansible 2018-07-04 12:45:49 -04:00
73808aad2a Default to home directory 2018-07-04 12:45:46 -04:00
5433ec428d Add working vim sync 2018-07-04 12:39:19 -04:00
06814fbb4a Remove test role 2018-07-04 12:36:58 -04:00
5829a06604 Fix ansible setup 2018-07-02 23:23:08 -04:00
2cab93bad9 Remove update.sh 2018-07-02 22:29:20 -04:00
29d1870eb3 Modify readme 2018-07-02 22:24:45 -04:00
60930b0206 Changes 2018-07-02 22:22:26 -04:00
51db0dbd95 Merge changes from master 2018-07-02 16:01:13 -04:00
337228c244 Allow enabling and disabling password auth 2018-04-12 14:03:25 -04:00
8bf03bbed6 Don't restart networking 2018-04-12 13:46:28 -04:00
1369ee6d15 Use dns 2018-04-12 12:59:03 -04:00
02aa2898a5 Move sshd to handler 2018-04-12 12:39:55 -04:00
bbc5f85972 Continue ansible work 2018-04-07 22:38:20 +00:00
cc9072dbc5 Add ansible, create directory structure 2018-04-07 21:47:15 +00:00
72412817c7 Add skel.vim 2018-03-15 12:50:35 -04:00
c678ce8f14 Add readme 2018-03-15 10:52:14 -04:00
0440bdc0dd Move files to skel 2018-03-15 10:50:49 -04:00
51 changed files with 733 additions and 734 deletions

3
.gitignore vendored
View File

@ -1 +1,4 @@
.stfolder
main.retry
/private
.env

View File

@ -1,38 +1,50 @@
Sync
=========
# Sync
Syncs austenwares.com offical bash/zsh/tmux/vim/... config files
Sync syncs tmux/vim/bash config files with one command
### Installation
- Using Ansible (more setup, easier syncing)
Usage:
git clone https://gitea.austenwares.com/stonewareslord/sync
cd sync
virtualenv .env
. .env/bin/activate
pip install -r requirements.txt
./sync.sh TAG[,TAG2...] [ANSIBLE-OPTS]
```sh
usage: sync.sh [-h] [-t] [-c] [-b] [-s] [-d]
- Using stow (quicker, easier, less features)
optional arguements:
-h Show this help message and exit
-t Syncs tmux configuration file
-c Syncs other configuration files
-b Syncs Vim bundles
-s Syncs computer with server applications in server.txt
-d Syncs computer with desktop applications in desktop.txt
```
git clone https://gitea.austenwares.com/stonewareslord/sync ~/sync
cd ~/sync
stow skel
# For private
git clone https://gitea.austenwares.com/stonewareslord/private
stow private/skel
Or, install vim bundles and vimrc, customizing which bundles you use first (requires `curl` and `vim` packages):
- Stow oneliner
```sh
mkdir -p ~/.vim/plugin/ ~/.vim/backup/ ~/.vim/undo/ ~/.vim/tmp/ ~/.vim/bundle/ ~/.vim/bundle/ ; if [ ! -f ~/.vim/plugin/sessionman.vim ] ; then curl -o ~/.vim/plugin/sessionman.vim http://www.vim.org/scripts/download_script.php?src_id=15599 ; fi ; if [ ! -d ~/.vim/bundle/vundle/ ] ; then git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle ; fi ; curl -o ~/.vimrc -k https://austenwares.com/gitlab/stonewareslord/Sync/raw/master/vimrc ; vim ~/.vimrc +"execute \"normal /Bundle 'gmarik\/vundle'\<CR>\"" +"execute \"normal :nohlsearch\<CR>:function Save()\<CR>w\<CR>BundleInstall\<CR>qa\<CR>endfunction\<CR>\"" +"nnoremap <F2> :call Save()<CR>:so ~/.vimrc<CR>:BundleInstall<CR>" ; echo "Installation should be complete. Run \"vim\" to check"
```
command -v stow >/dev/null && git clone https://gitea.austenwares.com/stonewareslord/sync ~/sync && cd ~/sync && stow skel && git clone git@gitea.austenwares.com:stonewareslord/private && stow private/skel
Usage: run this command and it will automatically load the bundle list with descriptions of each. Delete the ones you don't want to install and press `F2` in normal mode to install al at once.
- Installing vim
Or, temporarily load the bashrc (requires `curl` package):
vim +'call Initialize()'
```sh
curl -k -o /tmp/tmprc https://98.26.78.121/gitlab/stonewareslord/Sync/raw/master/tmprc && . /tmp/tmprc ; rm /tmp/tmprc
```
### Examples
#### Sync all config and remove existing files
Or, clone the sync project and add all origins automatically:
./sync.sh clean --extra-vars 'overwrite_existing=yes'
```sh
mkdir sync&&cd sync&&git init&&git remote add testorigin https://98.26.78.121/gitlab/stonewareslord/Sync.git&&git config http.sslVerify false&&git pull testorigin master&&. bashrc&&git remote rm testorigin&&initify stonewareslord Sync -r
```
#### Sync for root
./sync.sh default --become --ask-become-pass
#### Secure SSH
./sync.sh secure --ask-become-pass --tags
#### Disable SSH password authentication
./sync.sh secure --extra-vars 'disable_passwordauth=true' --ask-become-pass
#### Use 1.1.1.1 dns
./sync.sh dns --ask-become-pass

2
hosts Normal file
View File

@ -0,0 +1,2 @@
[local]
127.0.0.1

17
main.yml Normal file
View File

@ -0,0 +1,17 @@
---
- hosts: all
vars:
install_path: "{{ ansible_env.HOME }}"
sync_path: "{{ install_path }}/sync"
disable_passwordauth: false
enable_passwordauth: false
private_repo: "git@austenwares.com:stonewareslord/private"
overwrite_existing: no
roles:
- {role: core, tags: [core,default]}
- {role: clean, tags: [clean]}
- {role: default, tags: [default]}
- {role: private, tags: [private]}
- {role: youcompleteme, tags: [youcompleteme]}
- {role: secure, become: yes, tags: [secure]}
- {role: dns, tags: [dns]}

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
ansible

View File

@ -0,0 +1,13 @@
- name: Remove files
file:
path: "{{ install_path }}/{{ item.path }}"
state: absent
with_filetree: "skel/"
when: item.state == 'file'
- name: Remove cloned repositories
file:
path: "{{ install_path }}/{{ item }}"
state: absent
loop:
- ".fzf"
- ".vim"

View File

@ -0,0 +1,6 @@
- name: Clone sync project
git:
repo: "https://gitea.austenwares.com/stonewareslord/sync.git"
dest: "{{ sync_path }}"
clone: yes
update: yes

View File

@ -0,0 +1,31 @@
- name: Create directories
file:
path: "{{ install_path }}/{{ item.path }}"
state: directory
force: "{{ overwrite_existing }}"
with_filetree: "skel/"
when: item.state == 'directory'
- name: Delete existing private files
file:
path: "{{ install_path }}/{{ item.path }}"
state: absent
with_filetree: "private/skel/"
when: item.state == 'file'
- name: Link files
file:
src: "{{ sync_path }}/skel/{{ item.path }}"
dest: "{{ install_path }}/{{ item.path }}"
remote_src: yes
state: link
force: "{{ overwrite_existing }}"
with_filetree: "skel/"
when: item.state == 'file'
- name: Clone fzf
git:
repo: "https://gitea.austenwares.com/stonewareslord/fzf.git"
dest: "{{ install_path }}/.fzf"
clone: yes
update: yes
force: yes
- name: Install fzf
shell: "{{ install_path|quote }}/.fzf/install --bin"

15
roles/dns/tasks/main.yml Normal file
View File

@ -0,0 +1,15 @@
- name: Change DNS
lineinfile:
path: /etc/dhcp/dhclient.conf
regexp: '^\s*prepend\s+domain-name-servers'
insertafter: 'prepend\s+domain-name-servers'
state: 'present'
line: 'prepend domain-name-servers 1.0.0.1;'
become: yes
register: changed_dns
#- name: Restart networking
# service:
# name: network
# state: restarted
# become: yes
# when: changed_dns.changed

View File

@ -0,0 +1,22 @@
- name: Clone private repo
git:
repo: "{{ private_repo }}"
dest: "{{ sync_path }}/private"
clone: yes
update: yes
- name: Create priavte directories
file:
path: "{{ install_path }}/{{ item.path }}"
state: directory
force: "{{ overwrite_existing }}"
with_filetree: "private/skel/"
when: item.state == 'directory'
- name: Copy priavte files
copy:
src: "{{ sync_path }}/private/skel/{{ item.path }}"
dest: "{{ install_path }}/{{ item.path }}"
remote_src: yes
mode: 0600
force: "yes"
with_filetree: "private/skel/"
when: item.state == 'file'

View File

@ -0,0 +1,11 @@
- name: Check sshd
shell:
cmd: sshd -t
become: yes
listen: "restart_sshd"
- name: Restart sshd
service:
name: sshd
state: restarted
become: yes
listen: "restart_sshd"

View File

@ -0,0 +1,41 @@
- name: Secure SSH
lineinfile:
path: /etc/ssh/sshd_config
regexp: "{{ item.regexp }}"
# insertbefore: '^\s*Match'
insertbefore: BOF
state: 'present'
line: "{{ item.line }}"
notify: restart_sshd
loop:
- { regexp: '^\s*Protocol\s+2', line: 'Protocol 2' }
- { regexp: '^\s*UseDNS\s+no', line: 'UseDNS no' }
- { regexp: '^\s*PermitEmptyPasswords\s+no', line: 'PermitEmptyPasswords no' }
- { regexp: '^\s*PermitRootLogin\s+without-password', line: 'PermitRootLogin without-password' }
- name: Disable passwordauth
lineinfile:
path: /etc/ssh/sshd_config
regexp: "{{ item.regexp }}"
insertbefore: '^\s*Match'
state: 'present'
line: "{{ item.line }}"
notify: restart_sshd
loop:
- { regexp: '^\s*ChallengeResponseAuthentication\s+no', line: 'ChallengeResponseAuthentication no' }
- { regexp: '^\s*PasswordAuthentication\s+no', line: 'PasswordAuthentication no' }
- { regexp: '^\s*AuthenticationMethods\s+publickey', line: 'AuthenticationMethods publickey' }
when: "disable_passwordauth"
- name: Enable passwordauth
lineinfile:
path: /etc/ssh/sshd_config
regexp: "{{ item.regexp }}"
insertbefore: '^\s*Match'
state: 'present'
line: "{{ item.line }}"
notify: restart_sshd
loop:
- { regexp: '^\s*ChallengeResponseAuthentication\s+yes', line: 'ChallengeResponseAuthentication yes' }
- { regexp: '^\s*PasswordAuthentication\s+yes', line: 'PasswordAuthentication yes' }
- { regexp: '^\s*AuthenticationMethods\s+publickey\s+keyboard-interactive', line: 'AuthenticationMethods publickey keyboard-interactive' }
when: "enable_passwordauth"
- meta: "flush_handlers"

7
roles/vim/tasks/main.yml Normal file
View File

@ -0,0 +1,7 @@
- name: Link files
file:
src: "{{ item.src }}"
dest: "{{ install_path }}/{{ item.path }}"
state: link
force: "{{ overwrite_existing }}"
with_filetree: "skel.vim/"

View File

@ -0,0 +1,29 @@
- name: Check if cargo is installed
shell: command -v cargo >/dev/null 2>&1
register: cargo_exists
ignore_errors: yes
- name: Check if go is installed
shell: command -v go >/dev/null 2>&1
register: go_exists
ignore_errors: yes
# TODO: Figure out how to transform cargo_flag.rc == 0 && echo --racer-completer
- name: Install youcompleteme
shell:
cmd: ./install.py
chdir: "~/.vim/plugged/YouCompleteMe"
when: "go_exists.rc != 0 and cargo_exists.rc != 0"
- name: Install youcompleteme with rust
shell:
cmd: ./install.py --racer-completer
chdir: "~/.vim/plugged/YouCompleteMe"
when: "go_exists.rc != 0 and cargo_exists.rc == 0"
- name: Install youcompleteme with go
shell:
cmd: ./install.py --gocode-completer
chdir: "~/.vim/plugged/YouCompleteMe"
when: "go_exists.rc == 0 and cargo_exists.rc != 0"
- name: Install youcompleteme with rust and go
shell:
cmd: ./install.py --gocode-completer --racer-completer
chdir: "~/.vim/plugged/YouCompleteMe"
when: "go_exists.rc == 0 and cargo_exists.rc == 0"

View File

@ -1,9 +0,0 @@
#!/bin/sh
for DIR in *; do
#[ -d "$DIR" ] && "cd "$DIR" ; pwd"
if [ -d "$DIR" ] ; then
cd "$DIR"
git up
cd ..
fi
done

View File

@ -1,44 +0,0 @@
# af-magic.zsh-theme
# Repo: https://github.com/andyfleming/oh-my-zsh
# Direct Link: https://github.com/andyfleming/oh-my-zsh/blob/master/themes/af-magic.zsh-theme
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
if [ -z "$SSH_TTY" ] && [ -z "$SSH_CONNECTION" ] && [ -z "$SSH_CLIENT" ] ; then
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
else
local return_code="%(?..%{$fg[green]%}%? ↵%{$reset_color%})"
fi
# primary prompt
PROMPT='$FG[032]%~\
$(git_prompt_info) \
$FG[105]%(!.#.$)%{$reset_color%} '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
RPS1='${return_code}'
# »
# color vars
eval my_gray='$FG[237]'
eval my_orange='$FG[214]'
# right prompt
if type "virtualenv_prompt_info" > /dev/null
then
if [[ $EUID -ne 0 ]] && [ -z "$SSH_TTY" ] && [ -z "$SSH_CONNECTION" ] && [ -z "$SSH_CLIENT" ]; then
RPROMPT='$(virtualenv_prompt_info)$my_gray%n@%m%{$reset_color%}%'
else
RPROMPT='$(virtualenv_prompt_info)$my_red%n@%m%{$reset_color%}%'
fi
else
if [[ $EUID -ne 0 ]] && [ -z "$SSH_TTY" ] && [ -z "$SSH_CONNECTION" ] && [ -z "$SSH_CLIENT" ]; then
RPROMPT='$my_gray%n@%m%{$reset_color%}%'
else
RPROMPT='$my_red%n@%m%{$reset_color%}%'
fi
fi
# git settings
ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075](branch:"
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_DIRTY="$my_orange*%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="$FG[075])%{$reset_color%}"

View File

@ -1,257 +0,0 @@
case $- in
*i*) ;;
*) return;;
esac
HISTCONTROL=ignoreboth
shopt -s histappend
shopt -s checkwinsize
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
[ -f /usr/share/autojump/autojump.sh ] && . /usr/share/autojump/autojump.sh
[[ -s /home/stonewareslord/.autojump/etc/profile.d/autojump.sh ]] && source /home/stonewareslord/.autojump/etc/profile.d/autojump.sh
export PATH=/home/stonewareslord/.autojump/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/stonewareslord/tmp/ucpp/ucpp/:/home/stonewareslord/tmp/ucpp/ucpp/:/home/stonewareslord/hitchhikers/bin/ucpp/ucpp:/home/stonewareslord/hitchhikers/bin/ucpp/ucpp
alias bat='upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "state|to\ full|percentage"'
complete -cf sudo man
#Alias definitions.
if [ "$(uname)" != "Darwin" ] ; then
alias ls='ls --color=always -F'
fi
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
#alias vim='vim +"au BufWritePost .vimrc so ~/.vimrc" +"au BufWritePost vimrc so ~/.vimrc"'
alias disphost='export DISPLAY=:0.0'
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias logout='sudo pkill -u $USER'
alias fixsh='ssh-keygen -R'
alias tmux='tmux -2'
alias less='less -r'
alias tree='tree -C'
alias grep="grep --color=auto"
alias skim="(head -5; tail -5) <"
alias cp="cp -v"
alias mv="mv -v"
alias la='ls -lah $LS_COLOR'
alias dt='date "+%F %T"'
alias awake='disphost; while true; do xdotool mousemove 0 0; sleep 60; done'
alias adk='/home/stonewareslord/applications/adk/bin/studio.sh&>/dev/null'
alias resource='. ~/.bashrc'
alias install='sudo apt-get install'
alias search='sudo apt-cache search'
alias remove='sudo apt-get remove'
alias update='sudo apt-get update'
alias upgrade='sudo apt-get upgrade'
alias autoremove='sudo apt-get autoremove'
alias ..='k ..'
alias ...='k ../..'
alias ....='k ../../..'
alias .....='k ../../../..'
alias ......='k ../../../../..'
alias .......='k ../../../../../..'
alias ........='k ../../../../../../..'
alias .........='k ../../../../../../../..'
alias ytdl="youtube-dl $@ -x --audio-format mp3 --audio-quality 0 -c -o '%(title)s.%(ext)s'"
alias tux="tmux a||tmux"
alias rmgit="git remote rm origin;git remote rm https;git remote rm oOrigin;git remote rm oHttps"
alias g="git $@"
function mcl(){ mkdir "$@"&&cl "$@"; }
function cl(){ cd "$@" && ls; }
function k(){
if [ -d "$@" ] ; then
cd "$@" && ls
elif [ "$@" == "-" ] ; then
cd - && ls
elif [ -f "$@" ] ; then
vim "$@"
else
echo -n "Create? "
read a
if [ ! -z $a ] ; then
vim "$@"
fi
fi
}
complete -f k
function ovim(){ vim +"SessionOpen $@"; }
function ogvim(){ gvim +"SessionOpen $@"; }
function tsh(){
ssh $* -X
if which ponysay >/dev/null; then
ponysay "Connection closed!"
else
echo "\n\n\n\n\n\n\n\n\n\nSESSION CLOSED\n\n\n\n\n\n\n\n\n\n"
fi
}
#Functions
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.xz) tar xvf $1 ;;
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
*.tgz) tar xvzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "don't know how to extract '$1'..." ;;
esac
else
echo "'$1' is not a valid file!"
fi
}
export -f extract
function cinitify(){
mkdir $2
cd $2
git init
git remote add origin git@austenwares.com:$1/$2.git
git remote add https https://austenwares.com/gitlab/$1/$2.git
#Offline mode
git remote add oOrigin git@10.0.1.200:$1/$2.git
git remote add oHttps https://10.0.1.200/gitlab/$1/$2.git
git remote -v
echo -n "Pull from: "
read from
git pull $FROM
git co master
}
export -f cinitify
function initify(){
git init
git remote add origin git@austenwares.com:$1/$2.git
git remote add https https://austenwares.com/gitlab/$1/$2.git
#Offline mode
git remote add oOrigin git@10.0.1.200:$1/$2.git
git remote add oHttps https://10.0.1.200/gitlab/$1/$2.git
git remote -v
echo -n "Pull from: "
read from
git pull $FROM
git co master
}
export -f initify
#Color definitions
txtblk='\[\e[0;30m\]' # Black - Regular
txtred='\[\e[0;31m\]' # Red
txtgrn='\[\e[0;32m\]' # Green
txtylw='\[\e[0;33m\]' # Yellow
txtblu='\[\e[0;34m\]' # Blue
txtpur='\[\e[0;35m\]' # Purple
txtcyn='\[\e[0;36m\]' # Cyan
txtwht='\[\e[0;37m\]' # White
bldblk='\[\e[1;30m\]' # Black - Bold
bldred='\[\e[1;31m\]' # Red
bldgrn='\[\e[1;32m\]' # Green
bldylw='\[\e[1;33m\]' # Yellow
bldblu='\[\e[1;34m\]' # Blue
bldpur='\[\e[1;35m\]' # Purple
bldcyn='\[\e[1;36m\]' # Cyan
bldwht='\[\e[1;37m\]' # White
unkblk='\[\e[4;30m\]' # Black - Underline
undred='\[\e[4;31m\]' # Red
undgrn='\[\e[4;32m\]' # Green
undylw='\[\e[4;33m\]' # Yellow
undblu='\[\e[4;34m\]' # Blue
undpur='\[\e[4;35m\]' # Purple
undcyn='\[\e[4;36m\]' # Cyan
undwht='\[\e[4;37m\]' # White
bakblk='\[\e[40m\]' # Black - Background
bakred='\[\e[41m\]' # Red
badgrn='\[\e[42m\]' # Green
bakylw='\[\e[43m\]' # Yellow
bakblu='\[\e[44m\]' # Blue
bakpur='\[\e[45m\]' # Purple
bakcyn='\[\e[46m\]' # Cyan
bakwht='\[\e[47m\]' # White
txtrst='\[\e[0m\]' # Text Reset
#History control
if [ "$BASH" ]; then
parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/' | grep -oE '[^ ]+$'
}
prompt(){
a=`parse_git_branch`
hn=`hostname`
hn=${hn:0:3}
who=`whoami`
who=${who:0:3}
if [ -z $a ] ; then
printf "{$txtgrn%s@%s$txtrst}{$txtred%s$txtrst}>" $who $hn "$PWD"
else
printf "{$txtgrn%s@%s$txtrst}{$txtred%s$txtrst}{$txtblu%s$txtrst}>" $who $hn "$PWD" $(parse_git_branch)
fi
}
PS1=""
PROMPT_COMMAND='PS1=`prompt`'
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }"'echo "`date +'%y.%m.%d-%H:%M:%S:'`" $USER "$(pwd)" "$(history 1 | cut -c8-)" >> ~/.bash_eternal_history'
#PROMPT_COMMAND='PS1="\(\033[0;33m\][\!]\`if [[ \$? = "0" ]]; then echo "\\[\\033[32m\\]"; else echo "\\[\\033[31m\\]"; fi\`[\u.\h: \`if [[ `pwd|wc -c|tr -d " "` > 18 ]]; then echo "\\W"; else echo "\\w"; fi\`]\$\[\033[0m\] "; echo -ne "\033]0;`hostname -s`:`pwd`\007"'
export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="%Y-%m-%d_%H:%M:%S "
export HISTFILE=~/.bash_eternal_history
alias ehistory='cat ~/.bash_eternal_history|grep $@'
readonly HOME
readonly HISTIGNORE
#readonly PROMPT_COMMAND
#readonly HISTSIZE
#readonly HISTFILE
#readonly HISTCONTROL
fi

View File

@ -1,5 +1,5 @@
!URxvt.boldFont: -misc-fixed-medium-r-semicondensed--13-100-100-100-c-60-iso8859-1
!URxvt.font: -*-*-*-*-*-*-*-*-*-*-*-*-*-*
URxvt.font: -*-*-*-*-*-*-*-*-*-*-*-*-*-*
!URxvt.boldFont: -*-*-*-*-*-*-*-*-*-*-*-*-*-*
!URxvt.font: xft:Fixed:style=SemiCondensed:size=10
!URxvt.font: xft:Inconsolata:size=12

View File

@ -0,0 +1,4 @@
# This file can be replaced by using the private tag
[user]
email =
name =

230
skel/.config/dunstrc Normal file
View File

@ -0,0 +1,230 @@
[global]
font = Monospace 9
# allow a small subset of html markup:
# <b>bold</b>
# <i>italic</i>
# <s>strikethrough<s/>
# <u>underline</u>
#
# for a complete reference see http://developer.gnome.org/pango/stable/PangoMarkupFormat.html
# If markup is not allowed, those tags will be stripped out of the message.
allow_markup = yes
# The format of the message. Possible variables are:
# %a appname
# %s summary
# %b body
# %i iconname (including its path)
# %I iconname (without its path)
# %p progress value if set ([ 0%] to [100%]) or nothing
# Markup is allowed
format = "<b>%a:</b> %s\n%b"
# Sort messages by urgency
sort = yes
# Show how many messages are currently hidden (because of geometry)
indicate_hidden = yes
# alignment of message text.
# Possible values are "left", "center" and "right"
alignment = left
# The frequency with wich text that is longer than the notification
# window allows bounces back and forth.
# This option conflicts with 'word_wrap'.
# Set to 0 to disable
bounce_freq = 0
# show age of message if message is older than show_age_threshold seconds.
# set to -1 to disable
show_age_threshold = 60
# split notifications into multiple lines if they don't fit into geometry
word_wrap = yes
# ignore newlines '\n' in notifications
ignore_newline = no
# the geometry of the window
# geometry [{width}]x{height}][+/-{x}+/-{y}]
# The geometry of the message window.
# The height is measured in number of notifications everything else in pixels. If the width
# is omitted but the height is given ("-geometry x2"), the message window
# expands over the whole screen (dmenu-like). If width is 0,
# the window expands to the longest message displayed.
# A positive x is measured from the left, a negative from the
# right side of the screen. Y is measured from the top and down respectevly.
# The width can be negative. In this case the actual width is the
# screen width minus the width defined in within the geometry option.
#geometry = "300x5-30+20"
# The transparency of the window. range: [0; 100]
# This option will only work if a compositing windowmanager is present (e.g. xcompmgr, compiz, etc..)
transparency = 0
# Don't remove messages, if the user is idle (no mouse or keyboard input)
# for longer than idle_threshold seconds.
# Set to 0 to disable.
idle_threshold = 120
# Which monitor should the notifications be displayed on.
monitor = 0
# Display notification on focused monitor. Possible modes are:
# mouse: follow mouse pointer
# keyboard: follow window with keyboard focus
# none: don't follow anything
#
# "keyboard" needs a windowmanager that exports the _NET_ACTIVE_WINDOW property.
# This should be the case for almost all modern windowmanagers.
#
# If this option is set to mouse or keyboard, the monitor option will be
# ignored.
follow = keyboard
# should a notification popped up from history be sticky or
# timeout as if it would normally do.
sticky_history = yes
# The height of a single line. If the height is smaller than the font height,
# it will get raised to the font height.
# This adds empty space above and under the text.
line_height = 0
# Draw a line of 'separatpr_height' pixel height between two notifications.
# Set to 0 to disable
separator_height = 2
# padding between text and separator
padding = 8
# horizontal padding
horizontal_padding = 8
# Define a color for the separator.
# possible values are:
# * auto: dunst tries to find a color fitting to the background
# * foreground: use the same color as the foreground
# * frame: use the same color as the frame.
# * anything else will be interpreted as a X color
separator_color = frame
# print a notification on startup
# This is mainly for error detection, since dbus (re-)starts dunst
# automatically after a crash.
startup_notification = true
# dmenu path
dmenu = /usr/bin/dmenu -p dunst:
# browser for opening urls in context menu
browser = /usr/bin/firefox -new-tab
[frame]
width = 3
color = "#FFFFFF"
[shortcuts]
# shortcuts are specified as [modifier+][modifier+]...key
# available modifiers are 'ctrl', 'mod1' (the alt-key), 'mod2', 'mod3'
# and 'mod4' (windows-key)
# xev might be helpful to find names for keys
# close notification
#close = mod4+m
# close all notifications
#close_all = mod4+shift+m
# redisplay last message(s)
#history = mod4+n
# context menu
#context = mod4+shift+i
[urgency_low]
# IMPORTANT: colors have to be defined in quotation marks.
# Otherwise the '#' and following would be interpreted as a comment.
background = "#121212"
foreground = "#FFFFFF"
timeout = 10
[urgency_normal]
background = "#121212"
foreground = "#FFFFFF"
timeout = 10
[urgency_critical]
background = "#FF0000"
foreground = "#FFFFFF"
timeout = 0
# Every section that isn't one of the above is interpreted as a rules
# to override settings for certain messages.
# Messages can be matched by 'appname', 'summary', 'body' or 'icon'
# and you can override the 'timeout', 'urgency', 'foreground', 'background'
# and 'format'.
# Shell-like globbing will get expanded.
#
# SCRIPTING
# you can specify a script that gets run when the rule matches by setting
# the 'script' option.
# The script will be called as follows:
# script appname summary body icon urgency
# where urgency can be "LOW", "NORMAL" or "CRITICAL".
#
# NOTE: if you don't want a notification to be displayed, set the format to ""
# NOTE: It might be helpful to run dunst -print in a terminal in order to find
# fitting options for rules.
#[espeak]
# summary = "*"
# script = dunst_espeak.sh
#[script-test]
# summary = "*script*"
# script = dunst_test.sh
#[ignore]
## This notification will not be displayed
# summary = "foobar"
# format = ""
[riot]
appname = "Electron"
format = "<b>Riot:</b> %s\n%b"
[telegram]
appname = "Telegram Dektop"
format = "<b>Telegram:</b> %s\n%b"
#[signed_on]
# appname = Pidgin
# summary = "*signed on*"
# urgency = low
#
#[signed_off]
# appname = Pidgin
# summary = *signed off*
# urgency = low
#
#[says]
# appname = Pidgin
# summary = *says*
# urgency = critical
# format = "%s "%b""
#
#[music]
# appname = Amarok
# summary = "Now playing"
# urgency = low
#[twitter]
# appname = Pidgin
# summary = *twitter.com*
# urgency = normal
#

View File

@ -1,3 +1,5 @@
[include]
path = .conf.d/gitconfig.custom
[alias]
i = "!git br&&git st"
# coa = "!for i in $(git branch -a|cut -b3-|grep remotes|sed -e 's/remotes\///'|cut -d/ -f1 --complement|cut -d\ -f1);do git checkout $i;done"
@ -49,3 +51,5 @@
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
[pager]
branch = false

View File

@ -144,7 +144,9 @@ set $yw #ccdc90
set $gn #88b090
set $rd #e89393
# border background text
client.focused #2f2f2f #2f2f2f #ffffff
#client.focused #2f2f2f #2f2f2f #ffffff
#client.focused #ffffff #ffffff #000000
client.focused #6a6a6a #6a6a6a #ffffff
client.unfocused $bg $bg $ia
client.focused_inactive $bg $bg $ac
client.urgent $rd $rd $tx
@ -197,7 +199,6 @@ mode "minecraft" {
}
bindsym $mod+m mode "minecraft"
# Startup
# Monitor setup
exec --no-startup-id "zsh -c 'xrandr --output eDP1 --primary || xrandr --output HDMI3 --primary'"
@ -224,7 +225,7 @@ exec --no-startup-id /usr/bin/numlockx
# Run firefox/firefox-bin
exec --no-startup-id firefox -p a || firefox-bin -p a
# Start syncthing if it hasn't already been started
#exec --no-startup-id /bin/zsh -c 'pidof syncthing||screen -dmS syncthing ~/bin/syncthing'
exec --no-startup-id /bin/zsh -c 'pidof syncthing||screen -dmS syncthing ~/bin/syncthing'
exec --no-startup-id nextcloud
# Start kdeconnect
#exec --no-startup-id "~/bin/indicator-kdeconnect"

View File

@ -0,0 +1,61 @@
#i3status config
general {
output_format= "i3bar"
colors = true
#color_good = '#ffffff'
#color_degraded = '#ffffff'
#color_bad = '#ffffff'
color_good = '#00ff00'
color_degraded = '#ff0000'
color_bad = '#ff0000'
interval = 1
}
order += "disk /"
order += "cpu_usage"
order += "ethernet tun0"
order += "wireless wlp2s0"
order += "ethernet enp1s0"
order += "volume master"
order += "battery 1"
order += "tztime local"
ethernet tun0 {
# if you use %speed, i3status requires root privileges
format_up = "%ip"
format_down = "!T"
}
wireless wlp2s0 {
format_up = "%essid : %ip @ %quality"
format_down = "!W"
}
ethernet enp1s0 {
# if you use %speed, i3status requires root privileges
format_up = "%ip (%speed)"
format_down = "!E"
}
tztime local {
format = "%a %b%e %r"
#:%M:%S
}
load {
format = "%5min"
}
volume master {
format = "V:%volume"
format_muted = "V: 0%"
device = "default"
mixer = "Master"
mixer_idx = 0
}
battery 1 {
#format = "%status %remaining %emptytime"
format = "%status %percentage"
path = "/sys/class/power_supply/BAT1/uevent"
low_threshold = 20
}
disk "/" {
format = "%free"
}
cpu_usage {
format = "CPU: %usage"
}
# vim: ts=4:sw=4:et

View File

@ -1,20 +1,24 @@
#!/usr/bin/env bash
if [ "$1" = "move" ]; then
#!/usr/bin/env zsh
ARG="$1"
shift
if [ "$ARG" = "move" ]; then
shift
eval "$(xdotool getwindowfocus getwindowgeometry | grep Geometry: | perl -pe 's/^\s*Geometry: /WinH=/;s/x/\nWinW=/g')"
eval "$(xdotool getwindowfocus getwindowgeometry | grep Position: | perl -pe 's/^\s*Position: /WinY=/;s/,/\nWinX=/g;s/\s\(.+//')"
eval "$(xrandr | grep -w connected | perl -pe 's/.+?(\d+x\d+)\+\d+\+\d+.*/\1/g;s/^/MonH=/;s/x/\nMonW=/;' | head -n2)"
if [ "$1" = "top" ]; then
if [ "$ARG" = "top" ]; then
echo $((WinY))
xdotool getwindowfocus windowmove $((WinY - 1)) 0
elif [ "$1" = "right" ]; then
elif [ "$ARG" = "right" ]; then
xdotool getwindowfocus windowmove $((MonH - WinH)) $((WinX - 1))
elif [ "$1" = "left" ]; then
elif [ "$ARG" = "left" ]; then
xdotool getwindowfocus windowmove 0 $((WinX - 1))
elif [ "$1" = "bottom" ]; then
elif [ "$ARG" = "bottom" ]; then
xdotool getwindowfocus windowmove $((WinY - 1)) $((MonW - WinW))
fi
elif [ "$1" = "lock" ];then
elif [ "$ARG" = "lock" ];then
#!/bin/bash
declare -i ID
ID=`xinput list | grep -Eo 'TouchPad\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`
declare -i STATE
@ -27,19 +31,19 @@ elif [ "$1" = "lock" ];then
echo "Touchpad enabled."
fi
fi
if [ "$1" = "pass" ];then
if [ "$ARG" = "pass" ];then
pass -c $(ls ~/.password-store/*/*|cut -b-37 --complement|rofi -dmenu|sed -e 's/\.gpg//')
fi
if [ "$1" = "screensaver" ];then
if [ "$ARG" = "screensaver" ];then
cat /tmp/noss||i3lock -di `shuf -n1 -e ~/.i3/wall/*`
fi
if [ "$1" = "wall" ];then
if [ "$ARG" = "wall" ];then
#if [[ -d ~/.i3/wallOM ]];then feh --bg-scale "`shuf -n1 -e ~/.i3/wallOM/*`";else feh --bg-scale "`shuf -n1 -e ~/.i3/wall/*`";fi;
#feh --bg-scale "$(shuf -n1 -e ~/.i3/wallOM/*)"
#feh --bg-scale ~/.i3/image.png
feh --bg-scale "$(shuf -n1 <(realpath /home/stonewareslord/sync/wallpaper/"$(hostname)"/*))"
fi
if [ "$1" = "swap" ];then
if [ "$ARG" = "swap" ];then
python << EOF
import i3
swap = [output for output in i3.get_outputs() if output['active']]
@ -49,7 +53,7 @@ if len(swap) == 2:
i3.command('move', 'workspace to output right')
EOF
fi
if [ "$1" = "boot" ];then
if [ "$ARG" = "boot" ];then
test -f ~/.screenlayout/default.sh && ~/.screenlayout/default.sh
/usr/bin/xset -b
/usr/bin/xset +fp /usr/share/fonts/X11/misc
@ -71,7 +75,7 @@ if [ "$1" = "boot" ];then
xinput --set-prop 'Logitech USB Optical Mouse' 'Device Accel Constant Deceleration' 3
$(which ck-launch-session 2>/dev/null) $(which i3)
fi
if [ "$1" = "screen-lock" ];then
if [ "$ARG" = "screen-lock" ];then
revert(){
xset dpms 0 0 0
}
@ -80,11 +84,11 @@ if [ "$1" = "screen-lock" ];then
slock
revert
fi
if [ "$1" = "paste" ]; then
if [ "$ARG" = "paste" ]; then
sleep 2
DISPLAY=:0.0 xdotool type --clearmodifiers --file <(xsel)
fi
if [ "$1" = "ping" ]; then
if [ "$ARG" = "ping" ]; then
shift
# Return code
local RET=0
@ -93,36 +97,36 @@ if [ "$1" = "ping" ]; then
# -4 : ipv4 only
# check if nc has -z
if nc -h |& grep -q -- -z; then
nc -w 1 -z4 "$1" "$2" >& /dev/null && RET=1
nc -w 1 -z4 "$ARG" "$1" >& /dev/null && RET=1
# check if nc has --transfer (-x)
elif nc -h |& grep -q -- --transfer; then
nc -w 1 -4 "$1" "$2" -x </dev/null >& /dev/null && RET=1
nc -w 1 -4 "$ARG" "$1" -x </dev/null >& /dev/null && RET=1
fi
echo $RET
fi
if [ "$1" = "ip" ]; then
if [ "$ARG" = "ip" ]; then
shift
RET=0
local RET=0
if [ "$(hostname)" = "MMLin" ]; then
if grep -q "$1" < <(ifconfig enp2s0f0); then
if grep -q "$ARG" < <(ifconfig enp2s0f0); then
RET=1
fi
elif [ "$(hostname)" = "G2" ]; then
if grep -q "$1" < <(ifconfig enp1s0;ifconfig wlp2s0); then
if grep -q "$ARG" < <(ifconfig enp1s0;ifconfig wlp2s0); then
RET=1
fi
elif [ "$(hostname)" = "SGen" ]; then
if grep -q "$1" < <(ifconfig enp0s25); then
if grep -q "$ARG" < <(ifconfig enp0s25); then
RET=1
fi
fi
echo $RET
fi
if [ "$1" = "copy" ]; then
if [ "$ARG" = "copy" ]; then
(printf '-chegg ';xsel | perl -pe 's/[^a-zA-Z ]//g;chomp()') | xsel && notify-send "Copied" || notify-send "Error"
fi
if [ "$1" = "screenshot" ]; then
\rm -f ~/last-photo/*
if [ "$ARG" = "screenshot" ]; then
\rm -f ~/last-photo/*(N)
sleep .2
#DISPLAY=:0.0 xfce4-screenshooter -r -s ~/last-photo
local FNAME="$HOME/last-photo/$(date +'%Y-%m-%d_%T').png"
@ -131,7 +135,7 @@ if [ "$1" = "screenshot" ]; then
#DISPLAY=:0.0 scrot -s "$HOME/last-photo/$(date +'%Y-%m-%d_%T').png"
\cp ~/last-photo/* ~/Pictures
fi
if [ "$1" = "shutdownprompt" ]; then
if [ "$ARG" = "shutdownprompt" ]; then
RESP=$(printf 'Sleep\nNMRestart\nShutdown\nRestart\nLogout\n' | rofi -i -dmenu 2>/dev/null)
if [[ ! -z "$RESP" ]]; then
case "$RESP" in
@ -156,13 +160,13 @@ if [ "$1" = "shutdownprompt" ]; then
esac
fi
fi
if [ "$1" = "run" ]; then
if [ "$ARG" = "run" ]; then
PATH="$HOME/bin:/usr/games/bin:$PATH" rofi -show run
fi
if [ "$1" = "window" ]; then
if [ "$ARG" = "window" ]; then
rofi -show window
fi
if [ "$1" = "clip" ]; then
if [ "$ARG" = "clip" ]; then
# Get the rofi-selected index of what to paste
local INDEX="$(gpaste-client --oneline | colrm 80 | rofi -dmenu | perl -pe 's/:.*//')"
# If they made a selection, select it
@ -170,3 +174,32 @@ if [ "$1" = "clip" ]; then
gpaste-client select "$INDEX"
fi
fi
if [ "$ARG" = "ssh_helper" ]; then
if [ -f /proc/net/wireless ]; then
WIRELESS_DEV="$(perl -ne 'print if s/(\w+):.*/\1/' </proc/net/wireless)"
SSID="$(iw dev $WIRELESS_DEV link | perl -ne 'printf if s/\s*SSID: //')"
elif command -v iwgetid >/dev/null; then
SSID="$(iwgetid wlan0 -r)"
elif command -v nmcli >/dev/null; then
SSID="$(nmcli -t -f active,ssid dev wifi | perl -ne 'print if s/yes://;')"
elif command -v termux-wifi-connectioninfo >/dev/null; then
# Android device (termux)
SSID="$(termux-wifi-connectioninfo | perl -ne 'print if s/^\s*"ssid": "(.+)",$/\1/')"
fi
case "$(hostname)" in
sgen|egen|runner2)
SSID=ATTskUYuI2
;;
esac
logger "Found SSID for $(hostname): $SSID"
case "$SSID" in
ATTskUYuI2)
logger "ssh -q -W ${1} 192.168.1.200"
ssh -q -W "${1}" 192.168.1.200
;;
*)
logger "ssh -q -W ${1} -p 23 austenwares.com"
ssh -q -W "${1}" -p 23 austenwares.com
;;
esac
fi

View File

@ -14,10 +14,6 @@ set -g prefix C-a
bind C-a send-prefix
unbind C-b
bind-key -n M-v split-window -h
bind-key -n M-V split-window -v
bind-key -n M-K swap-pane -s :. -t :.- \; select-pane -t :.-
@ -34,9 +30,6 @@ bind-key -n M-[ previous-window
bind-key -n M-] next-window
bind-key -n M-f resize-pane -Z
bind-key H resize-pane -L 5
bind-key J resize-pane -D 5
bind-key K resize-pane -U 5

View File

@ -6,7 +6,6 @@ endif
"let g:formatters_cpp = ['my_custom_cpp']
"let g:formatdef_my_custom_java = '"astyle --mode=java -xc --style=google -j -s2 -xG -S -K -N -xn -xl -n -p -H"'
"let g:formatters_java = ['my_custom_java']
"let g:UltiSnipsUsePythonVersion=3
command! WW %!sudo tee > /dev/null %
"TODO: Fix this
"let g:rbpt_loadcmd_toggle = 1
@ -21,10 +20,14 @@ set grepprg=grep\ -nH\ $*
" Basic, very important mappings {
" Movement {
"Vertical
noremap gj j
noremap gk k
noremap j gj
noremap k gk
nnoremap gj j
nnoremap gk k
nnoremap j gj
nnoremap k gk
vnoremap gj j
vnoremap gk k
vnoremap j gj
vnoremap k gk
"Horizontal
noremap H ^
nnoremap L $
@ -114,6 +117,10 @@ set grepprg=grep\ -nH\ $*
" Trial mappings {
"nnoremap <Leader>o m`o<Esc>``
"nnoremap <Leader>O m`O<Esc>``
" Always search in the forward direction
nnoremap # #/<CR><C-o>
noremap <expr> n (v:searchforward ? 'n' : 'N')
noremap <expr> N (v:searchforward ? 'N' : 'n')
" }
@ -171,6 +178,8 @@ set grepprg=grep\ -nH\ $*
syntax on
" }
"lacheck does not work
let b:ale_linters = {'tex': [ "alex", "chktex", "proselint", "redpen", "vale", "write-good" ]}
"Polyglot conflicts with another latex editor
let g:polyglot_disabled = ['latex']
"Signify
@ -183,29 +192,29 @@ let g:signify_difftool = 'diff'
" \ 'file': '\v\.(exe|so|dll|class)$',
" \ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
" \ }
"Airline
"let g:airline_left_sep='▶'
"let g:airline_right_sep='◀'
"let g:airline#extensions#syntastic#enabled=0
"let g:ycm_show_diagnostics_ui=0
"let g:ycm_path_to_python_interpreter='/usr/bin/python2.7'
"let g:syntastic_cpp_compiler = 'clang++'
"let g:syntastic_cpp_compiler_options = ' -std=c++11 -stdlib=libc++'
"let g:syntastic_cpp_compiler_options = ' -std=c++11'
"let g:airline#extensions#whitespace#enabled=0
"let g:airline#extensions#whitespace#show_message=0
"let g:airline#extensions#tmuxline#enabled=1
"let g:formatprg_cpp="astyle"
"let g:formatprg_args_expr_cpp=" --mode=c --style=1tbs -xe -k1 -j"
" These flags don't work for some reason
" -xn -xc -xl -S
"inoremap <expr><Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
"inoremap <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
"let g:UltiSnipsJumpForwardTrigger="<C-S-Q>"
let g:UltiSnipsUsePythonVersion=3
"let g:UltiSnipsJumpForwardTrigger="<Tab>"
"let g:UltiSnipsExpandTrigger="<S-Tab>"
let g:UltiSnipsExpandTrigger = "<tab>"
let g:UltiSnipsJumpForwardTrigger = "<tab>"
let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
let g:SuperTabDefaultCompletionType = '<C-n>'
let g:AutoPairs = {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`', '$':'$'}
"let g:UltiSnipsExpandTrigger="<C-n>"
"let g:UltiSnipsListSnippets="<C-e>"
"let g:UltiSnipsEditSplit="vertical"
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
"inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
filetype off
if has("win32")
call plug#begin('~/vimfiles/plugged')
@ -231,13 +240,15 @@ endif
"Repeat last tpope command with . | https://github.com/tpope/vim-repeat
"Plug 'https://gitea.austenwares.com/vim/vim-fugitive'
"Great Vim-Git compatibility | https://github.com/tpope/vim-fugitive
"Plug 'https://gitea.austenwares.com/vim/ctrlp.vim'
Plug 'https://gitea.austenwares.com/vim/ctrlp.vim'
"Fuzzy file search | https://github.com/kien/ctrlp.vim
Plug 'https://gitea.austenwares.com/vim/tabular', { 'on': 'Tab' }
"Quickly make tables in vim | https://github.com/godlygeek/tabular
"Plug 'https://gitea.austenwares.com/vim/UltiSnips'
Plug 'https://gitea.austenwares.com/vim/UltiSnips'
"Adds snippet support | https://github.com/sirver/UltiSnips
"Plug 'https://gitea.austenwares.com/vim/vim-snippets'
"Plug 'https://github.com/ajh17/VimCompletesMe'
"Supposed to be a good tab plugin
Plug 'https://gitea.austenwares.com/vim/vim-snippets'
"Add snippets | https://github.com/honza/vim-snippets
Plug 'https://gitea.austenwares.com/vim/eregex.vim'
"Real regexes in vim | https://github.com/othree/eregex.vim
@ -291,6 +302,8 @@ endif
" Staging {
"Plug 'https://gitea.austenwares.com/vim/vim-symfony'
"Plug 'dracula/vim'
Plug 'https://gitea.austenwares.com/vim/ale'
Plug 'https://gitea.austenwares.com/vim/supertab'
"Plug 'idanarye/vim-vebugger'
"Debugger | https://github.com/idanarye/vim-vebugger
@ -337,20 +350,14 @@ function! Initialize()
silent !powershell -command "& { iwr https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -OutFile plug.vim }"
silent! so ~/_vimrc
else
silent !mkdir -p ~/.vim/autoload
silent !mkdir -p ~/.vim/plugin
silent !mkdir -p ~/.vim/backup
silent !mkdir -p ~/.vim/undo
silent !mkdir -p ~/.vim/tmp
silent !mkdir -p ~/.vim/autoload ~/.vim/plugin ~/.vim/backup ~/.vim/undo ~/.vim/tmp
silent !curl -fLo ~/.vim/autoload/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
silent! so ~/.vimrc
endif
silent! PlugClean!
silent! PlugInstall!
silent! PlugUpdate!
silent !vim +"PlugClean" +"PlugInstall" +"PlugUpdate" +"qa"
q
endfunction
set guifont=Gohu\ GohuFont
set guifont=jmk\ Neep\ 10
"inoremap <Tab> <C-R>=g:UltiSnips_Complete()<cr>
"map <unique> <buffer> <LocalLeader>b <Plug>JavagetsetInsertBothGetterSetter
"map <Leader>a O<Esc>:Autoformat<CR>:v/\S/d<CR>:nohlsearch<CR>

View File

@ -1,15 +1,15 @@
b-list() {
if [[ -z "$1" ]]; then
column -t <(borg list "$BORG_REPO")
column -t <(borg list "::")
else
borg list "$BORG_REPO::$1"
borg list "::$1"
fi
}
b-delete() {
while (( $# > 0 )); do
if [[ ! -z "$1" ]]; then
echo "Deleting... $1"
borg delete "$BORG_REPO::$1"
borg delete "::$1"
fi
shift
done
@ -24,16 +24,16 @@ b-create() {
if [[ -f "/home/stonewareslord/syncthing/me/backup/$(hostname)/mount" ]]; then
"$SUDO" "/home/stonewareslord/syncthing/me/backup/$(hostname)/mount"
fi
"$SUDO" borg create -vpsx --exclude-caches --compression lzma,7 --exclude-from "$IGNORE_FILE" $BORG_REPO::$(hostname)-$(uuidgen) / /boot /home
"$SUDO" borg create -vpsx --exclude-caches --compression lzma,7 --exclude-from "$IGNORE_FILE" "::$(hostname)-$(uuidgen)" / /boot /home
}
b-rename() {
borg rename -v "$BORG_REPO::$1" "$2"
borg rename -v "::$1" "$2"
}
b-info() {
borg info "$BORG_REPO::$1"
borg info "::$1"
}
b-diff() {
borg list "$BORG_REPO"
borg list "::"
echo -n "First ID: "
read ID1
echo -n "Second ID: "
@ -60,8 +60,8 @@ b-diff() {
echo "FILE_SIZE_LIST2: $FILE_SIZE_LIST2"
echo "COMPLETED_FILE1: $COMPLETED_FILE1"
echo "COMPLETED_FILE2: $COMPLETED_FILE2"
borg list --short "$BORG_REPO::$ID1" | pv -N "Getting List 1" > "$FILE_LIST1"
borg list --short "$BORG_REPO::$ID2" | pv -N "Getting List 2" > "$FILE_LIST2"
borg list --short "::$ID1" | pv -N "Getting List 1" > "$FILE_LIST1"
borg list --short "::$ID2" | pv -N "Getting List 2" > "$FILE_LIST2"
# Find differences and calculate them
diff <(pv -cN "List 1 Diff" "$FILE_LIST1") <(pv -cN "List 1 Diff" "$FILE_LIST2") > >(ag '^<' | perl -pe 's/^< //' > "$A_DIFFS") > >(ag '^>' | perl -pe 's/^> //' > "$B_DIFFS")
# Truncate everything
@ -88,7 +88,7 @@ b-diff() {
echo "$COMPLETED_FILE2"
}
b-size() {
borg list "$BORG_REPO"
borg list "::"
echo -n "ID: "
read ID
if [ -z "$ID" ]; then
@ -101,7 +101,7 @@ b-size() {
echo "FILE_LIST: $FILE_LIST"
echo "FILE_SIZE_LIST: $FILE_SIZE_LIST"
echo "COMPLETED_FILE: $COMPLETED_FILE"
borg list --short "$BORG_REPO::$ID" | pv -N "Getting List" > "$FILE_LIST"
borg list --short "::$ID" | pv -N "Getting List" > "$FILE_LIST"
while read i
do
test -f /"$i" && du -sh /"$i" 2>/dev/null >> "$FILE_SIZE_LIST"
@ -114,8 +114,8 @@ b-size() {
b-extract() {
local BACKUP="$1"
shift
borg extract "$BORG_REPO::$BACKUP" $*
borg extract "::$BACKUP" $*
}
b-cmd() {
echo "$BORG_REPO" $*
echo "::" $*
}

View File

@ -15,19 +15,10 @@ export HISTFILE="$HOME/.zsh_history"
setopt APPEND_HISTORY
setopt EXTENDED_HISTORY
setopt APPEND_HISTORY SHARE_HISTORY HISTIGNOREALLDUPS
export DISABLE_AUTO_TITLE=true
export EDITOR='vim'
export FZF_COMPLETION_OPTS='--no-mouse -m -1 -x'
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.cache/zsh
compress(){
INFILE="${1:r}.tpxz"
if [ -f "$INFILE" ]; then
echo "Won't replace $1" >&2
return 1
fi
tar --xattrs -I pixz -cpf "$INFILE" $*
}
# Check if a command exists
ex() {
command -v "$1" >/dev/null
@ -42,65 +33,22 @@ else
fi
# For pasting in commands that start with $
$ () {
$*
"$@"
}
# A service implementation
sv () {
command="${@: -1}"
while (( $# > 1 )); do
if [[ "$command" == "i" ]]; then
echo "Status of $1"
rc-service "$1" status
shift
continue
fi
sudo true || return 2
if [[ "$1" == "sshd" ]] || [[ "$1" == "ssh" ]]; then
echo "Checking sshd config..."
sudo sshd -t && echo "Config good. Continuing" || (echo "Aborting due to bad ssh config";return 1)
fi
if [[ "$command" == "r" ]]; then
echo "Restarting $1"
sudo rc-service "$1" restart
elif [[ "$command" == "s" ]]; then
echo "Starting $1"
sudo rc-service "$1" start
elif [[ "$command" == "x" ]]; then
echo "Stopping $1"
sudo rc-service "$1" stop
else
sudo rc-service "$1" "$command"
fi
shift
done
}
compdef _services sv
# Run gui application as root by copying xauth credentials
asroot() {
# Use temporary file for added security
TEMPFILE=$(tempfile)
xauth extract $TEMPFILE $DISPLAY
TEMPFILE="$(tempfile)"
xauth extract "$TEMPFILE" "$DISPLAY"
sudo zsh -c "xauth merge $TEMPFILE;(srm $TEMPFILE||rm $TEMPFILE)&'$@';"
}
# De-symlink
dsl() {
while (( $# > 0 )); do
readlink $1 2>&1 >/dev/null && mv $(readlink $1) $1
readlink "$1" 2>&1 >/dev/null && mv "$(readlink "$1")" "$1"
shift
done
}
# Update the sync project
update-sync-project() {
if [[ ! -L ~/.zshrc ]]; then
echo "zshrc isn't a link"
return 1
fi
local ABSPATH="$(\dirname "$(\dirname "$(\readlink -e ~/.zshrc)")")"
git -C "$ABSPATH" pull origin master
if (( $# > 0 )); then
"$ABSPATH/scripts/sync.sh" $*
fi
}
# Remove directory by removing subdirectories up a level
dedir() {
# Try removing the directory if it's empty, fail silently if you can't
@ -130,7 +78,7 @@ mt(){
syncthing) sudo multitail /var/log/syncthing.{err,log};;
g) sudo watch -c genlop -tc;;
sync) watch grep -e Dirty: -e Writeback: /proc/meminfo;;
*) multitail "$1"
*) multitail "$@"
esac
}
run() {
@ -138,103 +86,31 @@ run(){
echo "Building..." >&2
gcc -Wall -g -std=c99 "${1:r}.c" -o "${1:r}" && (echo "Running..." >&2;./"${1:r}")
}
upload() {
tar -cf - "$*" | base64 | curl --data-urlencode text@- -d title="File uploaded at $(date '+%d/%h/%y %H:%M:%S') on $(hostname)" -d name=$USER -d expire="1440" https://austenwares.com/paste/api/create | sed -e 's/view/view\/raw/'
}
download() {
URL="$(printf $1 | perl -pe 's/\/paste\/view(?!\/raw)/\/paste\/view\/raw/')"
curl "$URL" | base64 -d | tar -xf -
}
update-tool() {
if [ "$EUID" -ne 0 ]; then
echo "This function should be run as root"
return 1
fi
local RESP=""
while [[ "$RESP" != "q" ]]; do
CMD=${RESP:0:1}
case "$CMD" in
u) update -q;;
l) layman -S ;;
g) upgrade;;
e) etc-update;;
p) emerge -Av @preserved-rebuild --usepkg=n --keep-going=y;;
m) emerge -Av @module-rebuild --usepkg=n;;
d) emerge -Ava --depclean;;
h) haskell-updater -- --usepkg=n;;
c) perl-cleaner --reallyall;;
y) python-updater;;
r) revdep-rebuild;;
q) return;;
esac
RESP=${RESP:1}
if [[ ! -z "$RESP" ]]; then
continue
fi
echo "Commands:"
echo "u: update"
echo "l: layman -S"
echo "g: upgrade"
echo "e: etc-update"
echo "p: emerge @preserved-rebuild --usepkg=n --keep-going=y"
echo "m: emerge @module-rebuild --usepkg=n"
echo "d: emerge --ask --depclean"
echo "h: haskell-updater -- --usepkg=n"
echo "c: perl-cleaner --reallyall"
echo "y: python-updater"
echo "r: revdep-rebuild"
echo "q: quit"
echo -n '\a> '
read RESP
done
}
if ex vim; then
alias vi='vim'
fi
if ex rc-service; then
alias service='rc-service'
fi
if ex ip; then
alias ip='ip -c'
fi
if ex adb; then
alias apush="adb push -p"
alias apull="adb pull -p"
fi
alias cleaner="sudo ~/run.sh 'perl-cleaner --reallyall' 'python-updater' 'haskell-updater -- --usepkg=n'"
alias jsonpretty='python -m json.tool'
alias nmrestart='nmcli radio wifi off;nmcli radio wifi on'
if ex mtr; then
alias mtr='mtr -t'
fi
if ex telegram-cli; then
alias tg='telegram-cli -NWA --disable-link-preview'
fi
alias perm='stat -c "%a %n"'
ex vim && alias vi='vim'
ex rc-service && alias service='rc-service'
ex ip && alias ip='ip -c'
ex adb && alias apush="adb push -p"
ex adb && alias apull="adb pull -p"
ex mtr && alias mtr='mtr -t'
ex telegram-cli && alias tg='telegram-cli -NWA --disable-link-preview'
ex eix && alias eix="eix -F"
ex tmux && alias tmux='tmux -2'
ex tree && alias tree='tree -C'
ex ocp && alias ocp="ocp -vs0 -dcurses"
alias jupyter='docker run --rm --user="$(id -u):$(id -g)" -v "$PWD":/home/jovyan/work -p 8888:8888 jupyter/scipy-notebook'
alias afci='git x ./autoformat.sh;git commit -am "Autoformatted"'
if ex eix; then
alias eix="eix -F"
fi
alias con='git x php bin/console'
alias disphost='export DISPLAY=:0.0'
alias l='ls -CF'
alias la='ls -A'
alias less='less -R'
alias ll='ls -AlhF'
alias logout='sudo pkill -u "$USER"'
alias mouse1="xmodmap <(echo pointer = 1 2 3)"
alias mouse2="xmodmap <(echo pointer = 3 2 1)"
if ex ocp; then
alias ocp="ocp -vs0 -dcurses"
fi
alias con='git x php bin/console'
alias srm='shred -uzv'
alias disphost='export DISPLAY=:0.0'
alias ll='ls -AlhF'
alias la='ls -A'
alias l='ls -CF'
alias logout='sudo pkill -u $USER'
if ex tmux; then
alias tmux='tmux -2'
fi
alias less='less -R'
if ex tree; then
alias tree='tree -C'
fi
alias nmrestart='nmcli radio wifi off;sleep 1;nmcli radio wifi on'
alias resource='. ~/.zshrc'
alias srm='shred -uzv'
if [ "$(uname)" != "Darwin" ]; then
# Not Mac
export PATH="$HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$HOME/.cargo/bin"
@ -257,43 +133,18 @@ if test -f /etc/gentoo-release; then
sudo echo "Args: $*"
# Beep, verbose, ask
sudo emerge --autounmask-write -Ava $*
echo "\a"
tput bel
}
if ex eix-sync; then
alias update="sudo eix-sync; tput bel"
elif eix emaint; then
alias update="sudo emaint sync -A; tput bel"
fi
upgrade() {
# Sudo echo so we have immediate results on weather sudo worked
sudo echo "Args: $*"
sudo emerge --update --newuse --deep --verbose --tree --keep-going=y --verbose-conflicts --alert --ask --binpkg-respect-use=y --binpkg-changed-deps=y --backtrack=30 $* @world
echo "\\a"
}
# For emerging with absolute paths
em(){
# Beep, verbose, ask
EMERGE_ARGS="-Ava"
X=""
for var in "$@"
do
if [[ "$var" =~ ^- ]]; then
EMERGE_ARGS="$EMERGE_ARGS $var"
else
X="$X =$var"
fi
done
echo sudo emerge "$EMERGE_ARGS""$X"
sudo emerge "$EMERGE_ARGS""$X"
echo "\a"
}
update(){
# If this is a server computer
sudo rm -f '/usr/portage/metadata/timestamp.chk'
if ex eix-update; then
sudo zsh -c "emaint sync -a&&eix-update"
else
sudo emaint sync -a
fi
sudo -k
if [ "$1" != "-q" ]; then
echo '\a'
fi
tput bel
}
elif test -f /etc/lsb-release; then
# Ubuntu
@ -319,9 +170,7 @@ alias ............='k ../../../../../../../../../../..'
alias .............='k ../../../../../../../../../../../..'
alias ..............='k ../../../../../../../../../../../../..'
alias ...............='k ../../../../../../../../../../../../../..'
if ex youtube-dl; then
alias ytdl="youtube-dl $@ -x --audio-format mp3 --audio-quality 0 -c -o '%(title)s.%(ext)s'"
fi
ex youtube-dl && alias ytdl="youtube-dl -x --audio-format mp3 --audio-quality 0 -c -o '%(title)s.%(ext)s'"
if ex wemux; then
alias tux="wemux"
elif ex tmux; then
@ -331,9 +180,8 @@ if ex git; then
alias g="git"
fi
alias stdns="sudo sh -c 'echo nameserver 1.1.1.1 > /etc/resolv.conf'"
alias fvim="vim -u NONE +\"so ~/.vim/plugged/flappyvird-vim/plugin/flappyvird.vim\" +\"so ~/.vim/plugged/flappyvird-vim/autoload/flappyvird.vim\" +\":FlappyVird\" +\":q\""
#alias fvim="vim -u NONE +\"so ~/.vim/plugged/flappyvird-vim/plugin/flappyvird.vim\" +\"so ~/.vim/plugged/flappyvird-vim/autoload/flappyvird.vim\" +\":FlappyVird\" +\":q\""
alias fk='k `fzf --no-mouse -m -1 -x`'
#alias susp="sudo true&&((slock;sleep 2;nmcli radio wifi off;nmcli radio wifi on)&echo mem | sudo tee /sys/power/state >/dev/null);sudo -k"
alias susp="sudo true && (slock&until echo mem|sudo tee /sys/power/state>/dev/null;do sleep 1;done;sleep 4;nmcli radio wifi off;sleep 3;nmcli radio wifi on)"
if ex sudo; then
alias s='sudo -Hu'
@ -346,14 +194,14 @@ if ex rsync; then
fi
alias -g nify=" > /dev/null 2>&1 &"
alias -g nifyd=" > /dev/null 2>&1 & disown"
alias -g L="2>&1|less"
alias -g L="|& less"
if ex mktemp; then
alias mtmp='pushd "$(mktemp -d)" >/dev/null'
fi
if ex rg; then
alias -g G='|& rg'
alias rg='rg -i'
# I'm so sorry ggreer
# I'm so sorry, ggreer
alias ag=rg
elif ex ag; then
alias -g G='|& ag'
@ -362,6 +210,7 @@ elif ex egrep; then
elif ex grep; then
alias -g G='|& grep'
fi
alias bp="tput bel"
timer() {
for i in {1.."$1"}; do
sleep 1
@ -369,7 +218,7 @@ timer() {
done | pv -Sptels "$1" >/dev/null
}
fixsh() {
sed -i -e $1"d" ~/.ssh/known_hosts
sed -i'' -e "${1}d" ~/.ssh/known_hosts
}
mv() { /bin/mv -v "$@" }
m() { mv "$@" }
@ -392,65 +241,22 @@ linx() {
elif (( $# == 1 )) && [[ -f "$1" ]]; then
linx < "$1"
else
tar -cf - $* | linx
tar -cf - "$@" | linx
fi
}
grename() {
echo incomplete
return
FILES=($*)
REGEX='s///'
echo -n "Command (frneVVVq): "
while read input; do
case $input in
f)
echo "File list:"
printf '%s\n' $FILES
;;
r)
echo "Regex:"
echo "$REGEX"
;;
n)
echo "Simulated replacement:"
perl-rename -n "$REGEX" $FILES
;;
e)
echo "Editing regex..."
TEMPFILE=$(tempfile)
(cat <(printf '%s\n' $FILES);echo;echo "$REGEX") > $TEMPFILE
vim $TEMPFILE +'normal G$h'
REGEX=$(tac $TEMPFILE|grep -m1 '.')
rm $TEMPFILE
;;
VVV)
echo "Actual results:"
perl-rename -v $REGEX $FILES
return
;;
q)
return
;;
esac
echo -n "Command (frneVVVq): "
done
}
bp(){
printf '\a'
}
ltar() {
tar -cf - $@|pv -WcN tar|xz|pv -WcN lzma
tar -cf - "$@"|pv -WcN tar|xz|pv -WcN lzma
#tar -cf - $@|pv -WcN tar -s $(echo $(du -sb $@|awk '{print $1}'|tr '\n' '+')0|bc)|gzip|pv -WcN dest
#tar -cf - $@|pv -WcN tar -s $(echo $(du -sb $@|awk '{print $1}'|tr '\n' '+')0|bc)|gzip|pv -WcN dest
}
ctar() {
tar -cf - $@|pv -WcN tar|gzip|pv -WcN gzip
tar -cf - "$@"|pv -WcN tar|gzip|pv -WcN gzip
}
offline() {
if [ ! -z "$@" ] ; then
sudo unshare -n -- sudo -u $USER zsh -c "$@"
sudo unshare -n -- sudo -u "$USER" zsh -c "$@"
else
sudo unshare -n -- sudo -u $USER LP_MARK_PREFIX=" $(tput setaf 1)(offline)$(tput sgr0) " zsh
sudo unshare -n -- sudo -u "$USER" LP_MARK_PREFIX=" $(tput setaf 1)(offline)$(tput sgr0) " zsh
fi
}
dnstest() {
@ -467,12 +273,8 @@ dnstest(){
curl -L portquiz.net
}
tsh() {
ssh -X $*
if which ponysay >/dev/null; then
ponysay "Connection closed!"
else
ssh "$@"
echo "\n\n\n\n\n\n\n\n\n\nSESSION CLOSED\n\n\n\n\n\n\n\n\n\n"
fi
}
compdefas () {
local a
@ -507,26 +309,6 @@ create-repo(){
read -s password
curl --user "$username:$password" -d name="$1" -d private="$PRIVATE" https://gitea.austenwares.com/api/v1/user/repos
}
hsh(){
FILE="$1"
ARGS=""
while (( $# > 0 )); do
if [[ "md5" = "$1" ]] || [[ "md5sum" = "$1" ]] || [[ "m" = "$1" ]]; then
ARGS="$ARGS "md5sum
elif [[ "sha1" = "$1" ]] || [[ "sha1sum" = "$1" ]] || [[ "s" = "$1" ]]; then
ARGS="$ARGS "sha1sum
elif [[ "sha2" = "$1" ]] || [[ "sha256sum" = "$1" ]]; then
ARGS="$ARGS "sha256sum
elif [[ "sha512" = "$1" ]] || [[ "sha512sum" = "$1" ]]; then
ARGS="$ARGS "sha512sum
fi
shift
done
ARGS=$(echo "$ARGS"|xargs)
echo "Calculating ($ARGS) of \"$FILE\""
echo pv "$FILE" \| pee $ARGS
pv "$FILE" | pee $(echo $ARGS)
}
rc() {
case $1 in
z) vim ~/.zshrc;;
@ -542,30 +324,6 @@ rc(){
*) echo "Opts:\nz v i\nuse make unmask mask accept_keywords keywords license"
esac
}
pub-git-rm(){
if (( $# == 0 )) ; then
git remote rm local
git remote rm ncsu
git remote rm gitlab
git remote rm aws
fi
while (( $# > 0 )) ; do
git remote rm "$1"
shift
done
}
pub-git-push(){
if (( $# == 0 )) ; then
git push local --all && git push local --tags
git push ncsu --all && git push ncsu --tags
git push gitlab --all && git push gitlab --tags
git push aws --all && git push aws --tags
fi
while (( $# > 0 )) ; do
git push "$1" --all && git push "$1" --tags
shift
done
}
k() {
#More than 1 arguement
if [[ $# > 1 ]] ; then
@ -623,16 +381,7 @@ if ex fasd; then
eval "$(fasd --init auto)"
fi
#Old config options that are no longer in use
#alias pg="pcregrep -M"
#if command -v greadlink 2>&1 >/dev/null; then
# alias readlink='greadlink'
#fi
#alias steamo='sudo kill -9 `pidof steam`;sudo unshare -n -- sh -c "ifconfig lo up;sudo -u $USER steam" > /dev/null 2>&1 & disown'
#alias bat='upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "state|to\ full|percentage"'
#alias aoeu='setxkbmap -layout us -option "'
#alias asdf='setxkbmap -layout dvorak -option ""'
#alias sudo='sudo -H'
echo -ne '[# ]\r'
source ~/.zsh-git/lpr/liquidprompt
source ~/.zsh-git/omg/base.sh

17
sync.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
\cd "$(dirname $0)"
if [ -z "$1" ]; then
echo "Usage:"
echo "$0 TAG1[,TAG2] [ANSIBLE-OPTS]"
echo "Available tags:"
echo "$(\ls roles | tr '\n' ' ')"
echo "Example: $0 default,vim"
exit 1
fi
if [ -f .env/bin/activate ]; then
echo "Found virtualenv. Sourcing..."
source .env/bin/activate
fi
TAGS="$1"
shift
ansible-playbook -i 'localhost,' $* main.yml --tags "$TAGS"