This is a script to get all notebooks from a github user and download, turning them into rst pages.


In [1]:
ls


9BAAdt                 json.html         riftplz.py
Game Of Thrones.html   json.ipynb        salecus.ipynb
Game Of Thrones.ipynb  jsonBehind.html   savPrn
LICENSE                jsonBehind.ipynb  scrapnot.html
LICENSE.save           karen.html        scrapnot.ipynb
NumPyExplore.html      karen.ipynb       scrapnot.py
NumPyExplore.ipynb     linkz             skins.html
README.md              loop.html         skins.ipynb
Untitled0.html         loop.ipynb        sortbooks.html
Untitled0.ipynb        markdown.html     sortbooks.ipynb
Untitled1.html         markdown.ipynb    spellcheckin.html
Untitled1.ipynb        markdown.py       spellcheckin.ipynb
Untitled2.ipynb        master.html       tarpipe.html
Untitled2.py           metatime.html     tarpipe.ipynb
adypost.html           metatime.ipynb    tarpipe.py
adypost.ipynb          myfile.txt        test-wp.html
adypost.py             nbconv.html       test-wp.ipynb
aklmcam.html           nbconv.ipynb      test.html
aklmcam.ipynb          nbconv.py         test.ipynb
aklmcam.py             netcafe.html      testing.txt
artcontrol.html        netcafe.ipynb     tlc.html
artcontrol.ipynb       opche.html        tlc.ipynb
artcontrol.py          opche.ipynb       tlc.py
bugit.html             openimg.html      tlchome.html
bugit.ipynb            openimg.ipynb     tpb.html
bugit.py               output            tpb.ipynb
compohub.ipynb         outpuz.txt        url redirect.html
compohub.py            pyEmailz.html     url redirect.ipynb
cpuclu.json            pyEmailz.ipynb    utils.html
csae__                 pyEmailz.py       utils.ipynb
digzocean.html         pyatakl.html      wallpapersav.html
digzocean.ipynb        pyatakl.ipynb     wallpapersav.ipynb
digzocean.py           pyatakl.py        wcmckee.rst
flask-test.html        pydog.html        wcmdocker.html
flask-test.ipynb       pydog.ipynb       wcmdocker.ipynb
flask-test.py          pydog.py          wcmgit.html
ftpWCM.html            pynztacam.html    wcmgit.ipynb
ftpWCM.ipynb           pynztacam.ipynb   wcmgit.py
ftpWCM.py              pyssh.html        webData.html
getdrawn.html          pyssh.ipynb       webData.ipynb
getdrawn.ipynb         pywgit.ipynb      webData.py
getdrawn.py            redTube.html      whai.html
hackbrobeur.html       redTube.ipynb     whai.ipynb
hackbrobeur.ipynb      redTube.py        whai.py
hackbrobeur.py         reddit.html       wiki.md
hamgar.html            reddit.ipynb      wirePIL.html
hamgar.ipynb           reddit.py         wirePIL.ipynb
htmldoc                result            wordpress.html
imgedit.ipynb          rgdsnatch.html    wordpress.ipynb
imgedit.py             rgdsnatch.ipynb   yoga.ipynb
index.html             rgdsnatch.py      yoga.py
index.ipynb            rgdsnatch.tex
index.py               riftplz.ipynb

In [2]:
import os

In [6]:
listkindy = list(os.listdir(os.getcwd()))

In [7]:
os.listdir(os.getcwd)


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-7-277901f21ef6> in <module>()
----> 1 os.listdir(os.getcwd)

TypeError: coercing to Unicode: need string or buffer, builtin_function_or_method found

In [8]:
gdir = ('/home/public/github/')

In [9]:
os.listdir('/home/public/github/')


---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-9-ee89d493c687> in <module>()
----> 1 os.listdir('/home/public/github/')

OSError: [Errno 2] No such file or directory: '/home/public/github/'

In [10]:
dabook = []

In [11]:
os.mkdir('notebooks')

In [12]:
import shutil

In [13]:
os.getcwd()


Out[13]:
'/var/www/wcmckee-notebook'

In [14]:
for filz in os.listdir(gdir):
    print filz
    for fila in os.listdir(gdir + filz):
        print fila
        if 'ipynb' in fila:
            dabook.append(os.getcwd() + '/' + filz + '/' + fila)
        #    shutil.copy(fila, '/home/public/notebooks')


---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-14-390feb717b63> in <module>()
----> 1 for filz in os.listdir(gdir):
      2     print filz
      3     for fila in os.listdir(gdir + filz):
      4         print fila
      5         if 'ipynb' in fila:

OSError: [Errno 2] No such file or directory: '/home/public/github/'

In [15]:
#for da in dabook:
#    if 'checkpoints' or '.html' in da:
#        dabook.remove(da) # removes too many, filter so it only 
                            #removes files i don't want. if they dont end
    #with .ipynb, i dont want to see them.

In [16]:
dabook


Out[16]:
[]

In [86]:


In [54]:


In [ ]: