Tweaks from simlay.

This commit is contained in:
Ivan Malison 2013-09-25 16:38:16 -07:00
parent 066cf15260
commit 0ad505b780
2 changed files with 47 additions and 10 deletions

View File

@ -1,8 +1,36 @@
get_col () {
for item in `awk "{print \\$$@}"`; do
printf $item
printf '\n'
get_cols () {
# Usage: get_cols [file_name] [column_num]
column_list=""
for column_num in $@; do
[ -r $column_num ] && continue
[ $column_num -lt '0' ] && column_num="(NF + 1 $column_num )" #Negative indices like python's array[-1]
[ -z $column_list ] && column_num="\$$column_num" || column_num=",\$$column_num" # Place commas appropriately.
column_list="$column_list$column_num"
done
unset column_num
# Is the first parameter a file?
if [ -r $1 ]; then
awk "{print $column_list}" $1
else
awk "{print $column_list}"
fi
unset column_list
}
note() {
if [ $# -eq 0 ]; then
(ym && exec $EDITOR $HOME/notes/$(git rev-parse --abbrev-ref HEAD)) ;
else
$EDITOR $HOME/notes/"$*" ;
fi
}
list_notes() {
ls -c $HOME/notes/ | grep "$*"
}
function get_shas_that_touched() {

View File

@ -1,11 +1,20 @@
#!/bin/bash
cd "$(dirname "${BASH_SOURCE}")"
CURRENT_DIRECTORY="$(dirname "${BASH_SOURCE}" | xargs readlink -f)"
cd $CURRENT_DIRECTORY
echo "Linking From $CURRENT_DIRECTORY"
function doIt() {
rsync --exclude "setup.sh" --exclude "Monaco-Powerline.otf" --exclude "web_start.sh" \
--exclude "oh-my-zsh" --exclude "tmux-powerline" --exclude ".git/" \
--exclude ".DS_Store" --exclude "bootstrap.sh" --exclude "README.md" \
--exclude "requirements.txt" --exclude "more_python.txt" \
-av . ~
[[ -a ~/.dotfiles-backups ]] || mkdir ~/.dotfiles-backups
exclude_list="setup.sh Monaco-Powerline.otf web_start.sh oh-my-zsh tmux-powerline .git .gitmodules .DS_store bootstrap.sh README.md more_python.txt . .. requirements.txt"
for i in .*; do
if ! [ -z ${i/*.swp/} ] && ! [[ $exclude_list =~ $i ]]
then
[[ -a ~/$i ]] && mv ~/$i ~/.dotfiles-backups/$i
ln -si $CURRENT_DIRECTORY/$i ~/$i
fi
done
}
if [ "$1" == "--force" -o "$1" == "-f" ]; then