-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
elicity
committed
Dec 30, 2017
0 parents
commit ad899ea
Showing
20 changed files
with
271 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
.idea | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
.static_storage/ | ||
.media/ | ||
local_settings.py | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM python:3.6 | ||
MAINTAINER geod | ||
COPY . /app | ||
WORKDIR /app | ||
RUN pip install -r requirements.txt | ||
#ENTRYPOINT ["python"] | ||
CMD ["python", "w4156/app.py"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
NEWMAC=`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'` | ||
echo $NEWMAC | ||
sudo ifconfig en0 ether $NEWMAC |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docker run -i -t --rm --entrypoint /bin/bash w4156 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
docker build -t w4156:latest . |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
CONTAINERID=`docker ps | grep w4156 | cut -d" " -f1` | ||
|
||
if [ -z ${CONTAINERID} ]; | ||
then | ||
echo "Container not found" | ||
else | ||
docker exec -it $CONTAINERID bash | ||
fi | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
docker run -d -p 5000:5000 w4156 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
CONTAINERID=`docker ps | grep w4156 | cut -d" " -f1` | ||
|
||
if [ -z ${CONTAINERID} ]; | ||
then | ||
echo "Container not found" | ||
else | ||
docker stop $CONTAINERID | ||
fi | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
#NOTE - this runs the tests within the docker container | ||
|
||
docker run --interactive --tty w4156 'bin/tests_run.sh' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
# Note - runs tests outside of the docker container | ||
|
||
python -m unittest |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
source ./env/bin/activate | ||
|
||
export PYTHONPATH=`pwd` | ||
echo PYTHONPATH:$PYTHONPATH |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
virtualenv --python=python3.6 env |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
boto3==1.5.7 | ||
botocore==1.8.21 | ||
docutils==0.14 | ||
jmespath==0.9.3 | ||
python-dateutil==2.6.1 | ||
s3transfer==0.1.12 | ||
six==1.11.0 | ||
wheel==0.24.0 | ||
Flask==0.12.2 |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# import boto3 | ||
# | ||
# print('creating dynamodb resource') | ||
# | ||
# dynamodb = boto3.resource( | ||
# 'dynamodb', | ||
# endpoint_url='http://localhost:8000', | ||
# region_name='dummy_region', | ||
# aws_access_key_id='dummy_access_key', | ||
# aws_secret_access_key='dummy_secret_key', | ||
# verify=False) | ||
# | ||
# print('got resource:', dynamodb) | ||
# | ||
# print('adding table') | ||
# | ||
# result = dynamodb.create_table( | ||
# TableName='foo', | ||
# KeySchema=[ | ||
# { | ||
# 'AttributeName': 'from_email', | ||
# 'KeyType': 'HASH' # Partition key | ||
# }, | ||
# { | ||
# 'AttributeName': 'raw_id', | ||
# 'KeyType': 'RANGE' # Sort key | ||
# }, | ||
# ], | ||
# AttributeDefinitions=[ | ||
# { | ||
# 'AttributeName': 'from_email', | ||
# 'AttributeType': 'S' | ||
# }, | ||
# { | ||
# 'AttributeName': 'raw_id', | ||
# 'AttributeType': 'N' | ||
# }, | ||
# ], | ||
# ProvisionedThroughput={ | ||
# 'ReadCapacityUnits': 10, | ||
# 'WriteCapacityUnits': 10 | ||
# } | ||
# ) | ||
# | ||
# print('created table:', result) | ||
# | ||
# print('getting table') | ||
# | ||
# table = dynamodb.Table('foo') | ||
# | ||
# print('got table:', table) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import os | ||
import w4156.app as flaskapp | ||
import unittest | ||
import tempfile | ||
|
||
|
||
class FlaskTestCase(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.db_fd, flaskapp.app.config['DATABASE'] = tempfile.mkstemp() | ||
flaskapp.app.testing = True | ||
self.app = flaskapp.app.test_client() | ||
# with w4156.app.app_context(): | ||
# w4156.init_db() | ||
|
||
def test_hello(self): | ||
rv = self.app.get('/') | ||
self.assertEqual(rv.data, "Hello, World!") | ||
|
||
def tearDown(self): | ||
os.close(self.db_fd) | ||
os.unlink(flaskapp.app.config['DATABASE']) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import unittest | ||
|
||
|
||
class MyTestCase(unittest.TestCase): | ||
def test_something(self): | ||
self.assertEqual(True, False) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from flask import Flask | ||
app = Flask(__name__) | ||
|
||
|
||
@app.route('/') | ||
def hello_world(): | ||
return 'Hello, World!' | ||
|
||
if __name__ == '__main__': | ||
app.run(debug=True, host='0.0.0.0') |
Empty file.