This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sqlite3 | |
| import os.path | |
| from os import listdir, getcwd | |
| from IPython.core.display import Image | |
| def get_picture_list(rel_path): | |
| abs_path = os.path.join(os.getcwd(),rel_path) | |
| print 'abs_path =', abs_path | |
| dir_files = os.listdir(abs_path) | |
| return dir_files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| from time import sleep | |
| import sqlite3 | |
| import os, requests, sys, json | |
| import GISTkey | |
| username=GISTkey.gistkey()[0] | |
| password=GISTkey.gistkey()[1] | |
| database ="GISTstore/gist.db" | |
| conn = sqlite3.connect(database) | |
| c = conn.cursor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # USE: | |
| #import GISTkey | |
| #username=GISTkey.gistkey()[0] | |
| #password=GISTkey.gistkey()[1] | |
| def gistkey(): | |
| username='username' | |
| password="password" | |
| GistAPI = (username, password) | |
| return GistAPI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| #USE: python SimpleGistPost.py FileToPost.py | |
| import os, requests, sys, json | |
| import GISTkey | |
| from time import sleep | |
| username=GISTkey.gistkey()[0] | |
| password=GISTkey.gistkey()[1] | |
| filename = os.path.basename(sys.argv[1]) | |
| content=open(filename, 'r').read() | |
| r = requests.post('https://api.github.com/gists',json.dumps({'files':{filename:{"content":content}}}),auth=requests.auth.HTTPBasicAuth(username, password)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pyglet | |
| def exit_callback(dt): | |
| pyglet.app.exit() | |
| return | |
| def pmp3(mp3File): | |
| music = pyglet.media.load(mp3File) | |
| music.play() | |
| pyglet.clock.schedule_once(exit_callback , music.duration) | |
| pyglet.app.run() | |
| return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # USAGE example: | |
| # import UnCamel | |
| # x = "TimeToUncamelCaseTextUsingFunctions" | |
| # UnCamel.uncamel(x) | |
| def uncamel(x): | |
| return reduce(lambda a,b: a + ((b.upper() == b and (len(a) and a[-1].upper() != a[-1])) | |
| and (' ' + b) or b), x, '') | |
| def uncam(x): | |
| import re | |
| return re.sub("([a-z])([A-Z])","\g<1> \g<2>",x) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| USAGE: | |
| import dir2file | |
| PATH = "MP3/" | |
| mfile = "GISTstore/muz.list" | |
| dir2file.mkFile(mfile, PATH) | |
| lists all file in a directory and copies the list to a file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sqlite3 | |
| """ | |
| import ViewRows | |
| database = "runit.db" | |
| Start = 10 | |
| NumToView= 15 | |
| ViewRows.viewrows(database,NumToView,Start) | |
| """ | |
| def viewrows(database,NumToView,Start): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| This file does strange stuff. It will find a random sentence then store the first | |
| word of that sentence, then it will randomly search text for that word, then record | |
| the following word. | |
| The words are recorded in a file and in a sqlite database. Basically it builds a collection | |
| of words that follow words. | |
| One goal is to find the most common two, three and four word combinations | |
| """ |