Initial commit for dotfiles

Setting up dotfiles with yadm
This commit is contained in:
2022-08-26 22:09:22 +09:30
commit 27e3b132a8
22 changed files with 1648 additions and 0 deletions
+84
View File
@@ -0,0 +1,84 @@
# vim: set filetype=zsh
alias dos2unix='sed "s/$//"'
alias tmux='tmux -2'
# list command
if command -v exa >/dev/null 2>&1; then
alias ls='exa'
else
alias ls='ls --color=auto'
fi
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias ll='\ls -lh'
alias lla='\ls -lha'
alias lt='\ls --color=auto -lhFart'
if command -v lsd >/dev/null 2>&1; then
alias ls='lsd'
alias ll='lsd -l'
alias lla='lsd -la'
fi
# editor
if command -v vim >/dev/null 2>&1; then
alias vi='vim'
fi
if command -v nvim >/dev/null 2>&1; then
alias vim='nvim'
alias vi='nvim'
fi
alias purevim='vim -u NONE'
# tmux
if [[ -n $TMUX ]]; then
alias fzf='fzf-tmux'
fi
# ansible
alias restart-bind='cd ~/src/ansible-playbooks-prod; ansible-playbook -i inventory.yaml restart-bind.yml'
alias update-bind='cd ~/src/ansible-playbooks-prod; ansible-playbook -i inventory.yaml site-setup.yml -l proddns01 -t bind'
alias update-squid='cd ~/src/ansible-playbooks-prod; ansible-playbook -i inventory.yaml site-setup.yml -l prodinf02 -t squid'
alias update-certbot='cd ~/src/ansible-playbooks-prod; ansible-playbook -i inventory.yaml site-setup.yml -l prodinf01 -t certbot'
alias update-haproxy='cd ~/src/ansible-playbooks-prod; ansible-playbook -i inventory.yaml site-setup.yml -l prodhlb -t haproxy'
alias update-firewalls='cd ~/src/ansible-playbooks-prod; ansible-playbook -i inventory.yaml site-setup.yml -t firewall'
alias run-envpatching='cd ~/src/ansible-playbooks-prod; ansible-playbook -i inventory.yaml update-hosts.yml'
alias run-envreboot='cd ~/src/ansible-playbooks-prod; ansible-playbook -i inventory.yaml restart-hosts.yml'
# configs
alias zshconfig="$EDITOR ~/.zshrc"
alias i3config="$EDITOR ~/.config/i3/config"
alias sshconfig="$EDITOR ~/.ssh/config"
alias edithosts="sudoedit /etc/hosts"
alias vimrc="cd ~/.config/nvim/; $EDITOR"
# fix commands
alias ipcalc='~/.local/bin/ipcalc -n'
alias mpv="mpv -hwdec=vdpau"
alias ifstat="/usr/bin/ifstat"
alias snapper="sudo /usr/bin/snapper"
alias ap="~/.local/bin/ansible-playbook"
# LVM
alias lvs='sudo lvs'
alias vgs='sudo vgs'
alias pvs='sudo pvs'
alias lvcreate='sudo lvcreate'
alias lvresize='sudo lvresize'
# BTRFS
alias snapshot_home="sudo btrfs subvol snapshot /mnt/btrfsroot/home /.snaps/home@$(date '+%Y-%m-%d_%H-%M-%S')"
alias snapshot_rootfs="sudo btrfs subvol snapshot /mnt/btrfsroot/rootfs /.snaps/rootfs@$(date '+%Y-%m-%d_%H-%M-%S')"
# youtube-dl
alias soundcloud-dl='youtube-dlc --extract-audio --audio-format vorbis --audio-quality 2'
alias ytdl-playlist='youtube-dlc --ignore-errors --extract-audio --audio-format vorbis --format bestaudio --audio-quality 160K --output "%(title)s.%(ext)s" --yes-playlist'
# python web server
alias websvr='python3 -m http.server 8000'
# powershell
alias powershell='pwsh'
+50
View File
@@ -0,0 +1,50 @@
# vim: set filetype=zsh
# Set pager
export PAGER='less'
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='nvim'
else
export EDITOR='nvim'
fi
# Ansible Settings
export ANSIBLE_NOCOWS=1
export ANSIBLE_VAULT_PASSWORD_FILE=$HOME/.local/bin/ansible-vault-pass-client
# set MPD host
export MPD_HOST="$HOME/.config/mpd/socket"
# pass passwordstore
PASSWORD_STORE_DIR=$HOME/.config/password-store
PASSWORD_STORE_KEY=$HOME/.config/password-store/.gpg-id
# unzip to directory of same name, minus .zip
unzipd () {
zipfile="$1"
zipdir=${1%.zip}
unzip -d "$zipdir" "$zipfile"
}
zshreload () {
source ~/.zshrc
}
winget () {
wget $1 --header="User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36"
}
myip () {curl https://ipinfo.io/ip}
removespaces () {
mv "$1" `echo $1 | tr ' ' '_'`
}
pdf () {xpdf $1 &}
# download youtube playlist to create batchfile
# $1 is the playlist
ytpl-export () {yt-dlp -j --flat-playlist "$1" | jq -r '.id' | sed 's_^_https://youtu.be/_'}