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


In [43]:
ls


artcontrol-api/  BeOk/       notebooks/  pybackupz/   pywp-post/     RedditPress/  wirepil/
bbc2wp/          intercity/  pyatakl/    pyunderdog/  RedditePress/  skins/

In [44]:
import os

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


  File "<ipython-input-45-602fb1135544>", line 1
    listkindy = list(os.listdir(os.getcwd())
                                            ^
SyntaxError: unexpected EOF while parsing

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


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

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

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

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


Out[48]:
['notebooks',
 'pyatakl',
 'BeOk',
 'RedditPress',
 'pyunderdog',
 'pybackupz',
 'artcontrol-api',
 'RedditePress',
 'intercity',
 'wirepil',
 'pywp-post',
 'bbc2wp',
 'skins']

In [77]:
dabook = []

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


---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-78-537696104ceb> in <module>()
----> 1 os.mkdir('notebooks')

OSError: [Errno 17] File exists: 'notebooks'

In [79]:
import shutil

In [80]:
os.getcwd()


Out[80]:
'/home/public/github'

In [81]:
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')


notebooks
pyatakl
.gitignore
pyatakl
.git
README.md
LICENSE
tests
.ipynb_checkpoints
BeOk
CVipynb_files
ang.png
savPrn
start.py
savTlc
.git
artcontrol.ipynb
redTube.ipynb
README.md
aslyum.ipynb
CV.ipynb
www.website.org
CV2.ipynb
LICENSE
twitter.py
civ.html
Linux
land.png
CV.ipynb_files
tweet
civ
CVipynb.html
code.html
CV.ipynb.html
depTlc
RedditPress
random
tradeLast.py
image.svg
apiNyt
.git
scatter.svg
README.md
wordpress_xmlrpc
Untitled0.ipynb
urlSave
redDrawn.py
tradeTitle
TradePress.py
twitter.txt
NumPyExplore.ipynb
titleData
subrd
redditdrawn
LastData
doc
tradeData
json.ipynb
numFile
fileSave
trademe.py
wriBbc
pprint
pyunderdog
.gitignore
underdog
pydog.ipynb
.git
README.md
LICENSE
pyEmailz.ipynb
pyunderdog.py
pybackupz
.git
README.md
LICENSE
backupz.ipynb
pybac.py
artcontrol-api
imgedit.ipynb
pywgit.py
wcmckee.rst
Untitled1.py
testz
artcontrol.py
pynztacam.py
.gitignore
scrapnot.ipynb
dh.py
ipython_log.py.001~
savPrn
ipython_log.py
testing123
pyssh.py
.git
Untitled3.ipynb
Untitled1.ipynb
dh.ipynb
myfile.txt
githcli
artcontrol.ipynb
Game Of Thrones.ipynb
oceanconnor.ipynb
README.md
salecus.ipynb
passwd
pyssh.ipynb
hcpux
Untitled0.py
redTube.py
githsec
Untitled0.ipynb
LICENSE
config
test.html
122.jpg
output.file
aklmcam.py
aklmcam.ipynb
pyblen.py
spellcheckin.ipynb
passap
artcontrolme.wordpress.2014-02-10.xml
example.xls
.ipynb_checkpoints
pynztacam.ipynb
openimg.ipynb
ipython_log.py.002~
spellcheckin.py
cpuclu.json
Game Of Thrones.py
tlchome.html
Untitled3.py
pywgit.ipynb
latepost
tlc.py
gpaz
uploads.html
Untitled2.ipynb
pywgitz.py
tlc.ipynb
linkz
atkey
Peterwest.py
openimg.py
scrapnot.py
~
prnsav
sortbooks.ipynb
Untitled2.py
result
Peterwest.ipynb
tpb.ipynb
dhcpd.leases
salecus.py
home.html
RedditePress
.git
intercity
.git
intercity.py
outpuz.txt
README.md
webData.ipynb
README.MD
htmldoc
output
textOutput
outputz
testing.txt
wirepil
.gitignore
.git
wirePIL.py
artcontrol.ipynb
README.md
smerk-color.png
reddit.ipynb
wirePIL.ipynb
Untitled0.ipynb
LICENSE
hello.PNG
blendTitle.jpg
loop.ipynb
love.ttf
street1016.jpg
ftpWCM.ipynb
street0276.jpg
street1715.jpg
33561.jpg
edit.jpg
guardian_gaza_ipynb
title1111.jpg
cs.ttf
pywp-post
.gitignore
post.py
wordpress.ipynb
test-wp.ipynb
.git
README.md
LICENSE
test.py
netcafe.ipynb
pywp-post.py
bbc2wp
savFile
savPrn
.jsonEdit.py.swo
.git
redTube.ipynb
jsonEdit.py
README.md
jsonBehind.ipynb
pressBbc.py
.jsonEdit.py.swp
pressPrn.py
NumPyExplore.ipynb
savTit
tacBbc
savTag
savBbc
json(6).ipynb
skins
.git
karen.ipynb
README.md
skins.py
LICENSE
hamgar.ipynb
skins.ipynb

In [85]:
#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 [86]:
dabook


Out[86]:
['/home/public/github/BeOk/CVipynb_files',
 '/home/public/github/BeOk/redTube.ipynb',
 '/home/public/github/BeOk/CV.ipynb',
 '/home/public/github/BeOk/CV.ipynb_files',
 '/home/public/github/BeOk/CV.ipynb.html',
 '/home/public/github/RedditPress/NumPyExplore.ipynb',
 '/home/public/github/pyunderdog/pydog.ipynb',
 '/home/public/github/pybackupz/backupz.ipynb',
 '/home/public/github/artcontrol-api/scrapnot.ipynb',
 '/home/public/github/artcontrol-api/Untitled1.ipynb',
 '/home/public/github/artcontrol-api/artcontrol.ipynb',
 '/home/public/github/artcontrol-api/oceanconnor.ipynb',
 '/home/public/github/artcontrol-api/pyssh.ipynb',
 '/home/public/github/artcontrol-api/aklmcam.ipynb',
 '/home/public/github/artcontrol-api/.ipynb_checkpoints',
 '/home/public/github/artcontrol-api/openimg.ipynb',
 '/home/public/github/artcontrol-api/Untitled2.ipynb',
 '/home/public/github/artcontrol-api/sortbooks.ipynb',
 '/home/public/github/artcontrol-api/tpb.ipynb',
 '/home/public/github/wirepil/artcontrol.ipynb',
 '/home/public/github/wirepil/wirePIL.ipynb',
 '/home/public/github/wirepil/loop.ipynb',
 '/home/public/github/wirepil/guardian_gaza_ipynb',
 '/home/public/github/pywp-post/test-wp.ipynb',
 '/home/public/github/bbc2wp/redTube.ipynb',
 '/home/public/github/bbc2wp/NumPyExplore.ipynb',
 '/home/public/github/skins/karen.ipynb',
 '/home/public/github/skins/skins.ipynb']

In [86]:


In [54]:


In [ ]: