Skip to content

Commit

Permalink
Created installation script
Browse files Browse the repository at this point in the history
  • Loading branch information
sidneyw committed May 26, 2016
1 parent 003bd5e commit 1f75629
Show file tree
Hide file tree
Showing 156 changed files with 17,413 additions and 3 deletions.
97 changes: 97 additions & 0 deletions bin/class
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/bin/bash
# A simple script to make starting homework easier

# Add the google functionality
# open -a /Applications/Google Chrome.app 'http:https://google.com/' 'http:https://facebook.com/'

# ============================
# Functions
# ============================

function class_usage {
echo "class [options]"
echo "-u usage"
echo "-a anthro17"
echo "-d cs24"
echo "-c cs30"
echo "-w open websites for class"
echo "-n note taking"
echo "-b backup classes"
echo "no opt leads to the 16W dir"
}

function anthro {
cd ~/Documents/16W/ANTH17
echo "Anthro 17"
ls

open ~/Documents/16W/ANTH17/Syllabus.pdf
open -a /Applications/Google\ Chrome.app 'https://canvas.dartmouth.edu/courses/13291'
}

function animation {
cd ~/Documents/16W/CS24
echo "Animation"
ls

open -a /Applications/Google\ Chrome.app 'https://canvas.dartmouth.edu/courses/13375'
}

function cs {
cd ~/Documents/16W/CS30
echo "Discrete Mathematics"
ls

open Rosen.pdf
open mcs.pdf
open -a /Applications/Google\ Chrome.app 'http:https://www.cs.dartmouth.edu/~cs30/'
}

function courses {
cd ~/Documents/16W/
echo "16W Courses"
ls
}

function note {
cd ~/Documents/16W/
echo "16W Courses"
ls
vim
}

function backup {
echo "Backing up to ~/Google\ Drive/16W/"
cp -rf /Users/sidneywijngaarde/Documents/16W/ /Users/sidneywijngaarde/Google\ Drive/16W/

if [ $? != 0 ]
then
echo "Files Backed up to ~Google\ Drive/16W"
else
echo $?
echo "Files could not be backedup"
fi
}

# ============================
# Get Opts Logic
# ============================

if [ $# -eq 0 ]
then
courses
fi

while getopts ":uadcnb" option; do
case $option in
u) class_usage;;
a) anthro;;
d) animation;;
c) cs;;
n) note;;
b) backup;;

\?) usage;
courses;;
esac
done
22 changes: 22 additions & 0 deletions bin/dt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

if [ $# -eq 0 ]
then
cd ~/Desktop/
ls
else

for i in ${@:1:$#}
do

# check if the file exists
if [ -f $i ]
then
mv $i ~/Desktop
else
echo "File: $i does not exist"
break
fi
done

fi
1 change: 1 addition & 0 deletions bin/google
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
open -a /Applications/Google Chrome.app 'http:https://google.com/' 'http:https://facebook.com/'
16 changes: 16 additions & 0 deletions bin/idea
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# Idea dir
dir="$HOME/Documents/Ideas/thoughts"

# Append today's date
new_file=$dir/$(date +%b%d)


if [ "$1" == "-v" ]
then
# For calling inside of vim
echo $new_file
else
vim "$new_file"
fi
89 changes: 89 additions & 0 deletions bin/notes
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/bin/bash

_file="notes_master"

function _help {
echo "notes dir"
echo "Call from a class top level directory"
echo "-h help"
echo "-q questions"
echo "-o outline"
echo "-t terms"
echo "-l look up later"
echo "-s cool stuff"
echo "-c arg to change the in file"
echo "-r to see the reference file"
exit 1
}

function _question {
egrep "\?" $_file
exit 0
}

function _outline {
egrep "(\*|#|[0-9])" $_file
exit 0
}

function _terms {
egrep "#" $_file
exit 0
}

function _bullets {
egrep "^\*" $_file
exit 0
}

function _lookup {
egrep "^\\$" $_file
exit 0
}

function _cool {
egrep "^&" $_file
exit 0
}

function _ref {
cat ~/bin/note_taking
exit 0
}

if [[ $# -lt 1 ]]
then
_help
exit 1
fi

while getopts ":c:hroqtbls" option; do
case $option in
h) _help;;
c) if [ -f $OPTARG ]
then
_file=$OPTARG
else
echo "$OPTARG is not a file"
exit 1
fi
;;
r) _ref;;
o) _outline;;
q) _question;;
t) _terms;;
b) _bullets;;
l) _lookup;;
s) _cool;;
\?) _help;;
esac
done

if [ -d $1 ]
then
find $1 -name "notes" | xargs cat > notes_master
exit 0
else
echo "$1 is not a directory"
exit 1
fi
79 changes: 79 additions & 0 deletions cheatsheets/muggle.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
======================
04/21/16 20:30:42
======================

Substitute
======================
Use substitute to count occurances
:%s/pattern//gn

The n flag at the end is no op and therefore you just see the matches echoed in the
Vim command line

:h regexp

Marks
======================
Marks [a-Z] are local
Marks [A-Z] are global (between files)

Marks '[ and '] delimit the last modified text
- This is useful if you want to do something with text you just pasted or
something similar

'a goes to a
`a also goes to a

Test line
Range
======================
(number) Absolute line number
. Current line
$ Last line in the file
% The current file
't Location of mark t
/pattern/ The next line where pattern occurs
?pattern? The previous line where pattern occurs

:h range

Moving Lines
======================

'am/Moving/-1
moves the line at mark a to the line before the next occurrence of Moving

/Test/m/Moving/-1
moves the line starting with test to the line before the next occurrence of Moving

Note
======================
Press C-f in command line mode to get a list of the last few commands in a buffer.
You can edit a command as text and then hit enter to run it

Registers
======================
Registers 1-9 are delete registers. They work like a stack

Registers are executable as macros. If you pull into a register you can execute that text
as a macro since macro registers and copy/paste registers are the same group of registers

Note
======================
Count Operator Motion

External Tools
======================
To read in a file or output from a command
:r file_name
:r !external command

To run the current line through the stdin of an external command
:.![cmd]

From normal mode to run the current line as a command
!!sh

Note
======================
:h ins-completion
58 changes: 58 additions & 0 deletions cheatsheets/vim_cheatsheet
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
======================
03/19/16 22:30:12
======================

Ctags
======================

<C-]> goto tag
<C-w> ] open tag in preview
[ I see where else the function/variable is used

Fugitive
======================

:Git [args]
:Gwrite stages the current file
:Gremove
:Gmove
:Gcommit
:Gblame

Syntastic
======================

:SyntasticCheck
:Errors
:lclose
:lnext
:lprevious
:SyntasticToggleMode

Tmux
======================

Copy Paste
<prefix [> Enter copy mode
Space Start selection
* Highlight Selection *
<CR> Copy to Tmux Buffer
* Navigate to Paste Location *
<prefix ]> Paste From Buffer

Other Copy Paste
tmux show-buffer
tmux save-buffer file_name.txt
tmux list-buffers
tmux show-buffer -b [buff_index]
tmux save-buffer -b [buff_index]

Command Line FU
==================

<C-x> <C-e> | Opens a text editor to write a command in
<ESC> . | The arguments from the last line
<space> command | Command wont be saved in history
<C-u> [...] <C-y> | Yank the current line, run another command, paste the original line
vim -x filename | Encrypt file
<ESC> * | Insert autocompletion results on the command line
18 changes: 18 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# Creates symlinks for dotfiles
dir="$HOME/.dot_files"

echo "Dot files folder: $dir"

ln -s $dir/tmux/tmux.conf $HOME/.tmux.conf
ln -s $dir/vim/vimrc $HOME/.vimrc
ln -s $dir/vim $HOME/.vim
ln -s $dir/bash_profile $HOME/.bash_profile

if [[ -d $HOME/bin ]]
then
echo User level bin already exists
else
ln -s $dir/bin ~/bin
fi
Loading

0 comments on commit 1f75629

Please sign in to comment.