Skip to content

Instantly share code, notes, and snippets.

View brydavis's full-sized avatar

Bryan Davis brydavis

View GitHub Profile
@brydavis
brydavis / database.py
Created August 13, 2019 23:58
Mongo Code from Lesson 5 and 7
import csv
from pprint import pprint
from pymongo import MongoClient
import threading
# https://stackoverflow.com/questions/35813854/how-to-join-multiple-collections-with-lookup-in-mongodb
"""
High Level Requirements
import logging
import threading
import time
class FakeDatabase:
def __init__(self):
self.value = 0
def update(self, name):
logging.info("Thread %s: starting update", name)
import sys
import threading
import time
def func():
for i in range(5):
print("hello from thread %s" % threading.current_thread().name)
time.sleep(1)
threads = []
@brydavis
brydavis / simple_s3_demo.py
Created August 10, 2019 17:48
Simple S3 operations
# install boto3
# pip install --upgrade boto3
# setup IAM and get credentials
# https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html
# https://console.aws.amazon.com/iam/home
"""
- Create a User
- Give user a name and set "Programmatic access" only for Access Type
@brydavis
brydavis / demo.py
Last active August 10, 2019 17:43
UWPCE - Lesson 06
import time
import math
# from timeit import timeit
# print(timeit('[x for x in range(100)]', number=1000))
# print(timeit('[x for x in range(100)]', number=1000))
# print(timeit(lambda: [x for x in range(100)], number=1000))
def do_math():
docker run --name mongo -p 27017:27017 -d mongo mongod
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""
Autograde Lesson 3 assignment
Run pytest
Run cobverage and linitng using standard batch file
Student should submit an empty database
"""
import pytest
import logging
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.