Skip to content

Instantly share code, notes, and snippets.

View BlogBlocks's full-sized avatar

Jack Northrup BlogBlocks

View GitHub Profile
"""
A lot to look over here.
This file sets in a directory contain
./cfdg_files ( your database and the binary cfdg file ALSO a list of CFDG files on your computer)
./cfdg_files/cfdgs/ ( here is where your *.cfdg files ate generated )
./cfdg_files/images/ ( where you image files are generated )
Using the CFDG grammar/script inside the triple apostophies:
It generates a file ( filename = "cfdg_files/cfdgs/learning005.cfgd" ) rename this to save new files.
Then it saves the cfdg script in a SQLITE database. Then runs the the cfdg script saves and
# ODD number are Code
# Even numbers were created just generate an index file
import sqlite3
def ViewGist():
database ="GISTstore/gist.db"
conn = sqlite3.connect(database)
c = conn.cursor()
rowid = raw_input("ROWID : ")
rowid =str(rowid)
for row in c.execute('SELECT rowid, content, description, filename FROM gist \
"""
Comparing entries in Snippets.txt by hashing the snippets
I made a duplicate to text it.
Hash the snippets then check set() s of the HASH for duplicates.
Just playing with Python Works great. Snippets.txt is in my gists
it is loaded with snippets and script.
"""
import hashlib
import string
Hash = []
Line No. :1
ROWID :1
delimiters = ['\n', ' ', ',', '.', '?', '!', ':', 'and_what_else_you_need']
words = content
for delimiter in delimiters:
new_words = []
for word in words:
new_words += word.split(delimiter)
words = new_words
# https://github.com/amalzaga/python-opencv/blob/master/rgb-hsv.py
# 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
import cv2
import numpy as np
def nothing(x):
"""
Counts / compares the number of lines in two files.
Usage:
python countlines.py a.txt b.txt
OR
import countlines
fname0 = 'a.txt'
fname1 = 'b.txt'
"""
Compare two files:
First check number of lines then number of characters
Then print the two line by line one on top of the other.
"""
from time import sleep
from multiprocessing import Process
fname0 = 'a.txt'
fname1 = 'b.txt'
def basecompare(fname0,fname1):
"""Creates a name based on a url:
USAGE:
URL_local = "News---Somali-hijackings-after-five-year-lull_icc-ccs.org_.html"
Ntitle(URL_local)
If used as a module:
import Beautihelp
Beautihelp.Ntitle(URL_local)
"""
def Ntitle(URL_local, exten = -5, length= -17, NewExt = ".txt"):
#removes the period
"""
Example: IBM Boulder, CO
Address or Place of Interest :IBM Boulder, CO
Returned:
7 -- lat: 40.0893174,
8 -- lng: -105.1981258},
80 -- formatted_address:
81 -- 6300 Diagonal Hwy, Boulder, CO 80301, USA
83 -- establishment
84 -- point_of_interest
#!/usr/local/bin/python
#Author: JackNorthrup
#Usage : python viewNlines.py data/co2.csv 5
import sys
PATH= sys.argv[1]
try:
N = int(sys.argv[2])
except ValueError:
print "path is to be followed by number of lines to read"
sys.exit(1)