Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

new linux instructions

  • Loading branch information...
commit 620fd8ebe7cab777abb24e1670d7b1d7bb2422c4 1 parent 2a8fe5b
Catherine Devlin authored
Showing with 308 additions and 0 deletions.
  1. +15 −0 fill.sh
  2. +9 −0 linux/install.sh
  3. +2 −0  mac/install.sh
  4. +282 −0 setup.linux.ipynb
View
15 fill.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+cd mac
+curl http://downloads.sourceforge.net/project/smultron/smultron/3.5.1/Smultron-3.5.1.zip?r=&ts=1364787627&use_mirror=iweb
+unzip Smultron-3.5.1.zip
+cd ..
+cd windows
+wget http://python.org/ftp/python/2.7.3/python-2.7.3.msi
+wget http://python.org/ftp/python/2.7.3/python-2.7.3.amd64.msi
+wget http://download.tuxfamily.org/notepadplus/6.3.1/npp.6.3.1.Installer.exe
+wget https://pypi.python.org/packages/source/d/distribute/distribute-0.6.35.tar.gz
+tar xvfz distribute-0.6.35.tar.gz
+cd ..
+cd linux
+cp -r ../windows/distribute-0.6.35 .
+cd ..
View
9 linux/install.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+if [[ "`which apt-get`" ]]
+then
+ sudo apt-get install python-dev python-setuptools
+else
+ sudo yum install python-devel python-setuptools
+vi
+easy_install pip
+pip install pyzmq pyreadline ipython tornado ipython_doctester
View
2  mac/install.sh
@@ -0,0 +1,2 @@
+easy_install pip
+pip install pyzmq pyreadline ipython tornado ipython_doctester
View
282 setup.linux.ipynb
@@ -0,0 +1,282 @@
+{
+ "metadata": {
+ "name": "setup.linux"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Goal #1: practice navigating the computer from the terminal\n",
+ "===========================================================\n",
+ "\n",
+ "The filesystem on your computer is like a tree made up of folders (also called \"directories\") and files. The filesystem has a root directory called ``/``, and everything on your computer lives in subdirectories of this root directory.\n",
+ "\n",
+ "We often navigate the filesystem graphically by clicking on graphical folders. We can do the exact same navigation from the command line.\n",
+ "\n",
+ "There are three commands that we'll be using at a command prompt to navigate the filesystem on your computer:\n",
+ "\n",
+ " ls\n",
+ " pwd\n",
+ " cd\n",
+ "\n",
+ "``ls`` lists the contents of a directory.\n",
+ "``pwd`` gives the full directory path to your current directory.\n",
+ "``cd`` moves you into a new directory (it stands for \"change directory\").\n",
+ "\n",
+ "Let's practice using these commands.\n",
+ "\n",
+ "Open a Terminal\n",
+ "---------------\n",
+ "\n",
+ "Starting a terminal varies between Linux distributions: it may be called Terminal on some and Konsole on others. If you have trouble starting, ask an instructor for help.\n",
+ "\n",
+ "Practice using ls, pwd, and cd\n",
+ "------------------------------\n",
+ "\n",
+ "(that's an l the letter, not the number 1)\n",
+ "\n",
+ "Type each of these commands and hit enter:\n",
+ "\n",
+ " ls\n",
+ "This lists all the files in your home directory.\n",
+ "\n",
+ " pwd\n",
+ "This displays the full directory path to your current directory, which is your home directory.\n",
+ "\n",
+ " cd /\n",
+ "This will change you into the / root directory.\n",
+ "\n",
+ " ls\n",
+ "This lists the contents of the / root directory.\n",
+ "\n",
+ " cd Users\n",
+ "This will change you into the Users subdirectory of the / root directory.\n",
+ "\n",
+ " ls\n",
+ "You should see a list of all the files in /Users, including the directory for your username -- your home directory.\n",
+ "\n",
+ " pwd\n",
+ "This displays the full directory path to your current directory, /Users.\n",
+ "\n",
+ " cd ..\n",
+ "``..`` means \"parent directory\", so this command moved you up to the parent directory. You were in /Users, so now you are in /, the root directory.\n",
+ "\n",
+ " ls\n",
+ "This lists the contents of the root directory, confirming where you are.\n",
+ "\n",
+ "Tips\n",
+ "----\n",
+ "\n",
+ "You can use Tab to auto-complete directory and file names. So from inside the root directory /, if you type cd Us and hit Tab, the command prompt will auto-complete the directory name, and you can then hit enter to change into the /Users directory.\n",
+ "\n",
+ "The command prompt maintains a command history. You can use the up arrow to cycle through old commands.\n",
+ "\n",
+ "Check your understanding\n",
+ "------------------------\n",
+ "\n",
+ "Answer these questions. Experiment at the command line if you need to! If you aren't sure about an answer, ask a helper.\n",
+ "\n",
+ "* What directory are you in after starting a new command line prompt?\n",
+ "* After starting a new command line prompt, how would you get to the root directory?\n",
+ "* How do you check what files and directories are in your current working directory?\n",
+ "* If you are in directory /Users, and you want to get to /Users/jesstess/projects, how would you do that?\n",
+ "* What are 2 ways to avoid typing out a full navigation command? (hint: one requires that you've run the command before)\n",
+ "* What is the difference between a command prompt and a Python prompt?\n",
+ "\n",
+ "Success!\n",
+ "--------\n",
+ "\n",
+ "You've practiced using ``ls``, ``pwd``, and ``cd`` to navigate your computer's filesystem from the command prompt."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Goal #2: Install needed software\n",
+ "================================"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Insert the CD or USB drive provided by an instructor. In your file browser, drag the icon for the \"workshop\" folder onto your desktop to make your own copy of the class materials. Then you can remove the CD or USB drive and pass it along. If you can't use a CD or USB drive, download [this file](https://github.com/catherinedevlin/mpwfw_exercises/archive/master.zip) and have an instructor help you prepare it.\n",
+ "\n",
+ "Click the \"workshop\" folder you just copied to enter it, then click \"install.sh\". This script will install IPython, a special Python environment we'll use for the workshop.\n",
+ "\n",
+ "Everything we're installing is free and open-source."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Goal #3: practice starting and exiting Python\n",
+ "=============================================\n",
+ "\n",
+ "Start up a Terminal command prompt. \n",
+ "\n",
+ "To start Python, type\n",
+ "\n",
+ " python\n",
+ "\n",
+ "at the command prompt and hit ``enter``. You should see something like\n",
+ "\n",
+ " Python 2.7.1 (r261:67515, Feb 11 2010, 00:51:29) \n",
+ " [GCC 4.2.1 (Apple Inc. build 5646)] on darwin\n",
+ " Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n",
+ " >>>\n",
+ "\n",
+ "The ``>>>`` indicates that you are at a Python prompt.\n",
+ "\n",
+ "Exit the Python prompt by typing\n",
+ "\n",
+ " exit()\n",
+ "\n",
+ "and hitting ``enter``. You can also use Ctrl+D to exit the Python interpreter. Now you're back at the Linux command prompt (which looks something like jesstess$).\n",
+ "\n",
+ "Check your understanding\n",
+ "------------------------\n",
+ "\n",
+ "What is the difference between a command prompt and a Python prompt? If you're not sure, ask a helper.\n",
+ "\n",
+ "Success!\n",
+ "--------\n",
+ "\n",
+ "Practice these steps until you feel comfortable navigating to a command prompt, starting Python, and exiting Python."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Goal #4: Configure your text editor\n",
+ "===================================\n",
+ "\n",
+ "Our recommendation\n",
+ "------------------\n",
+ "\n",
+ "On Linux, we suggest the GEdit text editor. GEdit should already be installed on your computer. \n",
+ "\n",
+ "To start GEdit: click Applications, point to Accessories, and click Text Editor. If you don't have this option, let a staff member know.\n",
+ "\n",
+ "How to find GEdit from a terminal\n",
+ "---------------------------------\n",
+ "\n",
+ "If you prefer to start applications from a terminal, you can type the following into a terminal to launch GEdit:\n",
+ "\n",
+ " gedit &\n",
+ "\n",
+ "Configure gedit to indent with spaces\n",
+ "-------------------------------------\n",
+ "\n",
+ "* Click Edit -> Preferences\n",
+ "* Select the tab labeled \"Editor\"\n",
+ "* In the \"Tab width\" field, set it to 4 (the default is 8)\n",
+ "* Check the box labeled \"Insert spaces instead of tabs\"\n",
+ "* Check the box labeled \"Enable automatic indentation\"\n",
+ "* Click Close.\n",
+ "\n",
+ "That's it! Now, you can hit tab to indent your code, and that indentation will actually be made of spaces. This change will help you use spaces consistently, so that Python doesn't get confused about whitespace.\n",
+ "\n",
+ "Success!\n",
+ "--------\n",
+ "\n",
+ "If you prefer a different editor for text, check with an instructor before moving on to make sure it will work for the weekend. vim users will probably want to add the lines\n",
+ "\n",
+ " set tabstop=4\n",
+ " set softtabstop=4\n",
+ " set autoindent\n",
+ "\n",
+ "to their .vimrc file."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Goal #5: practice running Python code from a file\n",
+ "=================================================\n",
+ "\n",
+ "Interactive Python programming at a Python prompt is great for short pieces of code and for testing ideas. For longer code, it can be easier to save the code in a file, and execute the contents of that file (aka a Python script). In this section, we'll practice running Python scripts.\n",
+ "\n",
+ "Start your text editor\n",
+ "----------------------\n",
+ "\n",
+ "- Launch the GEdit editor. See Goal #4 for the steps to do this.\n",
+ "- Start a new, blank text file.\n",
+ "\n",
+ "Write and save a short Python script\n",
+ "------------------------------------\n",
+ "\n",
+ "Add the following line to your new text file:\n",
+ "\n",
+ " print \"Hello World!\"\n",
+ "\n",
+ "Save the script as hello.py in your home directory. The ``.py`` extension indicates that this file contains Python code.\n",
+ "\n",
+ "Run the script\n",
+ "--------------\n",
+ "\n",
+ "* Start a new command prompt. See Goal #1 for the steps to do this. instructions for the steps to do this. Recall that a terminal prompt will look like jesstess$ and a Python prompt will look like ``>>>``. Make sure you are at a terminal prompt and not a Python prompt; if you are at a Python prompt, you can type ``exit()`` on a line by itself and then hit ``enter`` to exit Python and return to a terminal prompt.\n",
+ "* Navigate to your home directory from a command prompt, using the ls, pwd, and cd commands. See the terminal navigation on OS X instructions for a refresher on using these commands. Don't hesitate to get help from a staff member on this step if you need it -- it's a new way of navigating your computer, so it may be unintuitive at first!\n",
+ "* Once you are in your home directory, you'll see ``hello.py`` in the output of ``ls``.\n",
+ "* Type\n",
+ "\n",
+ " python hello.py\n",
+ "\n",
+ "and hit ``enter``. Doing this will cause Python to execute the contents of that script -- it should print \"Hello World!\" to the screen. What you've done here is run the Python application with an argument -- the name of a file, in this case \"hello.py\". Python knows that when you give it a file name as an argument, it should execute the contents of the provided file. You get the same result as if you typed\n",
+ "\n",
+ " print \"Hello World!\"\n",
+ "\n",
+ "at a Python prompt and hit ``enter``.\n",
+ "\n",
+ "Success\n",
+ "-------\n",
+ "\n",
+ "You created and ran your first Python script!\n",
+ "\n",
+ "* When you run the python command by itself, you start a Python prompt. You can execute Python code interactively at that prompt.\n",
+ "* When you run the python command with a file name as an argument, Python executes the Python code in that file."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Goal #6: Practice using IPython Notebook\n",
+ "========================================\n",
+ "\n",
+ "You'll spend most of this workshop using a Python tool called the *IPython Notebook*.\n",
+ "This lets you run IPython cells, which are like the interactive Python prompt you tried out\n",
+ "in Goal #3, right within your browser.\n",
+ "\n",
+ "1. Open a Terminal (see Goal #1) and use `cd` to navigate into the `workshop` directory. \n",
+ "\n",
+ "2. Type\n",
+ "\n",
+ " ipython notebook\n",
+ "\n",
+ " and hit ``enter``.\n",
+ "\n",
+ "3. Your browser should come up with a page called \"IP[y]: Notebook\". That's your IPython Dashboard; it has a list of notebooks. Click \"notebook_practice\" and follow the instructions on the notebook that it brings up.\n",
+ "\n",
+ "Goal #7: Tutorial\n",
+ "=================\n",
+ "\n",
+ "Go back to the IPython Dashboard page in your browser, and click the \"day1.1\" notebook. Follow along through that tutorial. Remember to ask lots of questions, to the instructors and to the other students - we're all here to help each other!\n",
+ "\n",
+ "After \"day1.1\", you'll go through \"day1.2\" and then part of \"exercises\". We'll leave the rest for tomorrow!"
+ ]
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
Please sign in to comment.
Something went wrong with that request. Please try again.