Skip to content

Instantly share code, notes, and snippets.

@rarezhang
Forked from asimjalis/useful.sh
Created June 4, 2014 21:42
Show Gist options
  • Select an option

  • Save rarezhang/47e203310d65c77c563d to your computer and use it in GitHub Desktop.

Select an option

Save rarezhang/47e203310d65c77c563d to your computer and use it in GitHub Desktop.
function init_bashrc() {
cat << 'END' > .bashrc
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export PS1='$PWD> '
set -o vi
source useful.sh
END
}
function init_vimrc() {
cat << 'END' > .vimrc
set et
set sw=2
set ts=2
set nu
set nohls
END
}
function init_all_rc() {
init_bashrc
init_vimrc
}
function push_useful() {
scp useful.sh elephant:.
scp useful.sh tiger:.
scp useful.sh horse:.
scp useful.sh monkey:.
}
function init_clip() {
sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo yum install --assumeyes xsel
sudo yum install --assumeyes xclip
}
function kv() {
for kv1 in $*; do
set -- `echo $kv1 | tr '=' ' '`
echo " <property>"
echo " <name>$1</name>"
echo " <value>$2</value>"
echo " </property>"
done
}
function xx() {
HOSTS=$1
shift
for i in $HOSTS ; do
echo ==$i==
ssh $i $*
done
}
alias ethm='xx "elephant tiger horse monkey" '
alias eth='xx "elephant tiger horse" '
alias et='xx "elephant tiger" '
alias thm='xx "tiger horse monkey" '
alias e='xx "elephant" '
alias t='xx "tiger" '
alias h='xx "horse" '
alias m='xx "monkey" '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment