Skip to content

Instantly share code, notes, and snippets.

View BlogBlocks's full-sized avatar

Jack Northrup BlogBlocks

View GitHub Profile
"""
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):
"""
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'
# 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):
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
"""
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 = []
# 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 \
"""
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
"""
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
"""
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()
@BlogBlocks
BlogBlocks / rgb_hsv_colorpicker.py
Last active December 19, 2017 00:35
Colorbar color picker
# 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