Browse Source

Wrote script to clean up LaTeX build files

Used Shellcheck to change all my scripts to bash and lint them. Exported my
scripts to $PATH. Fixed my liked Arch packages.
red-hat-laptop
Kevin Mok 6 years ago
parent
commit
80ea8653c3
  1. 7
      aliases/zsh_aliases
  2. 4
      configs/i3/config
  3. 29
      dotfiles/vimrc
  4. 2
      dotfiles/zshrc
  5. 3
      scripts/backup.sh
  6. 8
      scripts/change-sink
  7. 7
      scripts/install-arch-pkgs.sh
  8. 0
      scripts/sync-shortcuts
  9. 40
      scripts/texclear
  10. 26
      setup-root.sh
  11. 38
      setup.sh
  12. 2
      txt/pacman-pkgs/aur-pkgs.txt
  13. 24
      txt/pacman-pkgs/nzxt-pkgs.txt
  14. 104
      txt/pacman-pkgs/pacman-pkgs.txt
  15. 23
      txt/tex-build-files.txt

7
aliases/zsh_aliases

@ -39,7 +39,7 @@ function gpdf() {
# for finding files by name
function rf() { find . -name '$1' ; }
# find text inside files
function rg() { grep -nr $1 * ; }
function rg() { grep -nr $1 ; }
function cpd() { cp -avr $1 $2 ; }
alias pk="pkill -f"
@ -122,7 +122,7 @@ alias vlh="alsamixer -c 2"
# alias aptu="sudo apt upgrade"
alias pc="sudo pacman -S"
alias pcr="sudo pacman -Rs"
alias spc="pacman -Qqe > ~/linux-config/txt/pacman-pkgs/pacman-pkgs.txt"
alias xpc="pacman -Qqe > ~/linux-config/txt/pacman-pkgs/nzxt-pkgs.txt"
# alias tri="trizen -S --noconfirm"
alias tri="trizen -S"
@ -342,11 +342,14 @@ alias hs="$spv_dir/src/update-history.sh && hlg"
# function svm() { mv $1 ~/.local/share/Steam/steamapps/common/Stardew\ Valley/Mods ; }
# # }}}
alias shc="cs && shellcheck"
# }}} coding projs #
# school {{{ #
alias pdl="pdflatex"
alias tcl="texclear"
# 343
alias ij="sudo ~/Downloads/idea/bin/idea.sh $silent"

4
configs/i3/config

@ -458,8 +458,8 @@ font pango:Hack 11
# }}} mod key/font #
# media keys {{{ #
bindsym $mod+d exec ~/linux-config/scripts/change-sink.sh dac
bindsym $mod+o exec ~/linux-config/scripts/change-sink.sh line-out
bindsym $mod+d exec ~/linux-config/scripts/change-sink dac
bindsym $mod+o exec ~/linux-config/scripts/change-sink line-out
bindsym XF86AudioRaiseVolume exec --no-startup-id amixer -c 0 sset Master 3+
bindsym XF86AudioLowerVolume exec --no-startup-id amixer -c 0 sset Master 3-

29
dotfiles/vimrc

@ -37,12 +37,17 @@ autocmd Filetype css,htmldjango,html,tex,txt,markdown set tabstop=2 shiftwidth=2
autocmd BufNewFile,BufRead *.md set filetype=markdown
autocmd Filetype markdown set textwidth=0
autocmd BufWritePost key_*.txt !bash ~/linux-config/scripts/shortcuts.sh
" auto-reload vimrc when saved
augroup myvimrc
au!
au BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
augroup END
autocmd BufWritePost key_*.txt !sync-shortcuts
autocmd VimLeave *.tex !texclear %
" " auto-reload vimrc {{{ "
" augroup myvimrc
" au!
" au BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
" augroup END
" " }}} auto-reload vimrc "
" }}} commands for file types "
@ -75,15 +80,18 @@ Plug 'xolox/vim-misc'
" automatically save buffers upon returning to normal mode
Plug '907th/vim-auto-save'
let g:auto_save = 1
" compile LaTeX PDF while writing the file
" Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' }
" provides various functionality for writing LaTeX in Vim
Plug 'lervag/vimtex'
au BufWritePost *.tex silent call Tex_RunLaTeX()
au BufWritePost *.tex silent !pkill -USR1 xdvi.bin
let g:vimtex_view_general_viewer = 'zathura'
let g:vimtex_quickfix_latexlog = {
\ 'overfull' : 0,
\ 'underfull' : 0,
\ 'global' : 0,
\ 'unused' : 0,
\}
" auto-completion for various languages
Plug 'Valloric/YouCompleteMe'
@ -159,6 +167,7 @@ map <F6> :make -C ~/Documents/resume cv<CR>
map <F7> :AutoSaveToggle<CR>
" map <F9> :LLPStartPreview<CR>
map <F9> :VimtexCompile<CR>:VimtexView<CR>
" map <F9> :VimtexCompile<CR>
nnoremap <F10> :set paste<CR>"+p:set nopaste<CR>
" }}} function keys "
@ -221,7 +230,7 @@ nnoremap <leader>rv :source $MYVIMRC<CR>
" replace in entire file
nnoremap <leader>R q:i%s///g<ESC>2F/i
" sort lines
nnoremap <leader>s q:i.,.+sort<ESC>Fsi
nnoremap <leader>so q:i.,.+sort<ESC>Fsi
" set syntax to shell (for dotfiles)
nnoremap <leader>sh :set syn=sh<CR>
" format current line

2
dotfiles/zshrc

@ -108,7 +108,7 @@ if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
fi
# pywal
export PATH="${PATH}:${HOME}/.local/bin/"
export PATH="${PATH}:${HOME}/.local/bin/:${HOME}/linux-config/scripts"
(cat ~/.cache/wal/sequences &)
# keyboard delay/rate

3
scripts/backup.sh

@ -4,9 +4,8 @@
backup_dest=/run/media/kevin/pc-backup/backups/nzxt
# Labels for backup name
PC=${HOST}
distro=arch
datetime=$(date "+%m.%d-%H.%M")
backupfile="$backup_dest/$datetime-$distro.tar.gz"
sudo tar -czpvf $backupfile --exclude=/lost+found --exclude=/mnt --exclude=/proc --exclude=/run --exclude=/sys /
sudo tar -czpvf "$backupfile" --exclude=/lost+found --exclude=/mnt --exclude=/proc --exclude=/run --exclude=/sys /

8
scripts/change-sink.sh → scripts/change-sink

@ -1,18 +1,18 @@
#!/bin/bash
#Device name variable
if [ $1 = "dac" ]; then
if [ "$1" = "dac" ]; then
devicename="alsa_output.usb-FiiO_DigiHug_USB_Audio-01.analog-stereo"
elif [ $1 = "line-out" ]; then
elif [ "$1" = "line-out" ]; then
devicename="alsa_output.pci-0000_00_14.2.analog-stereo"
fi
echo "$devicename"
#change the default sink
pacmd "set-default-sink "$devicename""
pacmd "set-default-sink $devicename"
#move all inputs to the new sink
for app in $(pacmd list-sink-inputs | sed -n -e 's/index:[[:space:]]\([[:digit:]]\)/\1/p');
do
pacmd "move-sink-input $app "$devicename""
pacmd "move-sink-input $app $devicename"
done

7
scripts/install-arch-pkgs.sh

@ -1,4 +1,7 @@
#!/bin/bash
sudo pacman -Sy --needed - < ../txt/pacman-pkgs/pacman-pkgs.txt
sudo trizen -Sy --needed - < ../txt/pacman-pkgs/aur-pkgs.txt
# to-do: fix shellscript error?
pacman -Sy --needed - < ../txt/pacman-pkgs/pacman-pkgs.txt
trizen -Sy --needed - < ../txt/pacman-pkgs/aur-pkgs.txt
# sudo pacman -Sy --needed - < ../txt/pacman-pkgs/pacman-pkgs.txt
# sudo trizen -Sy --needed - < ../txt/pacman-pkgs/aur-pkgs.txt

0
scripts/shortcuts.sh → scripts/sync-shortcuts

40
scripts/texclear

@ -0,0 +1,40 @@
#!/bin/bash
# Delete TeX build files when exiting from Vim or call on directory/directly to
# remove from there.
ext_list="/home/kevin/linux-config/txt/tex-build-files.txt"
raw_exts="$(tr '\n' '|' < $ext_list)"
exts="(${raw_exts::-1})"
echo "$exts"
find_flags=(-maxdepth 1 -type f -regextype gnu-awk -regex)
remove_build_files () {
regex=$2
# echo find "$1" "${find_flags[@]}" "$regex" -delete -print
eval find "$1" "${find_flags[@]}" "$regex" -delete -print
}
# when less than one argument, remove build files in current dir
if [[ "$#" -lt 1 ]]; then
regex=(\"^.*\\."$exts"$\")
remove_build_files . "${regex[0]}"
else
case "$1" in
# if tex file, remove only build files for that file
*.tex)
file=$(readlink -f "$1")
dir=$(dirname "$file")
base="${file%.*}"
regex=(\"^"$base"\\."$exts"$\")
remove_build_files "$dir" "${regex[0]}" ;;
# remove all build files in directory if given valid one
*)
if [[ -d "$1" ]]; then
regex=(\"^.*\\."$exts"$\")
remove_build_files "$1" "${regex[0]}"
else
printf "Give .tex file or directory as argument.\\n"
fi ;;
esac
fi

26
setup-root.sh

@ -1,33 +1,15 @@
#!/bin/zsh
setup_marble=false
#!/bin/bash
linux_config_dir=/home/kevin/linux-config
dot_dir=$linux_config_dir/dotfiles
pc=$(hostname)
# Get directory variables from script.
# List of dotfiles I want to link to system.
dotfiles=(bashrc gitconfig inputrc imwheelrc vimrc Xmodmap Xresources zshrc)
cd $dot_dir
for dotfile in $dotfiles; do
dotfiles=(bashrc inputrc imwheelrc vimrc Xmodmap Xresources zshrc)
cd $dot_dir || exit
for dotfile in "${dotfiles[@]}"; do
# Remove system dotfile.
rm ~/."$dotfile"
# Link dotfile in repository to system dotfile.
cp "$dot_dir"/"$dotfile" ~/."$dotfile"
done
# marble mouse {{{ #
if [[ "$setup_marble" = true ]]; then
config_file_name="10-evdev.conf"
sys_layout_file="/etc/X11/xorg.conf.d/$config_file_name"
config_dir="$linux_config_dir/x/marble-mouse"
# Remove system file.
sudo rm -rf "$sys_layout_file"
# Link config file in repository to system config location.
sudo cp "$config_dir"/"$config_file_name" "$sys_layout_file"
fi
# }}} marble mouse #

38
setup.sh

@ -1,6 +1,6 @@
#!/bin/zsh
#!/bin/bash
setup_marble=true
# setup_marble=true
# vars {{{ #
@ -8,7 +8,6 @@ linux_config_dir=/home/kevin/linux-config
dot_dir=$linux_config_dir/dotfiles
config_dir=$linux_config_dir/configs
sys_config_dir=~/.config
pc=$(hostname)
# }}} vars #
@ -19,8 +18,8 @@ pc=$(hostname)
# Get directory variables from script.
# List of dotfiles I want to link to system.
dotfiles=(bashrc gitconfig inputrc imwheelrc vimrc xinitrc Xmodmap Xresources zshrc)
cd $dot_dir
for dotfile in $dotfiles; do
cd $dot_dir || exit
for dotfile in "${dotfiles[@]}"; do
# Remove system dotfile.
rm ~/."$dotfile"
# Link dotfile in repository to system dotfile.
@ -43,30 +42,29 @@ ln -s "$dot_dir"/nvim "$orig_file" && echo "Setup Neovim config."
# configs {{{ #
cd $linux_config_dir
cd $linux_config_dir || exit
# List of config dirs in system config dir that I want to link to.
config_dirs=(neofetch i3 i3blocks sam-i3blocks ranger)
# config_dirs=(neofetch i3 i3blocks ranger)
for cur_dir in $config_dirs; do
for cur_dir in "${config_dirs[@]}"; do
# Remove system file.
rm -rf "$sys_config_dir"/"$cur_dir"
rm -rf ${sys_config_dir:?}/"$cur_dir"
# Link config file in repository to system config location.
ln -s "$config_dir"/"$cur_dir" "$sys_config_dir"/"$cur_dir" && echo "Linked $cur_dir config."
done
# }}} configs #
# marble mouse {{{ #
# # marble mouse {{{ #
if [[ "$setup_marble" = true ]]; then
config_file_name="10-evdev.conf"
sys_layout_file="/etc/X11/xorg.conf.d/$config_file_name"
config_dir="$linux_config_dir/x/marble-mouse"
# if [[ "$setup_marble" = true ]]; then
# config_file_name="10-evdev.conf"
# sys_layout_file="/etc/X11/xorg.conf.d/$config_file_name"
# config_dir="$linux_config_dir/x/marble-mouse"
# Remove system file.
sudo rm -rf "$sys_layout_file"
# Link config file in repository to system config location.
sudo ln -s "$config_dir"/"$config_file_name" "$sys_layout_file" && echo "Setup Marble mouse config."
fi
# # Remove system file.
# sudo rm -rf "$sys_layout_file"
# # Link config file in repository to system config location.
# sudo ln -s "$config_dir"/"$config_file_name" "$sys_layout_file" && echo "Setup Marble mouse config."
# fi
# }}} marble mouse #
# # }}} marble mouse #

2
txt/pacman-pkgs/aur-pkgs.txt

@ -1,3 +1,5 @@
discord
texlive-localmanager-git
gscreenshot
rxvt-unicode-pixbuf
Hack NF

24
txt/pacman-pkgs/nzxt-pkgs.txt

@ -8,16 +8,21 @@ broadcom-wl
bzip2
chromium
chromium-widevine
cloc
cmake
cmatrix
colordiff
compton
coreutils
cryptsetup
device-mapper
dhcpcd
dialog
diffutils
discord
dmenu
e2fsprogs
evince
fakeroot
feh
file
@ -36,7 +41,7 @@ grep
grub
gscreenshot
gzip
htop
htop-vim-git
i3-gaps
i3blocks
i3status
@ -70,7 +75,9 @@ nvidia
pacman
patch
pciutils
pdfgrep
perl
pipes.sh
pkgconf
procps-ng
psmisc
@ -79,6 +86,7 @@ python-dbus
python-pip
python-pywal
python-setuptools
qdirstat
ranger
redshift
reiserfsprogs
@ -86,16 +94,28 @@ rxvt-unicode-pixbuf
s-nail
sed
shadow
shellcheck
spotify
st
sudo
sysfsutils
sysstat
systemd-numlockontty
systemd-sysvcompat
tar
texinfo
texlive-core
texlive-local-algorithmicx
texlive-local-algorithms
texlive-local-enumitem
texlive-local-hyperref
texlive-local-numprint
texlive-local-pgfplots
texlive-local-tkz-base
texlive-local-tkz-euclide
texlive-localmanager-git
trizen
ttf-dejavu
udiskie
udisks2
unzip
usbutils

104
txt/pacman-pkgs/pacman-pkgs.txt

@ -1,11 +1,7 @@
alsa-utils
autoconf
automake
bash
bc
bison
broadcom-wl
bzip2
chromium
chromium-widevine
cloc
@ -13,159 +9,65 @@ cmake
cmatrix
colordiff
compton
coreutils
cryptsetup
device-mapper
dhcpcd
dialog
diffutils
discord
dmenu
e2fsprogs
evince
fakeroot
feh
file
filesystem
findutils
flex
fzf
gawk
gcc
gcc-libs
gdb
gettext
git
glibc
grep
grub
gscreenshot
gzip
htop-vim-git
i3-gaps
i3blocks
i3status
imwheel
inetutils
iniparser
iproute2
iputils
jfsutils
less
lib32-nvidia-utils
licenses
linux
linux-firmware
linux-headers
logrotate
lolcat
lsof
lvm2
make
man-db
man-pages
mdadm
nano
neofetch
neovim
netctl
noto-fonts
ntfs-3g
nvidia
pacman
patch
pciutils
pdfgrep
perl
pipes.sh
pkgconf
procps-ng
psmisc
pulseaudio
python-dbus
python-pip
python-pywal
python-setuptools
qdirstat
ranger
redshift
reiserfsprogs
rxvt-unicode-pixbuf
s-nail
sed
shadow
shellcheck
spotify
st
sudo
sysfsutils
sysstat
systemd-numlockontty
systemd-sysvcompat
tar
texinfo
texlive-core
trizen
ttf-dejavu
udisks2
unzip
usbutils
util-linux
vi
w3m
which
wireless_tools
wpa_supplicant
xclip
xf86-input-evdev
xf86-input-keyboard
xf86-input-mouse
xf86-input-synaptics
xf86-input-vmmouse
xf86-input-void
xf86-video-amdgpu
xf86-video-ati
xf86-video-dummy
xf86-video-fbdev
xf86-video-intel
xf86-video-nouveau
xf86-video-openchrome
xf86-video-qxl
xf86-video-vesa
xf86-video-vmware
xf86-video-voodoo
xfsprogs
xorg-bdftopcf
xorg-iceauth
xorg-luit
xorg-mkfontdir
xorg-mkfontscale
xorg-server
xorg-sessreg
xorg-smproxy
xorg-x11perf
xorg-xbacklight
xorg-xcmsdb
xorg-xcursorgen
xorg-xdpyinfo
xorg-xdriinfo
xorg-xev
xorg-xgamma
xorg-xhost
xorg-xinit
xorg-xinput
xorg-xkbevd
xorg-xkbutils
xorg-xkill
xorg-xlsatoms
xorg-xlsclients
xorg-xpr
xorg-xprop
xorg-xrandr
xorg-xrefresh
xorg-xset
xorg-xsetroot
xorg-xvinfo
xorg-xwd
xorg-xwininfo
xorg-xwud
zathura
zathura-pdf-poppler
zsh

23
txt/tex-build-files.txt

@ -0,0 +1,23 @@
4tc
aux
bak
bbl
bcf
blg
fdb_latexmk
fls
lof
log
nav
out
pyc
pyo
run\\.xml
snm
swp
synctex\\(busy\\)
synctex\\.gz
tmp
toc
vrb
xref
Loading…
Cancel
Save