Initial commit

This commit is contained in:
Tom Willemse 2013-07-22 23:01:45 +02:00
commit 1e32fe78f6
4 changed files with 58 additions and 0 deletions

22
copydb Executable file
View file

@ -0,0 +1,22 @@
#!/bin/zsh
echo -n 'Database root PW (for DB creation): '
read -s ROOTPW
echo
echo -n 'Database user for new DB: '
read DBUSER
echo -n 'Database user PW for new DB: '
read -s DBPASSW
echo
mysql -u root -p"$ROOTPW" -B <<EOF
CREATE DATABASE $2;
GRANT ALL ON $2.* to '$DBUSER'@'localhost';
EOF
unset ROOTPW
mysqldump -u "$DBUSER" -p"$DBPASSW" "$1" \
| mysql -u "$DBUSER" -p"$DBPASSW" "$2"

11
git-dot Executable file
View file

@ -0,0 +1,11 @@
#!/bin/zsh
GITDIR=/home/slash/projects/dotfiles/.git
if [ ! -d "$GITDIR" ]; then
echo "Cloning dotfiles to $GITDIR"
git clone git@ryuslash.org:dotfiles.git "$GITDIR"
fi
cd $HOME
git --git-dir "$GITDIR" --work-tree "$HOME" "$@"

11
git-etc Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/zsh
GITDIR=/home/slash/projects/etcfiles
if [ ! -d "$GITDIR" ]; then
echo "Cloning etcfiles to $GITDIR"
git clone git@ryuslash.org:etcfiles.git "$GITDIR"
fi
cd /etc
git --git-dir "$GITDIR" --work-tree /etc/ "$@"

14
rebasedb Executable file
View file

@ -0,0 +1,14 @@
#!/bin/zsh
echo -n 'Database root PW (for DB manipulation): '
read -s ROOTPW
echo
mysql -u root -p"$ROOTPW" -B <<EOF
DROP DATABASE $2; CREATE DATABASE $2;
EOF
echo "Recreated database $2"
mysqldump -u root -p"$ROOTPW" "$1" \
| mysql -u root -p"$ROOTPW" -B "$2"
echo "Copied $1 to $2"