./thesis
├── docker-compose.yaml
├── micrsoserviceX
├── micrsoserviceY
├── memory-engine
Adapted from here. Below is an executive summary for the use case of a university collaborative thesis project.
alias t='docker-compose run --no-deps --rm web python manage.py test' | |
alias init_db='docker-compose run --no-deps --rm web python manage.py init_db' | |
alias drop_db='docker-compose run --no-deps --rm web python manage.py drop_db' | |
alias shell='docker-compose run --no-deps --rm web python manage.py shell' |
import datetime | |
# m/d/y | |
StartDate = "2/12/16" | |
EndDate = "5/13/16" | |
date = datetime.datetime.strptime(StartDate, "%m/%d/%y") | |
dates = [date] | |
endDate = datetime.datetime.strptime(EndDate, "%m/%d/%y") |
#include <stdio.h> | |
#include <string.h> | |
void function(int a, int b, int c) { | |
char buffer1[5]; | |
char buffer2[10]; | |
int *ret; | |
ret = buffer1 + 12; | |
(*ret) += 8; | |
} |
j = 8 | |
for j in range(1, j+1): # [1..j] # from 1 to j, including j | |
for i in range(j-2, 0-1, -1): # from j-2 "downto" 0; including 0 | |
for k in range(i+1, j-1+1): # [i .. j-1] from i to j-1, including j-1 | |
print("(j=%s,i=%i,k=%s)"%(j,i,k)) |
import unittest | |
from unittest import TestCase | |
""" | |
Showcase how to use mixins and multiple inheritance to write tests | |
""" | |
class BaseTest(TestCase): | |
""" | |
A base class to be inheritated by actuall test classes. | |
""" | |
def setUp(self): # 3 |
import threading | |
from requests import get | |
import queue | |
from datetime import datetime as dt | |
# Given a csv file with domain names, retrieve the content of the webpage, and given a predicate, add the domain name to a result set if the | |
# response from the passes the check of the predicate. | |
# Results are written to a timestamped file in the same directory of the script. | |
### Predicates | |
# Given a requests.Response object return True if the URL should be added to the result |
./thesis
├── docker-compose.yaml
├── micrsoserviceX
├── micrsoserviceY
├── memory-engine
Adapted from here. Below is an executive summary for the use case of a university collaborative thesis project.
from datetime import datetime as dt, timedelta as td | |
def datetime_range(start, end, step): | |
assert end >= start, "The end date should be after in time than the start. End: {end} Start:{start}".format(end=end, | |
start=start) | |
i = 0 |
def print_object_attrs(obj): | |
print("%s:" % obj.__name__) | |
for name, value in [(v, getattr(obj, v)) for v in obj.__dict__ if not v.startswith('__')]: | |
print("%s=%s" % (name, value)) |
class SomeClass { | |
public a; | |
public b; | |
constructor() { | |
this.a = '1'; | |
this.b = [] | |
} | |
one = () => { | |
console.log(`one = () => {} ${this.a}`) | |
this.b.push('one') |