From 5554bfd2fe748a491fd42b1632acdcd5ea4ab481 Mon Sep 17 00:00:00 2001 From: Kevin Mok Date: Thu, 1 Feb 2018 22:38:04 -0500 Subject: [PATCH] Resolve #18, new 209/my_pc alias files, egc alias - alias files: - 209: Split from school because was getting too long. - my_pc: Stores common aliases between laptop and desktop. - Can now have different Terminator configurations for each computer. - egc alias: Loads commit message buffer into Vim with text width of 72 and syntax highlighting. --- .gitignore | 1 + X1-Carbon-terminator | 1 + aliases/.209_aliases | 48 +++++++++++++++++++++++++++++++ aliases/.bash_aliases | 9 ++++-- aliases/.git_aliases | 2 ++ aliases/.laptop_aliases | 1 + aliases/.my_pc_aliases | 6 ++++ aliases/.pc_aliases | 3 -- aliases/.school_aliases | 63 ++++------------------------------------- set-from-git.sh | 5 ++-- termConfig | 35 ----------------------- 11 files changed, 73 insertions(+), 101 deletions(-) create mode 120000 X1-Carbon-terminator create mode 100644 aliases/.209_aliases create mode 100644 aliases/.my_pc_aliases delete mode 100644 termConfig diff --git a/.gitignore b/.gitignore index 66fcaf5..df6f564 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +commit-msg.txt *.sw* temp.sh konsole.shortcuts diff --git a/X1-Carbon-terminator b/X1-Carbon-terminator new file mode 120000 index 0000000..86c78ed --- /dev/null +++ b/X1-Carbon-terminator @@ -0,0 +1 @@ +/home/kevin/.config/terminator/config \ No newline at end of file diff --git a/aliases/.209_aliases b/aliases/.209_aliases new file mode 100644 index 0000000..cf60b99 --- /dev/null +++ b/aliases/.209_aliases @@ -0,0 +1,48 @@ +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" +mkex() { chmod 700 $1 ; } + +## compilation functions + +# 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 +} + + # 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 + } diff --git a/aliases/.bash_aliases b/aliases/.bash_aliases index 1b3ba10..6e12029 100644 --- a/aliases/.bash_aliases +++ b/aliases/.bash_aliases @@ -1,5 +1,5 @@ alias_folder="~/linux-config/aliases" -alias_type="school git pc laptop" +alias_type="school git pc laptop 209 my_pc" for type in $alias_type; do . ~/linux-config/aliases/."$type"_aliases done @@ -13,6 +13,8 @@ alias reb="sudo shutdown -r 0" alias sd="sudo shutdown 0" alias s="systemctl suspend" alias hst="history" +alias topo="top -o %MEM" +alias rmsw="rm .sw*" # directories # unalias c @@ -31,8 +33,9 @@ ok() { okular $1 ; } # config alias lc="d ~/linux-config/" alias lca="d ~/linux-config/aliases" -alias vb="vi \"$alias_folder\"/.bash_aliases" -alias vs="vi \"$alias_folder\"/.school_aliases" +alias vb="vi $alias_folder/.bash_aliases" +alias vs="vi $alias_folder/.school_aliases" +alias vs9="vi $alias_folder/.209_aliases" alias vv="vi ~/.vimrc" alias r=". ~/.bashrc" diff --git a/aliases/.git_aliases b/aliases/.git_aliases index c7e5b3e..19121cd 100644 --- a/aliases/.git_aliases +++ b/aliases/.git_aliases @@ -21,3 +21,5 @@ gremotes() { git remote set-url --add --push origin $1 git remote set-url --add --push origin $2 } + +alias egc="vim -c \"set syn=gitcommit\" -c \"set tw=72\" commit-msg.txt" diff --git a/aliases/.laptop_aliases b/aliases/.laptop_aliases index 79a8ccc..3f5b844 100644 --- a/aliases/.laptop_aliases +++ b/aliases/.laptop_aliases @@ -1,4 +1,5 @@ if [ "$(hostname)" == "X1-Carbon" ]; then + # key swaps xmodmap -e "keycode 9 = Escape" xmodmap -e "keycode 22 = Home" xmodmap -e "keycode 119 = End" diff --git a/aliases/.my_pc_aliases b/aliases/.my_pc_aliases new file mode 100644 index 0000000..04415f3 --- /dev/null +++ b/aliases/.my_pc_aliases @@ -0,0 +1,6 @@ +if [ "$(whoami)" == "kevin" ]; then + alias vbn="cvlc --loop ~/Downloads/brown-noise.mp3" + + alias mt="ok ~/Documents/School/136/calc-textbook.pdf" + alias 36t="ok ~/Documents/School/236/236-textbook.pdf" +fi diff --git a/aliases/.pc_aliases b/aliases/.pc_aliases index 3bbad30..8709604 100644 --- a/aliases/.pc_aliases +++ b/aliases/.pc_aliases @@ -30,9 +30,6 @@ if [ "$(hostname)" == "NZXT" ]; then 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 diff --git a/aliases/.school_aliases b/aliases/.school_aliases index 15882f4..fea8046 100644 --- a/aliases/.school_aliases +++ b/aliases/.school_aliases @@ -13,7 +13,7 @@ if $in_lab; then alias nau="nautilus ." fi -# school +# general alias sch="$cd_school" alias 236="$cd_school/236" alias psy="$cd_school/psy" @@ -24,61 +24,8 @@ cptp() { 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 - } +# 136 +alias 136="$cd_school/136" +alias 136n="$cd_school/136/notes" +alias pr2="$cd_school/136/par/2" diff --git a/set-from-git.sh b/set-from-git.sh index 0a7d793..83b71f2 100755 --- a/set-from-git.sh +++ b/set-from-git.sh @@ -10,5 +10,6 @@ done # terminator term_dir=~/.config/terminator -rm $term_dir/config -ln $dot_dir/termConfig "$term_dir"/config +pc=$(hostname) +rm "$dot_dir"/"$pc"-terminator +ln -s "$term_dir"/config $dot_dir/"$pc"-terminator diff --git a/termConfig b/termConfig deleted file mode 100644 index 5dcfc82..0000000 --- a/termConfig +++ /dev/null @@ -1,35 +0,0 @@ -[global_config] - inactive_color_offset = 1.0 - title_font = Noto Sans 10 - title_transmit_bg_color = "#3d3d3d" -[keybindings] - close_term = w - cycle_next = Tab - go_down = j - go_left = h - go_right = l - go_up = k - new_tab = t - split_horiz = e - split_vert = o -[layouts] - [[default]] - [[[child1]]] - parent = window0 - type = Terminal - [[[window0]]] - parent = "" - type = Window -[plugins] -[profiles] - [[default]] - background_image = None - copy_on_selection = True - cursor_color = "#b9b9b9" - custom_command = env TERM=xterm-256color bash - font = Monospace 8.5 - foreground_color = "#0077ff" - palette = "#000000:#aa0000:#00aa00:#aa5500:#0000aa:#aa00aa:#00aaaa:#aaaaaa:#555555:#ff5555:#55ff55:#ffff55:#5555ff:#ff55ff:#55ffff:#ffffff" - scrollbar_position = hidden - use_custom_command = True - use_system_font = False