<file_sep>#!/bin/bash

if [[ $UID != 0 ]]; then
    echo "Please run this script with sudo:"
    echo "sudo $0 $*"
    exit 1
fi


echo -e "Please specify the hostname for this machine: "
read hname

echo -e "And the domain? "
read domain

echo -e "Adding hostname to /etc/hostname... \n"
hostnamectl set-hostname "$hname"
sleep 0.5s

echo -e "Replacing /etc/hosts... \n"
sed -i ./configs/hosts s/HNAME/$hname
sed -i ./configs/hosts s/DOMAIN/$domain
cat ./configs/hosts > /etc/hosts

echo -e "Configuring git variables... \n"
git config --global color.ui auto
git config --global user.name alexfornuto
git config --global user.email <EMAIL>
sleep .5s

echo -e "Copying the scripts directory... \n"
mv .scripts ~/
sleep 1.5s


echo -e "Copying Screen config file into ~ ... \n"
cp configs/.screenrc ~/.screenrc
sleep .5s

echo -e "making the .ssh dir, if not already there... \n"
mkdir -p ~/.ssh
sleep .5s

echo -e "Adding the list of public keys from github into the authorized_keys file for this user... \n"
curl https://github.com/alexfornuto.keys >> ~/.ssh/authorized_keys
sleep 1.5s

echo -e "Adding aliases and colors into .bashrc... \n"
cat configs/.bashrc >> ~/.bashrc
sleep .5s

echo -e "sourcing bash profile... \n"
source ~/.bashrc
sleep .5s

echo -e "Done! \n"
<file_sep>bash-setup
==========

Configurations and Scripts I use on new machines. This is for personal use, but feel free to copy it if you like some of this automation. If you do, be sure to remove my public keys from your branch, and edit the Git configuration commands.

This repo should be pulled by running the [first](https://gist.github.com/alexfornuto/228fe6e1280648b37534) script from gist. You can do this in one line:

```
curl -s https://gist.githubusercontent.com/alexfornuto/228fe6e1280648b37534/raw/69c42f78ab145a742a1e672d6a3e1c7da34a502d/first.sh | bash
```

The full contents of that script are below:

```
#!/bin/bash

echo -e "updating the timezone... \n"
sudo cp /usr/share/zoneinfo/America/New_York /etc/localtime

sleep 1

echo -e "Updating, upgrading, installing packages... \n"
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y git ruby rake

sleep 1

echo -e "Configuring git variables... \n"
git config --global color.ui auto
git config --global user.name alexfornuto
git config --global user.email <EMAIL>

sleep 1

echo -e "cloning bash-setup... \n"
git clone https://github.com/alexfornuto/bash-setup.git
```

The CentOS version: https://gist.github.com/alexfornuto/b61eb6301bfa5d4c6543

```
pretty much the same thing, but s/apt-get/yum/g
```
<file_sep>#!/bin/bash
# A simple script to let you unrar all archives in a set of subdirectories into your current directory.

echo "dirs?"
read dirs

echo "name?"
read name

for d in $dirs; do ( cd $d && unrar x $name ../ ); done
<file_sep>alias sprungeout="curl -F 'sprunge=<-' http://sprunge.us"
alias bigfiles="sudo du -h -d 5 / | grep '[0-9]G        '"
alias updateiptables='sudo iptables-restore < /etc/iptables.firewall.rules'
alias untar='tar -zxvf'
alias showdebpacks='dpkg --get-selections | grep -v deinstall | less'
alias tarlist='tar -tvf'


PS1='\[\e[1;33m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\] \[\e[1;37m\]'

source ~/.scripts/git-prompt.sh
PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$' 

source ~/.scripts/git-completion.bash
