Organized alias files and update set-from-git
Split .bash_aliases into other files for git, laptop, PC and school.
This commit is contained in:
@@ -1,166 +0,0 @@
|
|||||||
in_lab=false
|
|
||||||
cd_school="d ~/Documents/School";
|
|
||||||
if [ -d "/h/u3/c7/" ]; then
|
|
||||||
TERM=xterm-256color
|
|
||||||
xmodmap -e "clear Lock"
|
|
||||||
in_lab=true
|
|
||||||
cd_school="d ~";
|
|
||||||
fi
|
|
||||||
|
|
||||||
# system
|
|
||||||
alias l='ls -a'
|
|
||||||
alias ll='ls -alF'
|
|
||||||
alias cs='printf "\033c"'
|
|
||||||
shopt -s dotglob
|
|
||||||
alias reb="sudo shutdown -r 0"
|
|
||||||
alias sd="sudo shutdown 0"
|
|
||||||
alias s="systemctl suspend"
|
|
||||||
alias hst="history"
|
|
||||||
|
|
||||||
# directories
|
|
||||||
# unalias c
|
|
||||||
d() { cd "$@" && ls -a ; }
|
|
||||||
cd_up() { d $(printf "%0.s../" $(seq 1 $1 )) ; }
|
|
||||||
alias "c."="cd_up"
|
|
||||||
alias cdd="d ~/Downloads"
|
|
||||||
alias dsnip="d ~/.vim/plugged/vim-snippets/UltiSnips/"
|
|
||||||
alias csnip="d ~/.vim/UltiSnips/"
|
|
||||||
vdsnip() { vi ~/.vim/plugged/vim-snippets/UltiSnips/"$1".snippets ; }
|
|
||||||
vsnip() { vi ~/.vim/UltiSnips/"$1".snippets ; }
|
|
||||||
|
|
||||||
if $in_lab; then
|
|
||||||
ff() { firefox $1 ; }
|
|
||||||
zip() { tar -zcvf $1.tar.gz $1/ ; }
|
|
||||||
alias nau="nautilus ."
|
|
||||||
else
|
|
||||||
rt() {
|
|
||||||
output="HDMI-0"
|
|
||||||
if [ "$1" = "s" ]
|
|
||||||
# if [ "${1:0:1}" = "s" ]
|
|
||||||
then
|
|
||||||
output="DVI-I-1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
dir="normal"
|
|
||||||
if [ "$2" = "r" ]
|
|
||||||
# if [ "${1:1:2}" = "r" ]
|
|
||||||
then
|
|
||||||
dir="right"
|
|
||||||
fi
|
|
||||||
if [ "$2" = "l" ]
|
|
||||||
then
|
|
||||||
dir="left"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# echo "xrandr --output \"$output\" --rotate \"$dir\""
|
|
||||||
xrandr --output "$output" --rotate "$dir"
|
|
||||||
}
|
|
||||||
|
|
||||||
alias ow7="virtualbox startvm W7"
|
|
||||||
# alias ow7="VBoxManage startvm W7 --type headless"
|
|
||||||
|
|
||||||
chr() { google-chrome $1 ; }
|
|
||||||
alias nem="nemo ."
|
|
||||||
alias spt="speedtest"
|
|
||||||
alias pg="ping -c 5 google.ca"
|
|
||||||
|
|
||||||
alias mt="ok ~/Documents/School/136/calc-textbook.pdf"
|
|
||||||
alias 36t="ok ~/Documents/School/236/236-textbook.pdf"
|
|
||||||
|
|
||||||
alias rcg="d ~/Documents/coding/random-color-generator"
|
|
||||||
alias dcr="d ~/Documents/coding/dcr-logger"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# school
|
|
||||||
alias sch="$cd_school"
|
|
||||||
alias 136="$cd_school/136"
|
|
||||||
alias 236="$cd_school/236"
|
|
||||||
alias pr2="$cd_school/136/par/2"
|
|
||||||
alias psy="$cd_school/psy"
|
|
||||||
|
|
||||||
# 209
|
|
||||||
alias ll="ls -l"
|
|
||||||
alias 209="$cd_school/209"
|
|
||||||
alias 9r="$cd_school/209/mokkar"
|
|
||||||
alias l3="$cd_school/209/mokkar/lab3"
|
|
||||||
alias a1="$cd_school/209/mokkar/a1"
|
|
||||||
# alias cdf="ssh -t mokkar@cdf.utoronto.ca '. ./.bashrc; bash -l'"
|
|
||||||
alias cdf="echo \". ./.bashrc\"&& ssh mokkar@cdf.utoronto.ca"
|
|
||||||
|
|
||||||
ca12() {
|
|
||||||
gcc -Wall -std=gnu99 -g -o validate_sin.out validate_sin.c sin_helpers.c
|
|
||||||
./validate_sin.out 810620716
|
|
||||||
}
|
|
||||||
ca1() {
|
|
||||||
gcc -Wall -std=gnu99 -g -o count_large.out count_large.c
|
|
||||||
# ll | ./count_large.out 4000
|
|
||||||
./count_large.out 0 rw------- < ll.txt
|
|
||||||
}
|
|
||||||
cl3() {
|
|
||||||
gcc -Wall -std=gnu99 -g -o split_array.out split_array.c
|
|
||||||
./split_array.out 1 2 3
|
|
||||||
}
|
|
||||||
c9() {
|
|
||||||
gcc -Wall -std=gnu99 -g -o "${1%.*}.out" "$1" -lm
|
|
||||||
}
|
|
||||||
c9r() {
|
|
||||||
gc9 $1
|
|
||||||
./"${1%.*}.out"
|
|
||||||
}
|
|
||||||
c9i() {
|
|
||||||
gc9 $1
|
|
||||||
./"${1%.*}.out" < $2
|
|
||||||
}
|
|
||||||
mkex() { chmod 700 $1 ; }
|
|
||||||
|
|
||||||
# apps
|
|
||||||
ok() { okular $1 ; }
|
|
||||||
|
|
||||||
# config
|
|
||||||
alias lc="d ~/linux-config"
|
|
||||||
alias vb="vi ~/.bash_aliases"
|
|
||||||
alias vv="vi ~/.vimrc"
|
|
||||||
alias r=". ~/.bashrc"
|
|
||||||
|
|
||||||
# git
|
|
||||||
# . ~/.secure
|
|
||||||
alias gs="git status -u"
|
|
||||||
alias gpl="git pull --rebase"
|
|
||||||
alias grbc="git rebase --continue"
|
|
||||||
alias gps="git push"
|
|
||||||
alias vig="vi .gitignore"
|
|
||||||
alias ga="git add -A *"
|
|
||||||
alias gai="git add .gitignore"
|
|
||||||
alias gd="git diff -w"
|
|
||||||
alias gdc="git diff --cached"
|
|
||||||
alias gstore="git config credential.helper store"
|
|
||||||
gcm(){ git commit -m "$1" ; }
|
|
||||||
alias gc="git commit"
|
|
||||||
alias gl="git log"
|
|
||||||
alias gsl="git shortlog"
|
|
||||||
alias gst="git stash"
|
|
||||||
alias gstp="git stash pop"
|
|
||||||
alias gclear="git stash clear"
|
|
||||||
gcho() { git checkout $1 ; }
|
|
||||||
gremotes() {
|
|
||||||
git remote set-url --add --push origin $1
|
|
||||||
git remote set-url --add --push origin $2
|
|
||||||
}
|
|
||||||
|
|
||||||
# idea
|
|
||||||
alias jh="echo $JAVA_HOME"
|
|
||||||
alias jv="java -version"
|
|
||||||
# alias idea=". ~/Desktop/idea.sh"
|
|
||||||
# alias idea=". ~/usr/idea-IC-172.4343.14/bin/idea.sh"
|
|
||||||
# alias jf="export JAVA_HOME=/home/kevin/usr/jdk1.8.0_151 && export PATH=$JAVA_HOME/bin:$PATH"
|
|
||||||
|
|
||||||
# g(){ gvim $1 ; }
|
|
||||||
# md() {
|
|
||||||
# multimarkdown -f -o $1.html $1.md
|
|
||||||
# if $in_lab; then
|
|
||||||
# ff $1.html
|
|
||||||
# fi
|
|
||||||
# }
|
|
||||||
|
|
||||||
rs(){ redshift -O $(($1 * 1000)) ; }
|
|
||||||
alias rx="redshift -x"
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
# ~/.profile: executed by the command interpreter for login shells.
|
|
||||||
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
|
|
||||||
# exists.
|
|
||||||
# see /usr/share/doc/bash/examples/startup-files for examples.
|
|
||||||
# the files are located in the bash-doc package.
|
|
||||||
|
|
||||||
# the default umask is set in /etc/profile; for setting the umask
|
|
||||||
# for ssh logins, install and configure the libpam-umask package.
|
|
||||||
#umask 022
|
|
||||||
|
|
||||||
# if running bash
|
|
||||||
if [ -n "$BASH_VERSION" ]; then
|
|
||||||
# include .bashrc if it exists
|
|
||||||
if [ -f "$HOME/.bashrc" ]; then
|
|
||||||
. "$HOME/.bashrc"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# set PATH so it includes user's private bin directories
|
|
||||||
PATH="$HOME/bin:$HOME/.local/bin:$PATH"
|
|
||||||
|
|
||||||
if [ ! -d "/h/u3/c7/" ]; then
|
|
||||||
export JAVA_HOME=/home/kevin/usr/java/jdk1.8.0_151/bin
|
|
||||||
export PATH=$JAVA_HOME/bin:$PATH
|
|
||||||
|
|
||||||
export QSYS_ROOTDIR="/home/kevin/usr/altera_lite/16.0/quartus/sopc_builder/bin"
|
|
||||||
export PATH=$PATH:/home/kevin/usr/altera_lite/16.0/quartus/bin/
|
|
||||||
export PATH=$PATH:/home/kevin/usr/altera_lite/16.0/modelsim_ase/linuxaloem
|
|
||||||
fi
|
|
||||||
|
|
||||||
xmodmap -e "clear Lock"
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
set guifont=Monospace\ 12
|
|
||||||
@@ -46,7 +46,7 @@ let g:SuperTabDefaultCompletionType = '<C-n>'
|
|||||||
" better key bindings for UltiSnipsExpandTrigger
|
" better key bindings for UltiSnipsExpandTrigger
|
||||||
let g:UltiSnipsExpandTrigger = "<tab>"
|
let g:UltiSnipsExpandTrigger = "<tab>"
|
||||||
let g:UltiSnipsJumpForwardTrigger = "<tab>"
|
let g:UltiSnipsJumpForwardTrigger = "<tab>"
|
||||||
let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
|
let g:UltiSnipsJumpBackwardTrigger = "<C-tab>"
|
||||||
|
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
@@ -61,3 +61,7 @@ set pastetoggle=<F9>
|
|||||||
map <F10> :PlugInstall<CR>
|
map <F10> :PlugInstall<CR>
|
||||||
map <C-Enter> o<ESC>
|
map <C-Enter> o<ESC>
|
||||||
map <S-Enter> O<ESC>
|
map <S-Enter> O<ESC>
|
||||||
|
|
||||||
|
let mapleader="\<Space>"
|
||||||
|
" nnoremap <leader>Enter oit<Tab>
|
||||||
|
nnoremap <leader>s :set syn=sh<CR>
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
set runtimepath+=~/.vim_runtime
|
|
||||||
|
|
||||||
source ~/.vim_runtime/vimrcs/basic.vim
|
|
||||||
source ~/.vim_runtime/vimrcs/filetypes.vim
|
|
||||||
source ~/.vim_runtime/vimrcs/plugins_config.vim
|
|
||||||
source ~/.vim_runtime/vimrcs/extended.vim
|
|
||||||
|
|
||||||
try
|
|
||||||
source ~/.vim_runtime/my_configs.vim
|
|
||||||
catch
|
|
||||||
endtry
|
|
||||||
41
dotfiles/aliases/.bash_aliases
Normal file
41
dotfiles/aliases/.bash_aliases
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
alias_folder="~/linux-config/dotfiles/aliases"
|
||||||
|
alias_type="school git pc laptop"
|
||||||
|
for type in $alias_type; do
|
||||||
|
. ~/linux-config/dotfiles/aliases/."$type"_aliases
|
||||||
|
done
|
||||||
|
|
||||||
|
# system
|
||||||
|
alias l='ls -a'
|
||||||
|
alias ll='ls -alF'
|
||||||
|
alias cs='printf "\033c"'
|
||||||
|
shopt -s dotglob
|
||||||
|
alias reb="sudo shutdown -r 0"
|
||||||
|
alias sd="sudo shutdown 0"
|
||||||
|
alias s="systemctl suspend"
|
||||||
|
alias hst="history"
|
||||||
|
|
||||||
|
# directories
|
||||||
|
# unalias c
|
||||||
|
d() { cd "$@" && ls -a ; }
|
||||||
|
cd_up() { d $(printf "%0.s../" $(seq 1 $1 )) ; }
|
||||||
|
alias "c."="cd_up"
|
||||||
|
alias cdd="d ~/Downloads"
|
||||||
|
alias dsnip="d ~/.vim/plugged/vim-snippets/UltiSnips/"
|
||||||
|
alias csnip="d ~/.vim/UltiSnips/"
|
||||||
|
vdsnip() { vi ~/.vim/plugged/vim-snippets/UltiSnips/"$1".snippets ; }
|
||||||
|
vsnip() { vi ~/.vim/UltiSnips/"$1".snippets ; }
|
||||||
|
|
||||||
|
# apps
|
||||||
|
ok() { okular $1 ; }
|
||||||
|
|
||||||
|
# config
|
||||||
|
alias lc="d ~/linux-config/dotfiles"
|
||||||
|
alias lca="d ~/linux-config/dotfiles/aliases"
|
||||||
|
alias vb="vi ~/.bash_aliases"
|
||||||
|
alias vs="vi $alias_folder/.school_aliases"
|
||||||
|
alias vv="vi ~/.vimrc"
|
||||||
|
alias r=". ~/.bashrc"
|
||||||
|
|
||||||
|
# redshift
|
||||||
|
rs(){ redshift -O $(($1 * 1000)) ; }
|
||||||
|
alias rx="redshift -x"
|
||||||
23
dotfiles/aliases/.git_aliases
Normal file
23
dotfiles/aliases/.git_aliases
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# . ~/.secure
|
||||||
|
alias gs="git status -u"
|
||||||
|
alias gpl="git pull --rebase"
|
||||||
|
alias grbc="git rebase --continue"
|
||||||
|
alias gps="git push"
|
||||||
|
alias vig="vi .gitignore"
|
||||||
|
alias ga="git add -A *"
|
||||||
|
alias gai="git add .gitignore"
|
||||||
|
alias gd="git diff -w"
|
||||||
|
alias gdc="git diff --cached"
|
||||||
|
alias gstore="git config credential.helper store"
|
||||||
|
gcm(){ git commit -m "$1" ; }
|
||||||
|
alias gc="git commit"
|
||||||
|
alias gl="git log"
|
||||||
|
alias gsl="git shortlog"
|
||||||
|
alias gst="git stash"
|
||||||
|
alias gstp="git stash pop"
|
||||||
|
alias gclear="git stash clear"
|
||||||
|
gcho() { git checkout $1 ; }
|
||||||
|
gremotes() {
|
||||||
|
git remote set-url --add --push origin $1
|
||||||
|
git remote set-url --add --push origin $2
|
||||||
|
}
|
||||||
7
dotfiles/aliases/.laptop_aliases
Normal file
7
dotfiles/aliases/.laptop_aliases
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
if [ "$(hostname)" == "X1-Carbon" ]; then
|
||||||
|
xmodmap -e "keycode 9 = Escape"
|
||||||
|
xmodmap -e "keycode 22 = Home"
|
||||||
|
xmodmap -e "keycode 119 = End"
|
||||||
|
xmodmap -e "keycode 110 = Delete"
|
||||||
|
xmodmap -e "keycode 115 = BackSpace"
|
||||||
|
fi
|
||||||
38
dotfiles/aliases/.pc_aliases
Normal file
38
dotfiles/aliases/.pc_aliases
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
if [ "$(hostname)" == "NZXT" ]; then
|
||||||
|
rt() {
|
||||||
|
output="HDMI-0"
|
||||||
|
if [ "$1" = "s" ]
|
||||||
|
# if [ "${1:0:1}" = "s" ]
|
||||||
|
then
|
||||||
|
output="DVI-I-1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
dir="normal"
|
||||||
|
if [ "$2" = "r" ]
|
||||||
|
# if [ "${1:1:2}" = "r" ]
|
||||||
|
then
|
||||||
|
dir="right"
|
||||||
|
fi
|
||||||
|
if [ "$2" = "l" ]
|
||||||
|
then
|
||||||
|
dir="left"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# echo "xrandr --output \"$output\" --rotate \"$dir\""
|
||||||
|
xrandr --output "$output" --rotate "$dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
alias ow7="virtualbox startvm W7"
|
||||||
|
# alias ow7="VBoxManage startvm W7 --type headless"
|
||||||
|
|
||||||
|
chr() { google-chrome $1 ; }
|
||||||
|
alias nem="nemo ."
|
||||||
|
alias spt="speedtest"
|
||||||
|
alias pg="ping -c 5 google.ca"
|
||||||
|
|
||||||
|
alias mt="ok ~/Documents/School/136/calc-textbook.pdf"
|
||||||
|
alias 36t="ok ~/Documents/School/236/236-textbook.pdf"
|
||||||
|
|
||||||
|
alias rcg="d ~/Documents/coding/random-color-generator"
|
||||||
|
alias dcr="d ~/Documents/coding/dcr-logger"
|
||||||
|
fi
|
||||||
84
dotfiles/aliases/.school_aliases
Normal file
84
dotfiles/aliases/.school_aliases
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
in_lab=false
|
||||||
|
cd_school="d ~/Documents/School";
|
||||||
|
if [ -d "/h/u3/c7/" ]; then
|
||||||
|
TERM=xterm-256color
|
||||||
|
xmodmap -e "clear Lock"
|
||||||
|
in_lab=true
|
||||||
|
cd_school="d ~";
|
||||||
|
fi
|
||||||
|
|
||||||
|
if $in_lab; then
|
||||||
|
ff() { firefox $1 ; }
|
||||||
|
zip() { tar -zcvf $1.tar.gz $1/ ; }
|
||||||
|
alias nau="nautilus ."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# school
|
||||||
|
alias sch="$cd_school"
|
||||||
|
alias 236="$cd_school/236"
|
||||||
|
alias psy="$cd_school/psy"
|
||||||
|
pdl() { pdflatex $1 ; }
|
||||||
|
cptp() {
|
||||||
|
cp template.tex cp-template.tex
|
||||||
|
chmod 600 cp-template.tex
|
||||||
|
date=`date +%-m-%d`
|
||||||
|
mv cp-template.tex "$date".tex
|
||||||
|
}
|
||||||
|
# 136
|
||||||
|
alias 136="$cd_school/136"
|
||||||
|
alias 136n="$cd_school/136/notes"
|
||||||
|
alias pr2="$cd_school/136/par/2"
|
||||||
|
|
||||||
|
# 209
|
||||||
|
alias ll="ls -l"
|
||||||
|
alias 209="$cd_school/209"
|
||||||
|
alias 9r="$cd_school/209/mokkar"
|
||||||
|
alias l4="$cd_school/209/mokkar/lab4"
|
||||||
|
alias a1="$cd_school/209/mokkar/a1"
|
||||||
|
# alias cdf="ssh -t mokkar@cdf.utoronto.ca '. ./.bashrc; bash -l'"
|
||||||
|
alias cdf="echo \". ./.bashrc\"&& ssh mokkar@cdf.utoronto.ca"
|
||||||
|
|
||||||
|
# compile without running
|
||||||
|
c9() {
|
||||||
|
gcc -Wall -std=gnu99 -g -o "${1%.*}.out" "$1" -lm
|
||||||
|
}
|
||||||
|
|
||||||
|
# compile without running
|
||||||
|
c9a() {
|
||||||
|
for file in *
|
||||||
|
do
|
||||||
|
if [[ $file = *.c ]]; then
|
||||||
|
gcc -Wall -std=gnu99 -g -o "${file%.*}".out "$file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
# compile and run
|
||||||
|
c9r() {
|
||||||
|
gc9 $1
|
||||||
|
./"${1%.*}.out"
|
||||||
|
}
|
||||||
|
# compile and run with input
|
||||||
|
c9i() {
|
||||||
|
gc9 $1
|
||||||
|
./"${1%.*}.out" < $2
|
||||||
|
}
|
||||||
|
# compile and run with input file
|
||||||
|
run() {
|
||||||
|
while read line
|
||||||
|
do
|
||||||
|
./$1 $line
|
||||||
|
done < $2
|
||||||
|
}
|
||||||
|
mkex() { chmod 700 $1 ; }
|
||||||
|
# temp
|
||||||
|
# compile a1p2 and test with simple case
|
||||||
|
ca12() {
|
||||||
|
gcc -Wall -std=gnu99 -g -o validate_sin.out validate_sin.c sin_helpers.c
|
||||||
|
./validate_sin.out 810620716
|
||||||
|
}
|
||||||
|
# compile a1p1 and test with simple case
|
||||||
|
ca1() {
|
||||||
|
gcc -Wall -std=gnu99 -g -o count_large.out count_large.c
|
||||||
|
# ll | ./count_large.out 4000
|
||||||
|
./count_large.out 0 rw------- < ll.txt
|
||||||
|
}
|
||||||
17
dotfiles/set-from-git.sh
Executable file
17
dotfiles/set-from-git.sh
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
dotDir=~/linux-config/dotfiles
|
||||||
|
# aliases
|
||||||
|
rm ~/.bash_aliases
|
||||||
|
ln -s $dotDir/aliases/.bash_aliases ~/.bash_aliases
|
||||||
|
|
||||||
|
# home
|
||||||
|
for file in *; do
|
||||||
|
if [[ $file = .* ]]; then
|
||||||
|
rm ~/$file
|
||||||
|
ln -s $dotDir/$file ~/$file
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# terminator
|
||||||
|
termDir=~/.config/terminator
|
||||||
|
rm $termDir/config
|
||||||
|
ln -s $dotDir/termConfig "$termDir"/config
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
# home
|
|
||||||
files=".bash_aliases .bashrc .inputrc .vimrc .gvimrc .gitconfig"
|
|
||||||
dotDir=~/linux-config/dotfiles
|
|
||||||
|
|
||||||
for file in $files; do
|
|
||||||
rm ~/$file
|
|
||||||
ln -s $dotDir/$file ~/$file
|
|
||||||
done
|
|
||||||
|
|
||||||
# terminator
|
|
||||||
termDir=~/.config/terminator
|
|
||||||
rm $termDir/config
|
|
||||||
ln -s $dotDir/termConfig "$termDir"/config
|
|
||||||
Reference in New Issue
Block a user