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 is a set of SQLite database tools for the file runit.py | |
| create_or_open_db(db_file) | |
| Creates or open a database and keeps it open for use | |
| """ | |
| import os | |
| import sqlite3 | |
| def create_or_open_db(db_file): | |
| db_is_new = not os.path.exists(db_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
| """ | |
| MP3 playlist created to be used in syncing an audio/slide program . | |
| Usage: | |
| for example to load the 'TestText2.txt.mp3' | |
| import MP3play | |
| sound_file = MP3play.play()[2] | |
| """ | |
| def play(): | |
| mp3File0 = 'TestText0.txt.mp3' | |
| mp3File1 = 'TestText1.txt.mp3' |
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
| """ | |
| Gets tablename and column names from unknown database | |
| just enter database name. | |
| USAGE: | |
| import dbINFO | |
| database= "databases/history.db" | |
| #database= "databases/sat2.db" | |
| #database= "databases/ImageD.db" | |
| dbINFO.dbinfo(database) |
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
| #Creating a database and inserting binaries | |
| """ | |
| Created to store sound for slide show clips. However it will store any files in binary | |
| database. Great for images | |
| """ | |
| import sqlite3 | |
| def open_db(database): | |
| conn = sqlite3.connect(database) |
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
| # Playing the Binary Music File | |
| # the player for the storebinary music | |
| import sqlite3 | |
| def extract_binary(cursor, picture_id): | |
| sql = "SELECT binaryD, TYPE, FILE_NAME FROM Binaries WHERE id = :id" | |
| param = {'id': picture_id} | |
| cursor.execute(sql, param) | |
| ablob, ext, afile = cursor.fetchone() | |
| filename = afile + ext | |
| with open(filename, 'wb') as output_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
| # Useage: python GistIndex.py | |
| # Prints an index of all posts in the database created by post2gist.py | |
| import sqlite3 | |
| def Index(): | |
| database ="GISTstore/gist.db" | |
| conn = sqlite3.connect(database) | |
| c = conn.cursor() | |
| for row in c.execute('SELECT rowid, content, description, filename FROM gist \ | |
| WHERE content = ?', ("Index",)): | |
| print row[0],row[1],row[2],row[3] |
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
| """ | |
| Description: find terminal command in bash history | |
| Purpose created: I had run several files using the word 'cfdg' in the command. | |
| This was several months ago. I wanted to retrieve all lines in my bash history | |
| where that command was used. | |
| If used remember to change the user to your name. | |
| This script will create a file 'using-(whatever search term used).txt' | |
| in this case using-cfdg.txt. The first line of the print will be the filename generated |
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
| # Creates a solid color image wich can be changed by using two sets | |
| # of trackbars RGB and HSV. Changing one affects the other | |
| # It is a practical way to better understanding of colorspaces. | |
| # | |
| # Written by Amador Alzaga | |
| #!/usr/bin/python | |
| import cv2 | |
| import numpy as np |
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 script just creates a color wheel | |
| it was an answer to a quested created | |
| by J Richard Snape | |
| """ | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| from matplotlib import cm | |
| import matplotlib as mpl | |
| fig = plt.figure() |
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 Hashes the list items and compares it to the a Hash of the proposed entry | |
| if entry exists it prints. list and "is already in" and the entry so you may see. | |
| if it enters it the new list is printed | |
| import NoListDups | |
| entrY = "XXiX" | |
| x = ['XXX', 'yyy', 'zzz'] | |
| NoListDups.NoDupList(x, entrY) | |
| print x |