Compare commits

..

7 Commits

51 changed files with 734 additions and 733 deletions

3
.gitignore vendored
View File

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

View File

@ -1,50 +1,38 @@
# Sync Sync
Syncs austenwares.com offical bash/zsh/tmux/vim/... config files =========
### Installation Sync syncs tmux/vim/bash config files with one command
- Using Ansible (more setup, easier syncing)
git clone https://gitea.austenwares.com/stonewareslord/sync Usage:
cd sync
virtualenv .env
. .env/bin/activate
pip install -r requirements.txt
./sync.sh TAG[,TAG2...] [ANSIBLE-OPTS]
- Using stow (quicker, easier, less features) ```sh
usage: sync.sh [-h] [-t] [-c] [-b] [-s] [-d]
git clone https://gitea.austenwares.com/stonewareslord/sync ~/sync optional arguements:
cd ~/sync -h Show this help message and exit
stow skel -t Syncs tmux configuration file
# For private -c Syncs other configuration files
git clone https://gitea.austenwares.com/stonewareslord/private -b Syncs Vim bundles
stow private/skel -s Syncs computer with server applications in server.txt
-d Syncs computer with desktop applications in desktop.txt
```
- Stow oneliner Or, install vim bundles and vimrc, customizing which bundles you use first (requires `curl` and `vim` packages):
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 ```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"
```
- Installing vim 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.
vim +'call Initialize()' Or, temporarily load the bashrc (requires `curl` package):
### Examples ```sh
#### Sync all config and remove existing files curl -k -o /tmp/tmprc https://98.26.78.121/gitlab/stonewareslord/Sync/raw/master/tmprc && . /tmp/tmprc ; rm /tmp/tmprc
```
./sync.sh clean --extra-vars 'overwrite_existing=yes' Or, clone the sync project and add all origins automatically:
#### Sync for root ```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.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

View File

@ -1,5 +1,3 @@
[include]
path = .conf.d/gitconfig.custom
[alias] [alias]
i = "!git br&&git st" 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" # 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"
@ -25,7 +23,7 @@
ignore = update-index --assume-unchanged ignore = update-index --assume-unchanged
noignore = update-index --no-assume-unchanged noignore = update-index --no-assume-unchanged
rename-branch = branch -m rename-branch = branch -m
find-file = "!for branch in $(git for-each-ref --format=\"%(refname)\" refs/heads); do if git ls-tree -r --name-only $branch | grep \"$1\" > /dev/null; then echo \"${branch}:\"; git ls-tree -r --name-only $branch | nl -bn -w3 | grep \"$1\"; fi; done; :" find-file = "!for branch in $(git for-each-ref --format=\"%(refname)\" refs/heads); do if git ls-tree -r --name-only $branch | grep \"$1\" > /dev/null; then echo \"${branch}:\"; git ls-tree -r --name-only $branch | nl -bn -w3 | grep \"$1\"; fi; done; :"
[push] [push]
default = matching default = matching
[core] [core]
@ -51,5 +49,3 @@
clean = git-lfs clean -- %f clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f smudge = git-lfs smudge -- %f
process = git-lfs filter-process process = git-lfs filter-process
[pager]
branch = false

2
hosts
View File

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

View File

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

View File

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

@ -1,17 +0,0 @@
---
- 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]}

View File

@ -1 +0,0 @@
ansible

View File

@ -1,13 +0,0 @@
- 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

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

View File

@ -1,31 +0,0 @@
- 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"

View File

@ -1,15 +0,0 @@
- 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

@ -1,22 +0,0 @@
- 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

@ -1,11 +0,0 @@
- 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

@ -1,41 +0,0 @@
- 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"

View File

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

View File

@ -1,29 +0,0 @@
- 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"

9
scripts/update.sh Executable file
View File

@ -0,0 +1,9 @@
#!/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,5 +1,5 @@
!URxvt.boldFont: -misc-fixed-medium-r-semicondensed--13-100-100-100-c-60-iso8859-1 !URxvt.boldFont: -misc-fixed-medium-r-semicondensed--13-100-100-100-c-60-iso8859-1
URxvt.font: -*-*-*-*-*-*-*-*-*-*-*-*-*-* !URxvt.font: -*-*-*-*-*-*-*-*-*-*-*-*-*-*
!URxvt.boldFont: -*-*-*-*-*-*-*-*-*-*-*-*-*-* !URxvt.boldFont: -*-*-*-*-*-*-*-*-*-*-*-*-*-*
!URxvt.font: xft:Fixed:style=SemiCondensed:size=10 !URxvt.font: xft:Fixed:style=SemiCondensed:size=10
!URxvt.font: xft:Inconsolata:size=12 !URxvt.font: xft:Inconsolata:size=12

44
shells/af-magic.zsh-theme Normal file
View File

@ -0,0 +1,44 @@
# 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%}"

257
shells/tmprc Normal file
View File

@ -0,0 +1,257 @@
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

@ -15,12 +15,21 @@ export HISTFILE="$HOME/.zsh_history"
setopt APPEND_HISTORY setopt APPEND_HISTORY
setopt EXTENDED_HISTORY setopt EXTENDED_HISTORY
setopt APPEND_HISTORY SHARE_HISTORY HISTIGNOREALLDUPS setopt APPEND_HISTORY SHARE_HISTORY HISTIGNOREALLDUPS
export DISABLE_AUTO_TITLE=true
export EDITOR='vim' export EDITOR='vim'
export FZF_COMPLETION_OPTS='--no-mouse -m -1 -x' export FZF_COMPLETION_OPTS='--no-mouse -m -1 -x'
zstyle ':completion:*' use-cache on zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.cache/zsh 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 # Check if a command exists
ex() { ex(){
command -v "$1" >/dev/null command -v "$1" >/dev/null
return $? return $?
} }
@ -33,24 +42,67 @@ else
fi fi
# For pasting in commands that start with $ # 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 # Run gui application as root by copying xauth credentials
asroot() { asroot(){
# Use temporary file for added security # Use temporary file for added security
TEMPFILE="$(tempfile)" TEMPFILE=$(tempfile)
xauth extract "$TEMPFILE" "$DISPLAY" xauth extract $TEMPFILE $DISPLAY
sudo zsh -c "xauth merge $TEMPFILE;(srm $TEMPFILE||rm $TEMPFILE)&'$@';" sudo zsh -c "xauth merge $TEMPFILE;(srm $TEMPFILE||rm $TEMPFILE)&'$@';"
} }
# De-symlink # De-symlink
dsl() { dsl() {
while (( $# > 0 )); do while (( $# > 0 )); do
readlink "$1" 2>&1 >/dev/null && mv "$(readlink "$1")" "$1" readlink $1 2>&1 >/dev/null && mv $(readlink $1) $1
shift shift
done 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 # Remove directory by removing subdirectories up a level
dedir() { dedir(){
# Try removing the directory if it's empty, fail silently if you can't # Try removing the directory if it's empty, fail silently if you can't
=rmdir "$1" 2>/dev/null && return =rmdir "$1" 2>/dev/null && return
# Make a uuid to avoid name conflicts # Make a uuid to avoid name conflicts
@ -64,7 +116,7 @@ dedir() {
=rmdir "$name" || return 3 =rmdir "$name" || return 3
} }
# Run multitail on logs # Run multitail on logs
mt() { mt(){
if [[ -z "$1" ]]; then if [[ -z "$1" ]]; then
echo "Opts:\nm xe gitea dm syncthing g" >&2 echo "Opts:\nm xe gitea dm syncthing g" >&2
return 1 return 1
@ -78,39 +130,111 @@ mt() {
syncthing) sudo multitail /var/log/syncthing.{err,log};; syncthing) sudo multitail /var/log/syncthing.{err,log};;
g) sudo watch -c genlop -tc;; g) sudo watch -c genlop -tc;;
sync) watch grep -e Dirty: -e Writeback: /proc/meminfo;; sync) watch grep -e Dirty: -e Writeback: /proc/meminfo;;
*) multitail "$@" *) multitail "$1"
esac esac
} }
run() { run(){
test -f "${1:r}" && rm "${1:r}" test -f "${1:r}" && rm "${1:r}"
echo "Building..." >&2 echo "Building..." >&2
gcc -Wall -g -std=c99 "${1:r}.c" -o "${1:r}" && (echo "Running..." >&2;./"${1:r}") gcc -Wall -g -std=c99 "${1:r}.c" -o "${1:r}" && (echo "Running..." >&2;./"${1:r}")
} }
ex vim && alias vi='vim' upload() {
ex rc-service && alias service='rc-service' 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/'
ex ip && alias ip='ip -c' }
ex adb && alias apush="adb push -p" download() {
ex adb && alias apull="adb pull -p" URL="$(printf $1 | perl -pe 's/\/paste\/view(?!\/raw)/\/paste\/view\/raw/')"
ex mtr && alias mtr='mtr -t' curl "$URL" | base64 -d | tar -xf -
ex telegram-cli && alias tg='telegram-cli -NWA --disable-link-preview' }
ex eix && alias eix="eix -F" update-tool() {
ex tmux && alias tmux='tmux -2' if [ "$EUID" -ne 0 ]; then
ex tree && alias tree='tree -C' echo "This function should be run as root"
ex ocp && alias ocp="ocp -vs0 -dcurses" return 1
alias jupyter='docker run --rm --user="$(id -u):$(id -g)" -v "$PWD":/home/jovyan/work -p 8888:8888 jupyter/scipy-notebook' 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"'
alias afci='git x ./autoformat.sh;git commit -am "Autoformatted"' alias afci='git x ./autoformat.sh;git commit -am "Autoformatted"'
alias con='git x php bin/console' if ex eix; then
alias disphost='export DISPLAY=:0.0' alias eix="eix -F"
alias l='ls -CF' fi
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 mouse1="xmodmap <(echo pointer = 1 2 3)"
alias mouse2="xmodmap <(echo pointer = 3 2 1)" alias mouse2="xmodmap <(echo pointer = 3 2 1)"
alias nmrestart='nmcli radio wifi off;sleep 1;nmcli radio wifi on' if ex ocp; then
alias resource='. ~/.zshrc' alias ocp="ocp -vs0 -dcurses"
fi
alias con='git x php bin/console'
alias srm='shred -uzv' 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 resource='. ~/.zshrc'
if [ "$(uname)" != "Darwin" ]; then if [ "$(uname)" != "Darwin" ]; then
# Not Mac # 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" export PATH="$HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$HOME/.cargo/bin"
@ -128,23 +252,48 @@ fi
if test -f /etc/gentoo-release; then if test -f /etc/gentoo-release; then
# Gentoo # Gentoo
alias etup='sudo etc-update' alias etup='sudo etc-update'
ins() { ins(){
# Sudo echo so we have immediate results on weather sudo worked # Sudo echo so we have immediate results on weather sudo worked
sudo echo "Args: $*" sudo echo "Args: $*"
# Beep, verbose, ask # Beep, verbose, ask
sudo emerge --autounmask-write -Ava $* sudo emerge --autounmask-write -Ava $*
tput bel echo "\a"
} }
if ex eix-sync; then upgrade(){
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 so we have immediate results on weather sudo worked
sudo echo "Args: $*" 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 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
tput bel 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
} }
elif test -f /etc/lsb-release; then elif test -f /etc/lsb-release; then
# Ubuntu # Ubuntu
@ -170,7 +319,9 @@ alias ............='k ../../../../../../../../../../..'
alias .............='k ../../../../../../../../../../../..' alias .............='k ../../../../../../../../../../../..'
alias ..............='k ../../../../../../../../../../../../..' alias ..............='k ../../../../../../../../../../../../..'
alias ...............='k ../../../../../../../../../../../../../..' alias ...............='k ../../../../../../../../../../../../../..'
ex youtube-dl && alias ytdl="youtube-dl -x --audio-format mp3 --audio-quality 0 -c -o '%(title)s.%(ext)s'" if ex youtube-dl; then
alias ytdl="youtube-dl $@ -x --audio-format mp3 --audio-quality 0 -c -o '%(title)s.%(ext)s'"
fi
if ex wemux; then if ex wemux; then
alias tux="wemux" alias tux="wemux"
elif ex tmux; then elif ex tmux; then
@ -180,8 +331,9 @@ if ex git; then
alias g="git" alias g="git"
fi fi
alias stdns="sudo sh -c 'echo nameserver 1.1.1.1 > /etc/resolv.conf'" 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 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)" 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 if ex sudo; then
alias s='sudo -Hu' alias s='sudo -Hu'
@ -194,14 +346,14 @@ if ex rsync; then
fi fi
alias -g nify=" > /dev/null 2>&1 &" alias -g nify=" > /dev/null 2>&1 &"
alias -g nifyd=" > /dev/null 2>&1 & disown" alias -g nifyd=" > /dev/null 2>&1 & disown"
alias -g L="|& less" alias -g L="2>&1|less"
if ex mktemp; then if ex mktemp; then
alias mtmp='pushd "$(mktemp -d)" >/dev/null' alias mtmp='pushd "$(mktemp -d)" >/dev/null'
fi fi
if ex rg; then if ex rg; then
alias -g G='|& rg' alias -g G='|& rg'
alias rg='rg -i' alias rg='rg -i'
# I'm so sorry, ggreer # I'm so sorry ggreer
alias ag=rg alias ag=rg
elif ex ag; then elif ex ag; then
alias -g G='|& ag' alias -g G='|& ag'
@ -210,15 +362,14 @@ elif ex egrep; then
elif ex grep; then elif ex grep; then
alias -g G='|& grep' alias -g G='|& grep'
fi fi
alias bp="tput bel"
timer() { timer() {
for i in {1.."$1"}; do for i in {1.."$1"}; do
sleep 1 sleep 1
echo echo
done | pv -Sptels "$1" >/dev/null done | pv -Sptels "$1" >/dev/null
} }
fixsh() { fixsh(){
sed -i'' -e "${1}d" ~/.ssh/known_hosts sed -i -e $1"d" ~/.ssh/known_hosts
} }
mv() { /bin/mv -v "$@" } mv() { /bin/mv -v "$@" }
m() { mv "$@" } m() { mv "$@" }
@ -241,25 +392,68 @@ linx() {
elif (( $# == 1 )) && [[ -f "$1" ]]; then elif (( $# == 1 )) && [[ -f "$1" ]]; then
linx < "$1" linx < "$1"
else else
tar -cf - "$@" | linx tar -cf - $* | linx
fi fi
} }
ltar() { grename() {
tar -cf - "$@"|pv -WcN tar|xz|pv -WcN lzma 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 -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
#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() { ctar(){
tar -cf - "$@"|pv -WcN tar|gzip|pv -WcN gzip tar -cf - $@|pv -WcN tar|gzip|pv -WcN gzip
} }
offline() { offline(){
if [ ! -z "$@" ] ; then if [ ! -z "$@" ] ; then
sudo unshare -n -- sudo -u "$USER" zsh -c "$@" sudo unshare -n -- sudo -u $USER zsh -c "$@"
else 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 fi
} }
dnstest() { dnstest(){
echo "resolv.conf:" echo "resolv.conf:"
cat /etc/resolv.conf cat /etc/resolv.conf
echo "Testing DNS:" echo "Testing DNS:"
@ -272,9 +466,13 @@ dnstest() {
echo "Testing DNS" echo "Testing DNS"
curl -L portquiz.net curl -L portquiz.net
} }
tsh() { tsh(){
ssh "$@" ssh -X $*
echo "\n\n\n\n\n\n\n\n\n\nSESSION CLOSED\n\n\n\n\n\n\n\n\n\n" 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
} }
compdefas () { compdefas () {
local a local a
@ -284,11 +482,11 @@ compdefas () {
} }
compdefas ssh tsh compdefas ssh tsh
compdefas mv m mv compdefas mv m mv
mcl() { mcl(){
mkdir -p $1 mkdir -p $1
cd $1 cd $1
} }
create-repo() { create-repo(){
PRIVATE="true" PRIVATE="true"
while getopts ":p" opt; do while getopts ":p" opt; do
case $opt in case $opt in
@ -309,7 +507,27 @@ create-repo() {
read -s password read -s password
curl --user "$username:$password" -d name="$1" -d private="$PRIVATE" https://gitea.austenwares.com/api/v1/user/repos curl --user "$username:$password" -d name="$1" -d private="$PRIVATE" https://gitea.austenwares.com/api/v1/user/repos
} }
rc() { 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 case $1 in
z) vim ~/.zshrc;; z) vim ~/.zshrc;;
v) vim ~/.vimrc;; v) vim ~/.vimrc;;
@ -324,7 +542,31 @@ rc() {
*) echo "Opts:\nz v i\nuse make unmask mask accept_keywords keywords license" *) echo "Opts:\nz v i\nuse make unmask mask accept_keywords keywords license"
esac esac
} }
k() { 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 #More than 1 arguement
if [[ $# > 1 ]] ; then if [[ $# > 1 ]] ; then
vim $@ vim $@
@ -381,7 +623,16 @@ if ex fasd; then
eval "$(fasd --init auto)" eval "$(fasd --init auto)"
fi 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 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' echo -ne '[# ]\r'
source ~/.zsh-git/lpr/liquidprompt source ~/.zsh-git/lpr/liquidprompt
source ~/.zsh-git/omg/base.sh source ~/.zsh-git/omg/base.sh

View File

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

View File

@ -1,230 +0,0 @@
[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,61 +0,0 @@
#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

17
sync.sh
View File

@ -1,17 +0,0 @@
#!/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"

View File

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

View File

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

View File

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