Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View donlovett's full-sized avatar

Don Lovett donlovett

  • ProjectBits Consulting
  • 20191
View GitHub Profile
@donlovett
donlovett / test.html
Created August 8, 2022 14:37
Hello World Html
<html>
<head>
<style>
h1 {
font-family: Calibri;
}
</style>
</head>
<body>
<h1>Hello World!</h1>
@donlovett
donlovett / test.md
Last active August 8, 2022 14:36
Hello World Markdown

Hello World

This is content converted from Markdown!

Here's a JSON sample:

{
  "foo": "bar"
}
@donlovett
donlovett / assign2_emaildb.py
Created September 30, 2016 03:36
Coursera Python DB Course Week2 Assignment 2
import sqlite3
conn = sqlite3.connect('orgdb.sqlite')
cur = conn.cursor()
dnsmapping = dict()
cur.execute('''
DROP TABLE IF EXISTS Counts''')
cur.execute('''
import urllib
import xml.etree.ElementTree as ET
#url = raw_input('Enter file: ')
#url = 'http://python-data.dr-chuck.net/comments_318170.xml'
url = 'http://64.137.250.177/comments_42.xml'
mycounter = 0
mysum = 0
while True:
import urllib
import json
# step 1 determine file to read from the web
# #url = raw_input('Enter file: ')
#url = 'http://python-data.dr-chuck.net/comments_42.json'
#url = 'http://python-data.dr-chuck.net/comments_318174.json'
url = 'http://64.137.250.177/comments_318174.json'
mycounter = 0
mysum = 0
countval = 0
@donlovett
donlovett / assign2_geojson.py
Created September 25, 2016 03:13
Final Assignment Week 6 Geojson
import urllib
import json
serviceurl = 'http://python-data.dr-chuck.net/geojson?'
while True:
address = raw_input('Enter location: ')
if len(address) < 1 : break
url = serviceurl + urllib.urlencode({'sensor':'false', 'address': address})
@donlovett
donlovett / jason_webfile.py
Created September 25, 2016 02:20
Final As Submitted
import urllib
import json
# step 1 determine file to read from the web
# #url = raw_input('Enter file: ')
#url = 'http://python-data.dr-chuck.net/comments_42.json'
url = 'http://python-data.dr-chuck.net/comments_318174.json'
mycounter = 0
mysum = 0
# step 2 read web info into a dictionary
while True:
@donlovett
donlovett / jason_webfile.py
Created September 25, 2016 02:05
This is the first assignement for week 6 of the Python Data Course
import urllib
import json
# step 1 determine file to read from the web
# #url = raw_input('Enter file: ')
#url = 'http://python-data.dr-chuck.net/comments_42.json'
url = 'http://python-data.dr-chuck.net/comments_318174.json'
mycounter = 0
mysum = 0
# step 2 read web info into a dictionary
while True:
@donlovett
donlovett / xml4webfile.py
Created September 22, 2016 19:33
Final Week 5 Assignment to pull XML from Web and sum count element
import urllib
import xml.etree.ElementTree as ET
url = raw_input('Enter file: ')
#url = 'http://python-data.dr-chuck.net/comments_318170.xml'
mycounter = 0
mysum = 0
while True:
print 'Retrieving', url
@donlovett
donlovett / xml4localfile.py
Created September 22, 2016 18:14
update with stats labeled and debut prints out
import xml.etree.ElementTree as ET
#fname = raw_input('Enter the file name: ')
#fname = '/home/vagrant/Coursera/Week5/comments_42.xml'
fname = '/home/vagrant/Coursera/Week5/comments_318170.xml'
try:
tree = ET.ElementTree(file=fname)
print 'Retreived ',fname
#Retrieved 4204 characters
except:
print 'File cannot be opened:', fname