Skip to content
This repository has been archived by the owner on Oct 28, 2019. It is now read-only.

Commit

Permalink
some flesh on the badgey bones, for all of them.
Browse files Browse the repository at this point in the history
  • Loading branch information
gregglind committed Apr 24, 2011
1 parent 125a94f commit 0244adb
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 8 deletions.
12 changes: 12 additions & 0 deletions docs/badges/badge_edit_html.rst
Expand Up @@ -2,3 +2,15 @@
Edit Basic Html
-------------------

.. note::

This badge is incomplete, and intended to show some basic usage on your
editor. Grab a guide, and they will figure out something appropriate :)


#. Make a basic html file in your editor.
#. View it in your browser.
#. Make changes.
#. Observe changes in your browser!
#. Be amazed that changing a few lines of code can change output!
91 changes: 85 additions & 6 deletions docs/badges/badge_inthebeginning.rst
@@ -1,14 +1,93 @@
In the Beginning was the Command Line Badge
.. badge_inthebeginning:
In the Beginning was the Command Line
===========================================

In the Beginning was the Command Line is a book by Neal Stephenson. Unlike many of his other works, it is short and available for free (legally) download on the internet. The first part of this badge is to do just that. Go here to complete this task: http://www.cryptonomicon.com/beginning.html
History matters. At first glance, many of the commands and idioms of
programming seem deliberately obscure. But they are the culmination of
an evolutionary process, with twists and turns and dead-ends. Knowing
some history, and in particular the history of the Unix operating system,
sheds light on what is otherwise occult.

*In the Beginning Was the Command Line* is a book by Neal Stephenson.
Unlike many of his other works, it is short and available for (legal) free download on the internet.

#. Go to: http://www.cryptonomicon.com/beginning.html
#. Read the section entitled "THE HOLE HAWG OF OPERATING SYSTEMS."


.. note::

this badge is a bit incomplete, and you will benefit from having a
guide around to help you through it)


Now that you have read the section, let's honor our shared history by using Unix
commands to do the same work for us.

::

curl -s 'http://www.cryptonomicon.com/command.zip' | gunzip | grep -i -A22 'pipe' | less
# type 'q' to quit from 'less' when you are done.
Let's break this down.

#. The ``|`` takes the text **output** from one command and **pipes** it into
the **input** of the next command.
#. research curl: ``man curl``. What does curl do? What about the
``-s`` option?

.. container:: answer-hidden

Curl is a command line client for hitting urls. We can use it
to download the web page. ``-s`` makes it run 'silently'.

#. ``gunzip``? What is does gunzip do?

.. container:: answer-hidden

it unzips the file :) Nothing magical there!

#. What file is ``gunzip`` operating on?

.. container:: answer-hidden

None, really. Or rather it's operating on a special file called
``stdin``, which is here attached to the ``stdout`` out of the curl
command, via the **pipe**.

#. ``grep -i -A22 'pipe'`` . ``grep`` is the *general regular expression
parser*, that is used to find lines in a file matching an expression.
Here, we have thrown on some special switches:

* ``-i`` for *case insensitive*
* ``-A22`` for 'show me the 22 lines *after* my match. Since each
line in the original is a paragraph, this has the effect of getting us
the whole section.
* ``'pipe'`` is what to search on in the incoming stream.

#. ``less`` is a **pager**, which is a program that takes a stream of text,
and turns it in 'screen-size' 'pages' for easier viewing.


Exercises:

#. Look at all the lines including the word *pride* in *Pride and Prejudice*
(downloadable at http://www.gutenberg.org/files/1342/1342-h/1342-h.htm)

.. container:: answer-hidden

::

curl 'http://www.gutenberg.org/files/1342/1342-h/1342-h.htm' | grep -i 'pride' | less

#. Count those lines using the ``wc`` command.

.. container:: answer-hidden

The second part of this badge is to read the section entitled "THE HOLE HAWG OF OPERATING SYSTEMS."
::

**Extra Credit**: If you want, you can complete the second part of the badge using only the commandline. Open a CLI and navigate to where the text is stored (and perhaps named something like command.txt) and run the following command::
curl 'http://www.gutenberg.org/files/1342/1342-h/1342-h.htm' | grep -i 'pride' | wc

$ grep -A 22 "THE HOLE HAWG OF OPERATING SYSTEMS" command.txt

What does this command return? What do you think ``grep`` does? After you've read the text, play around some with ``grep`` - it's pretty neat!


6 changes: 6 additions & 0 deletions docs/badges/badge_jquery.rst
Expand Up @@ -3,4 +3,10 @@
jQuery
========

(get a guide to help out)

#. edit an html page
#. get jQuery
#. go wild!


10 changes: 10 additions & 0 deletions docs/badges/badge_matplotlib.rst
@@ -0,0 +1,10 @@
.. badge_matplotlib
Graphing with Matplotlib
--------------------------------

.. note::

This badge is raw and incomplete.

#. https://github.com/jesstess/BostonPythonWorkshop/tree/master/graphing_with_matplotlib
2 changes: 2 additions & 0 deletions docs/badges/badge_reading_the_text.rst
Expand Up @@ -91,6 +91,8 @@ Learn the Keyboard!
/ slash, forward slash
\ backslash
! bang, exclamation point
| pipe (vertical bar)
* star, asterisk
======= ==============================


Expand Down
16 changes: 16 additions & 0 deletions docs/badges/badge_twitter_client.rst
Expand Up @@ -2,3 +2,19 @@

Build a Twitter Client
----------------------------

#. (Grab a group guide to help out! This is rough and imcomplete)
#. http://search.twitter.com/api/
#. ::

>>> import json
>>> import urllib
>>> q = "http://search.twitter.com/search.json?q=pystar"
>>> print urllib.urlopen(q)
>>> print urllib.urlopen(q).read()
>>> d = json.loads(urllib.urlopen(q))
>>> print d['results'][0]

#. Discuss ``urllib``, ``json``, etc.
#. Do some other kinds of searches.
#. Continue from here with https://github.com/jesstess/BostonPythonWorkshop/tree/master/twitter_api
6 changes: 4 additions & 2 deletions docs/badges/index.rst
Expand Up @@ -13,14 +13,16 @@ List of Badges!
badge_setup_linux
badge_setup_mac
badge_setup_win
badge_cmd_nav
badge_inthebeginning
badge_LPTHW
badge_self_help
badge_cmd_nav
badge_inthebeginning
badge_edit_html
badge_python_data_types
badge_pip
badge_colorwall
badge_twitter_client
badge_matplotlib
badge_LPTHW_2
badge_djangoapp
badge_python_tutorial
Expand Down

0 comments on commit 0244adb

Please sign in to comment.