[Linux Development Environment](https://docs.google.com/file/d/1YAJ1F3AFj6xrC-PZZYHWJCtzdUc1lyTm8Hhw-rKoFrU_wEI19bQFObqyaXCNT_nRcJK6X3vPXRoehw7w/edit?usp=sharing)
=============================
Dev Environment
---------------
#### `screen` tab manager for remote sessions
Allows you to reconnect and resume your session where you left off. Useful if a remote connection drops or for any long-running computation (running as a background process--see above--is a viable alternative).
`tmux` is considered [a better alternative](http://honnef.co/posts/2010/10/why_you_should_try_tmux_instead_of_screen/) to `screen`. Use it with [teamocil](https://github.com/remiprev/teamocil) to automatically create sessions, windows and panes with YAML files.
In `screen`, type
- C-t ? to bring up the help
- C-t c to create new tabs
- C-t u or j to switch tabs
- C-t 0..9 to go to a specific tab (starts at 0)
- C-t C-t to go back and forth between the current and previous tab
- C-d to exit the current tab
- C-t [ to go into copy mode
now you can use the arrow keys to move around or C-p/n to move up and down
copy stuff with (space) or (enter), you have to set beginning and end
paste with C-t ]
abort with C-(space)
- screen -d to detach the screen (type inside screen)
- screen -r to resume the screen (type in shell)
Note: C-t ? means CTRL and t followed by ?.
#### `emacs` environment for writing code
First execute the setup script.
```
sudo apt-get install -y git-core
# see https://help.github.com/articles/set-up-git for more help
git clone https://github.com/startup-class/setup.git
./setup/setup.sh
```
Launch emacs without windows and without customizations: `emacs -nw -Q`
Go to the command prompt with M-x, where M is the meta or alt key.
Type help-with-tutorial for a tutorial.
Exit with C-x C-c.
**Note:** I'm skipping the rest of the emacs section since I'm a happy vim user. You can view the rest of the emacs tutorial by reading the above linked PDF, or start by watching this [lecture video](https://class.coursera.org/startup-001/lecture/171).
#### `git` distributed version control system (DVCS)
**Note:** I'm also skipping this section because I'm already well versed in git. I once gave a [presentation on git](https://docs.google.com/presentation/d/1uYUXq0JHSTmSzntStwSgpxT4pG7UsmdpOO0RDaMtxVI/edit?usp=sharing).
**Tip:** The crowdfunding site that we're building uses heroku/node-js-sample as a base. See [here for more info](https://class.coursera.org/startup-001/assignment/view?assignment_id=8). Don't forget to `heroku create` from your project's git repo, then `git push heroku master`.
#### DevOps Basics
You should have a setup.git repo (configures the machine) and dotfiles.git repo (configures the user environment). Setup.git will have a script that clones and sets up your dotfiles; you can also combine them into a single repo. These make setting up a new dev environment much easier and quicker by programmatically configuring an arbitrary machine.
For a business, it's better to use a more professional solution such as Vagrant (configures the [virtual] machine) + Puppet/Chef (configures the user environment & software) or many of the alternative options.
To fully automate setting up an EC2 instance, use the [EC2 command line tools](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/SettingUp_CommandLine.html) so you don't have to use the web GUI. Use in conjunction with a [user-data-script](http://stackoverflow.com/questions/10125311/how-to-fire-ec2-instances-and-upload-run-a-startup-script-on-each-of-them) for automatically running a startup script on each instance.
**Any setup/configuration of a machine is code and should be treated as code.** If the change is permanent, do not set it up manually on the dev machine. Instead, add it to the install scripts and config files and keep it under version control.