Repository: jwasham/computer-science-flash-cards
Branch: main
Commit: 360cfdece0cd
Files: 30
Total size: 80.1 KB
Directory structure:
gitextract_vd9a3nyi/
├── .gitignore
├── Dockerfile
├── README.md
├── config.txt
├── data/
│ ├── handle_old_schema.sql
│ └── schema.sql
├── db/
│ └── .gitkeep
├── docker-compose.yml
├── entrypoint.sh
├── flash_cards.ini
├── flash_cards.py
├── flash_cards.service
├── license.md
├── requirements.txt
├── static/
│ ├── general.js
│ ├── highlight-theme-github.css
│ ├── highlight.pack.js
│ └── style.css
├── templates/
│ ├── cards.html
│ ├── createDb.html
│ ├── edit.html
│ ├── editTag.html
│ ├── layout.html
│ ├── listDb.html
│ ├── login.html
│ ├── memorize.html
│ ├── memorize_known.html
│ ├── show.html
│ └── tags.html
└── wsgi.py
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
.idea/
py3env/
__pycache__/
*.pyc
config-personal.txt
cards.db
env
================================================
FILE: Dockerfile
================================================
FROM python:3.9
LABEL maintainer="Tinpee <tinpee.dev@gmail.com>"
ADD . /src
WORKDIR /src
RUN pip install --upgrade pip \
&& pip install flask gunicorn
COPY entrypoint.sh /
RUN sed -i 's/\r$//' /entrypoint.sh
RUN chmod +x /entrypoint.sh
VOLUME /src/db
EXPOSE 8000
CMD ["/entrypoint.sh"]
================================================
FILE: README.md
================================================
# Computer Science Flash Cards
This is a little website I've put together to allow me to easily make flash cards and quiz myself for memorization of:
- General cs knowledge
- vocabulary
- definitions of processes
- powers of 2
- design patterns
- Code
- data structures
- algorithms
- solving problems
- bitwise operations
Will be able to use it on:
- desktop
- mobile (phone and tablet)
It uses:
- Python 3
- Flask
- SQLite
---
## About the Site
Here's a brief rundown: https://startupnextdoor.com/flash-cards-site-complete/
## Screenshots
UI for listing cards. From here you can add and edit cards.

---
The front of a General flash card.

---
The reverse (answer side) of a Code flash card.

## Important Note
The set included in this project (**cards-jwasham.db**) is not my full set, and is way too big already.
Thanks for asking for my list of 1,792 cards. But **it’s too much.** I even printed them out. It’s 50 pages, front and back, in tiny text. It would take about 8 hours to just read them all.
My set includes a lot of obscure info from books I’ve read, Python trivia, machine learning knowledge, assembly language, etc.
I've added it to the project if you want it (**cards-jwasham-extreme.db**). You've been warned.
Please make your own set, and while you’re making them, only make cards for what you need to know. Otherwise, it gets out of hand.
## How to convert to Anki or CSV
If you don't want to run a server, you can simply use Anki or a similar service/app. Use this script to convert from my sets (SQLite .db file), or yours, to CSV:
https://github.com/eyedol/tools/blob/master/anki_data_builder.py
Thanks [@eyedol](https://github.com/eyedol)
## Anki Flashcards:
* [computer science flash cards - (basic)](https://ankiweb.net/shared/info/1782040640)
* [computer science flash cards - (extreme)](https://ankiweb.net/shared/info/1691396127)
Thanks [@JackKuo-tw](https://github.com/JackKuo-tw)
## How to run it on a server
1. Clone project to a directory on your web server.
1. Edit the config.txt file. Change the secret key, username and password. The username and password will be the login
for your site. There is only one user - you.
1. Follow this long tutorial to get Flask running. It was way more work than it should be:
https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-ubuntu-16-04
- `wsgi.py` is the entry point. It calls `flash_cards.py`
- This is my systemd file `/etc/systemd/system/flash_cards.service`: [view](flash_cards.service)
- you can see the paths where I installed it, and the name of my virtualenv directory
- when done with tutorial:
```shell
sudo systemctl restart flash_cards
sudo systemctl daemon-reload
```
1. When you see a login page, you're good to go.
1. Log in.
1. Click the "General" or "Code" button and make a card!
1. When you're ready to start memorizing, click either "General" or "Code"
in the top menu.
## How to run it on local host (Quick Guide)
*Provided by [@devyash](https://github.com/devyash) - devyashsanghai@gmail.com - Reach out to this contributor if you have trouble.*
1. Install dependencies:
1. Install [Python](https://www.python.org/download/releases)
1. Add python as environment variable [windows](http://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows-7)
1. To install pip, securely download [get-pip.py](https://bootstrap.pypa.io/get-pip.py)
1. Run `python get-pip.py` in terminal
1. Add pip to your PATH system variable [windows](https://stackoverflow.com/questions/23708898/pip-is-not-recognized-as-an-internal-or-external-command)
1. Run `pip install -r requirements.txt` in terminal after going to correct folder
1. Type `python flash_cards.py` - if you get error for flask then use `python -m pip install Flask` first then run `flash_card.py` file
1. Open localhost:5000/
1. Login using 'admin' and 'default' for the username and password, respectively.
**NOTE:** If you wish to use John's flash cards then also do following steps:
1. Copy db files such as `cards-jwasham-extreme` OR `cards-jwasham` and paste them in db folder
1. Edit file `flash_cards.py` line 8 and replace 'cards.db' with any of the other database files e.g.('cards-jwasham.db')
1. Repeat the above steps from step 3
Every time you wish to run your db just open folder in terminal and run `python flash_cards.py`
## How to run with Docker
*Provided by [@Tinpee](https://github.com/tinpee) - tinpee.dev@gmail.com - Reach out to this contributor if you have trouble.*
__Make sure you already installed [docker](https://www.docker.com) and optionally [docker-compose](https://docs.docker.com/compose/install/)__
1. Clone project to any where you want and go to source folder.
1. Edit the `config.txt` file. Change the secret key, username and password. The username and password will be the login for your site. There is only one user - you.
1. Build image:
- Docker: `docker build . -t cs-flash-cards`
- Compose: `docker-compose build`
1. Run container:
- Docker: `docker run -d -p 8000:8000 --name cs-flash-cards cs-flash-cards`
- Compose: `docker-compose up`
1. Go your browser and type `http://localhost:8000`
__If you already had a backup file `cards.db`. Run following command:__
*Note: We don't need to rebuild image, just delete old container if you already built.*
```shell
docker run -d -p 8000:8000 --name cs-flash-cards -v <path_to_folder_contains_cards_db>:/src/db cs-flash-cards
```
- `<path_to_folder_contains_cards_db>`: is the full path contains `cards.db`.
- Example: `/home/tinpee/cs-flash-cards/db`, and `cards.db` is inside this folder.
For convenience, if you don't have `cards.db`, this container will auto copy a new one from `cards-empty.db`.
---
### How to backup data ?
We just need store `cards.db` file, and don't need any sql command.
- If you run container with `-v <folder_db>:/src/db` just go to `folder_db` and store `cards.db` anywhere you want.
- Without `-v flag`. Type: `docker cp <name_of_container>:/src/db/cards.db /path/to/save`
### How to restore data ?
- Delete old container (not image): `docker rm cs-flash-cards`
- Build a new one with `-v flag`:
`docker run -d -p 8000:8000 --name cs-flash-cards -v <path_to_folder_contains_cards_db>:/src/db cs-flash-cards`
- Voila :)
### How to deploy docker file on heroku
- first install [heroku CLI](https://devcenter.heroku.com/articles/heroku-cli)
- change `entrypoint.sh`
```shell
- export CARDS_SETTINGS=/src/config.txt
gunicorn --bind 0.0.0.0:$8000 flash_cards:app
+ export CARDS_SETTINGS=/src/config.txt
gunicorn --bind 0.0.0.0:$PORT flash_cards:app
```
- deploy docker file with following commands
```shell
heroku login
heroku container:login
heroku create
# Creating app... done, ⬢ your-app-name
heroku container:push web --app your-app-name
heroku container:release web --app your-app-name
heroku open --app your-app-name
```
## Alternative for Node fans
[@ashwanikumar04](https://github.com/ashwanikumar04) put together an alternative flash cards site running Node: https://github.com/ashwanikumar04/flash-cards
Check out the demo!
*Happy learning!*
================================================
FILE: config.txt
================================================
SECRET_KEY='some very long key here'
USERNAME='username-test'
PASSWORD='password-test'
================================================
FILE: data/handle_old_schema.sql
================================================
create table if not exists tags (
id integer primary key autoincrement,
tagName text not null
);
================================================
FILE: data/schema.sql
================================================
-- drop table if exists cards;
create table cards (
id integer primary key autoincrement,
type tinyint not null, /* 1 for vocab, 2 for code */
front text not null,
back text not null,
known boolean default 0
);
create table tags (
id integer primary key autoincrement,
tagName text not null
);
================================================
FILE: db/.gitkeep
================================================
================================================
FILE: docker-compose.yml
================================================
version: '3'
services:
cs-flash-cards:
build: .
ports:
- 8000:8000
volumes:
- ./cards-empty.db:/src/db/cards.db
# - ./cards-jwasham-extreme.db:/src/db/cards.db
# - ./cards-jwasham.db:/src/db/cards.db
================================================
FILE: entrypoint.sh
================================================
#!/bin/bash
if [ ! -f /src/db/cards.db ]; then
cp cards-empty.db /src/db/cards.db
fi
export CARDS_SETTINGS=/src/config.txt
gunicorn --bind 0.0.0.0:8000 flash_cards:app
================================================
FILE: flash_cards.ini
================================================
[uwsgi]
module = wsgi:app
master = true
processes = 5
socket = flash_cards.sock
chmod-socket = 660
vacuum = true
die-on-term = true
================================================
FILE: flash_cards.py
================================================
import os
import sqlite3
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash
app = Flask(__name__)
app.config.from_object(__name__)
nameDB='cards.db'
pathDB='db'
def load_config():
app.config.update(dict(
DATABASE=os.path.join(app.root_path, pathDB, nameDB),
SECRET_KEY='development key',
USERNAME='admin',
PASSWORD='default'
))
app.config.from_envvar('CARDS_SETTINGS', silent=True)
if __name__ == "__main__" or __name__ == "flash_cards":
load_config()
def connect_db():
rv = sqlite3.connect(app.config['DATABASE'])
rv.row_factory = sqlite3.Row
return rv
def init_db():
db = get_db()
with app.open_resource('data/schema.sql', mode='r') as f:
db.cursor().executescript(f.read())
db.commit()
def get_db():
"""Opens a new database connection if there is none yet for the
current application context.
"""
if not hasattr(g, 'sqlite_db'):
g.sqlite_db = connect_db()
return g.sqlite_db
@app.teardown_appcontext
def close_db(error):
"""Closes the database again at the end of the request."""
if hasattr(g, 'sqlite_db'):
g.sqlite_db.close()
@app.route('/')
def index():
if session.get('logged_in'):
return redirect(url_for('list_db'))
else:
return redirect(url_for('login'))
@app.route('/cards')
def cards():
if not session.get('logged_in'):
return redirect(url_for('login'))
db = get_db()
query = '''
SELECT id, type, front, back, known
FROM cards
ORDER BY id DESC
'''
cur = db.execute(query)
cards = cur.fetchall()
tags = getAllTag()
return render_template('cards.html', cards=cards, tags=tags, filter_name="all")
@app.route('/filter_cards/<filter_name>')
def filter_cards(filter_name):
if not session.get('logged_in'):
return redirect(url_for('login'))
filters = {
"all": "where 1 = 1",
"general": "where type = 1",
"code": "where type = 2",
"known": "where known = 1",
"unknown": "where known = 0",
}
query = filters.get(filter_name)
if(query is None):
query = "where type = {0}".format(filter_name)
filter_name = int(filter_name)
if not query:
return redirect(url_for('show'))
db = get_db()
fullquery = "SELECT id, type, front, back, known FROM cards " + \
query + " ORDER BY id DESC"
cur = db.execute(fullquery)
cards = cur.fetchall()
tags = getAllTag()
return render_template('show.html', cards=cards, tags=tags, filter_name=filter_name)
@app.route('/add', methods=['POST'])
def add_card():
if not session.get('logged_in'):
return redirect(url_for('login'))
db = get_db()
db.execute('INSERT INTO cards (type, front, back) VALUES (?, ?, ?)',
[request.form['type'],
request.form['front'],
request.form['back']
])
db.commit()
flash('New card was successfully added.')
return redirect(url_for('cards'))
@app.route('/edit/<card_id>')
def edit(card_id):
if not session.get('logged_in'):
return redirect(url_for('login'))
db = get_db()
query = '''
SELECT id, type, front, back, known
FROM cards
WHERE id = ?
'''
cur = db.execute(query, [card_id])
card = cur.fetchone()
tags = getAllTag()
return render_template('edit.html', card=card, tags=tags)
@app.route('/edit_card', methods=['POST'])
def edit_card():
if not session.get('logged_in'):
return redirect(url_for('login'))
selected = request.form.getlist('known')
known = bool(selected)
db = get_db()
command = '''
UPDATE cards
SET
type = ?,
front = ?,
back = ?,
known = ?
WHERE id = ?
'''
db.execute(command,
[request.form['type'],
request.form['front'],
request.form['back'],
known,
request.form['card_id']
])
db.commit()
flash('Card saved.')
return redirect(url_for('show'))
@app.route('/delete/<card_id>')
def delete(card_id):
if not session.get('logged_in'):
return redirect(url_for('login'))
db = get_db()
db.execute('DELETE FROM cards WHERE id = ?', [card_id])
db.commit()
flash('Card deleted.')
return redirect(url_for('cards'))
@app.route('/memorize')
@app.route('/memorize/<card_type>')
@app.route('/memorize/<card_type>/<card_id>')
def memorize(card_type, card_id=None):
tag = getTag(card_type)
if tag is None:
return redirect(url_for('cards'))
if card_id:
card = get_card_by_id(card_id)
else:
card = get_card(card_type)
if not card:
flash("You've learned all the '" + tag[1] + "' cards.")
return redirect(url_for('show'))
short_answer = (len(card['back']) < 75)
tags = getAllTag()
card_type = int(card_type)
return render_template('memorize.html',
card=card,
card_type=card_type,
short_answer=short_answer, tags=tags)
@app.route('/memorize_known')
@app.route('/memorize_known/<card_type>')
@app.route('/memorize_known/<card_type>/<card_id>')
def memorize_known(card_type, card_id=None):
tag = getTag(card_type)
if tag is None:
return redirect(url_for('cards'))
if card_id:
card = get_card_by_id(card_id)
else:
card = get_card_already_known(card_type)
if not card:
flash("You haven't learned any '" + tag[1] + "' cards yet.")
return redirect(url_for('show'))
short_answer = (len(card['back']) < 75)
tags = getAllTag()
card_type = int(card_type)
return render_template('memorize_known.html',
card=card,
card_type=card_type,
short_answer=short_answer, tags=tags)
def get_card(type):
db = get_db()
query = '''
SELECT
id, type, front, back, known
FROM cards
WHERE
type = ?
and known = 0
ORDER BY RANDOM()
LIMIT 1
'''
cur = db.execute(query, [type])
return cur.fetchone()
def get_card_by_id(card_id):
db = get_db()
query = '''
SELECT
id, type, front, back, known
FROM cards
WHERE
id = ?
LIMIT 1
'''
cur = db.execute(query, [card_id])
return cur.fetchone()
@app.route('/mark_known/<card_id>/<card_type>')
def mark_known(card_id, card_type):
if not session.get('logged_in'):
return redirect(url_for('login'))
db = get_db()
db.execute('UPDATE cards SET known = 1 WHERE id = ?', [card_id])
db.commit()
flash('Card marked as known.')
return redirect(url_for('memorize', card_type=card_type))
@app.route('/login', methods=['GET', 'POST'])
def login():
error = None
if request.method == 'POST':
if request.form['username'] != app.config['USERNAME']:
error = 'Invalid username or password!'
elif request.form['password'] != app.config['PASSWORD']:
error = 'Invalid username or password!'
else:
session['logged_in'] = True
session.permanent = True # stay logged in
return redirect(url_for('index'))
return render_template('login.html', error=error)
@app.route('/logout')
def logout():
session.pop('logged_in', None)
flash("You've logged out")
return redirect(url_for('index'))
def getAllTag():
if not session.get('logged_in'):
return redirect(url_for('login'))
db = get_db()
query = '''
SELECT id, tagName
FROM tags
ORDER BY id ASC
'''
cur = db.execute(query)
tags = cur.fetchall()
return tags
@app.route('/tags')
def tags():
if not session.get('logged_in'):
return redirect(url_for('login'))
tags = getAllTag()
return render_template('tags.html', tags=tags, filter_name="all")
@app.route('/addTag', methods=['POST'])
def add_tag():
if not session.get('logged_in'):
return redirect(url_for('login'))
db = get_db()
db.execute('INSERT INTO tags (tagName) VALUES (?)',
[request.form['tagName']])
db.commit()
flash('New tag was successfully added.')
return redirect(url_for('tags'))
@app.route('/editTag/<tag_id>')
def edit_tag(tag_id):
if not session.get('logged_in'):
return redirect(url_for('login'))
tag = getTag(tag_id)
return render_template('editTag.html', tag=tag)
@app.route('/updateTag', methods=['POST'])
def update_tag():
if not session.get('logged_in'):
return redirect(url_for('login'))
db = get_db()
command = '''
UPDATE tags
SET
tagName = ?
WHERE id = ?
'''
db.execute(command,
[request.form['tagName'],
request.form['tag_id']
])
db.commit()
flash('Tag saved.')
return redirect(url_for('tags'))
def init_tag():
if not session.get('logged_in'):
return redirect(url_for('login'))
db = get_db()
db.execute('INSERT INTO tags (tagName) VALUES (?)',
["general"])
db.commit()
db.execute('INSERT INTO tags (tagName) VALUES (?)',
["code"])
db.commit()
db.execute('INSERT INTO tags (tagName) VALUES (?)',
["bookmark"])
db.commit()
@app.route('/show')
def show():
if not session.get('logged_in'):
return redirect(url_for('login'))
tags = getAllTag()
return render_template('show.html', tags=tags, filter_name="")
def getTag(tag_id):
if not session.get('logged_in'):
return redirect(url_for('login'))
db = get_db()
query = '''
SELECT id, tagName
FROM tags
WHERE id = ?
'''
cur = db.execute(query, [tag_id])
tag = cur.fetchone()
return tag
@app.route('/bookmark/<card_type>/<card_id>')
def bookmark(card_type, card_id):
if not session.get('logged_in'):
return redirect(url_for('login'))
db = get_db()
db.execute('UPDATE cards SET type = ? WHERE id = ?',[card_type,card_id])
db.commit()
flash('Card saved.')
return redirect(url_for('memorize', card_type=card_type))
@app.route('/list_db')
def list_db():
if not session.get('logged_in'):
return redirect(url_for('login'))
dbs = [f for f in os.listdir(pathDB) if os.path.isfile(os.path.join(pathDB, f))]
dbs = list(filter(lambda k: '.db' in k, dbs))
return render_template('listDb.html', dbs=dbs)
@app.route('/load_db/<name>')
def load_db(name):
if not session.get('logged_in'):
return redirect(url_for('login'))
global nameDB
nameDB=name
load_config()
handle_old_schema()
return redirect(url_for('memorize', card_type="1"))
@app.route('/create_db')
def create_db():
if not session.get('logged_in'):
return redirect(url_for('login'))
return render_template('createDb.html')
@app.route('/init', methods=['POST'])
def init():
if not session.get('logged_in'):
return redirect(url_for('login'))
global nameDB
nameDB = request.form['dbName'] + '.db'
load_config()
init_db()
init_tag()
return redirect(url_for('index'))
def check_table_tag_exists():
db = get_db()
cur = db.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='tags'")
result = cur.fetchone()
return result
def create_tag_table():
db = get_db()
with app.open_resource('data/handle_old_schema.sql', mode='r') as f:
db.cursor().executescript(f.read())
db.commit()
def handle_old_schema():
result = check_table_tag_exists()
if(result is None):
create_tag_table()
init_tag()
def get_card_already_known(type):
db = get_db()
query = '''
SELECT
id, type, front, back, known
FROM cards
WHERE
type = ?
and known = 1
ORDER BY RANDOM()
LIMIT 1
'''
cur = db.execute(query, [type])
return cur.fetchone()
@app.route('/mark_unknown/<card_id>/<card_type>')
def mark_unknown(card_id, card_type):
if not session.get('logged_in'):
return redirect(url_for('login'))
db = get_db()
db.execute('UPDATE cards SET known = 0 WHERE id = ?', [card_id])
db.commit()
flash('Card marked as unknown.')
return redirect(url_for('memorize_known', card_type=card_type))
if __name__ == '__main__':
app.run(host='0.0.0.0')
================================================
FILE: flash_cards.service
================================================
[Unit]
Description=uWSGI instance to serve flash_cards
After=network.target
[Service]
User=john
Group=www-data
WorkingDirectory=/var/www/cs_flash_cards
Environment="PATH=/var/www/cs_flash_cards/py3env/bin"
Environment="CARDS_SETTINGS=/var/www/cs_flash_cards/config-personal.txt"
ExecStart=/var/www/cs_flash_cards/py3env/bin/uwsgi --ini flash_cards.ini
[Install]
WantedBy=multi-user.target
================================================
FILE: license.md
================================================
Attribution-ShareAlike 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More_considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution-ShareAlike 4.0 International Public
License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-ShareAlike 4.0 International Public License ("Public
License"). To the extent this Public License may be interpreted as a
contract, You are granted the Licensed Rights in consideration of Your
acceptance of these terms and conditions, and the Licensor grants You
such rights in consideration of benefits the Licensor receives from
making the Licensed Material available under these terms and
conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. BY-SA Compatible License means a license listed at
creativecommons.org/compatiblelicenses, approved by Creative
Commons as essentially the equivalent of this Public License.
d. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
e. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
f. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
g. License Elements means the license attributes listed in the name
of a Creative Commons Public License. The License Elements of this
Public License are Attribution and ShareAlike.
h. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
i. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
j. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
k. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
l. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
m. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. Additional offer from the Licensor -- Adapted Material.
Every recipient of Adapted Material from You
automatically receives an offer from the Licensor to
exercise the Licensed Rights in the Adapted Material
under the conditions of the Adapter's License You apply.
c. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
b. ShareAlike.
In addition to the conditions in Section 3(a), if You Share
Adapted Material You produce, the following conditions also apply.
1. The Adapter's License You apply must be a Creative Commons
license with the same License Elements, this version or
later, or a BY-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the
Adapter's License You apply. You may satisfy this condition
in any reasonable manner based on the medium, means, and
context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms
or conditions on, or apply any Effective Technological
Measures to, Adapted Material that restrict exercise of the
rights granted under the Adapter's License You apply.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material,
including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public
licenses. Notwithstanding, Creative Commons may elect to apply one of
its public licenses to material it publishes and in those instances
will be considered the “Licensor.” The text of the Creative Commons
public licenses is dedicated to the public domain under the CC0 Public
Domain Dedication. Except for the limited purpose of indicating that
material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the
public licenses.
Creative Commons may be contacted at creativecommons.org.
================================================
FILE: requirements.txt
================================================
boto==2.40.0
click==6.7
configparser==3.5.0
cryptography==43.0.1
enum34==1.1.6
Flask==2.3.2
future==0.18.3
httplib2==0.19.0
ipaddress==1.0.16
itsdangerous==0.24
Jinja2==3.1.4
jsonschema==2.5.1
lockfile==0.12.2
MarkupSafe==0.23
ndg-httpsclient==0.4.2
psutil==5.6.6
pyasn1==0.1.9
pycurl==7.43.0
pyOpenSSL==17.5.0
pytz==2016.10
pyxdg==0.26
requests==2.32.0
scour==0.32
six==1.10.0
virtualenv==15.1.0
Werkzeug==3.0.3
================================================
FILE: static/general.js
================================================
$(document).ready(function(){
if ($('.memorizePanel').length != 0) {
$('.flipCard').click(function(){
if ($('.cardFront').is(":visible") == true) {
$('.cardFront').hide();
$('.cardBack').show();
} else {
$('.cardFront').show();
$('.cardBack').hide();
}
});
}
if ($('.cardForm').length != 0) {
$('.cardForm').submit(function(){
var frontTrim = $.trim($('#front').val());
$('#front').val(frontTrim);
var backTrim = $.trim($('#back').val());
$('#back').val(backTrim);
if (! $('#front').val() || ! $('#back').val()) {
return false;
}
});
}
if ($('.editPanel').length != 0) {
function checkit() {
var checkedVal = $('input[name=type]:checked').val();
var checkedId = $('input[name=type]:checked').attr("id");
if (checkedVal === undefined) {
// hide the fields
$('.fieldFront').hide();
$('.fieldBack').hide();
$('.saveButton').hide();
} else {
$('.toggleButton').removeClass('toggleSelected');
if(checkedId === undefined) {
$(this).addClass('toggleSelected');
} else {
$('label[for='+ checkedId +']').addClass('toggleSelected');
}
$('.fieldFront').show();
$('.fieldBack').show();
$('.saveButton').show();
}
}
$('.toggleButton').click(checkit);
checkit();
}
// to remove the short delay on click on touch devices
FastClick.attach(document.body);
});
================================================
FILE: static/highlight-theme-github.css
================================================
/*
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
color: #333;
background: #f8f8f8;
}
.hljs-comment,
.hljs-quote {
color: #998;
font-style: italic;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-subst {
color: #333;
font-weight: bold;
}
.hljs-number,
.hljs-literal,
.hljs-variable,
.hljs-template-variable,
.hljs-tag .hljs-attr {
color: #008080;
}
.hljs-string,
.hljs-doctag {
color: #d14;
}
.hljs-title,
.hljs-section,
.hljs-selector-id {
color: #900;
font-weight: bold;
}
.hljs-subst {
font-weight: normal;
}
.hljs-type,
.hljs-class .hljs-title {
color: #458;
font-weight: bold;
}
.hljs-tag,
.hljs-name,
.hljs-attribute {
color: #000080;
font-weight: normal;
}
.hljs-regexp,
.hljs-link {
color: #009926;
}
.hljs-symbol,
.hljs-bullet {
color: #990073;
}
.hljs-built_in,
.hljs-builtin-name {
color: #0086b3;
}
.hljs-meta {
color: #999;
font-weight: bold;
}
.hljs-deletion {
background: #fdd;
}
.hljs-addition {
background: #dfd;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
================================================
FILE: static/highlight.pack.js
================================================
/*! highlight.js v9.9.0 | BSD3 License | git.io/hljslicense */
!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/[&<>]/gm,function(e){return I[e]})}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0===t.index}function i(e){return k.test(e)}function a(e){var n,t,r,a,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",t=B.exec(o))return R(t[1])?t[1]:"no-highlight";for(o=o.split(/\s+/),n=0,r=o.length;r>n;n++)if(a=o[n],i(a)||R(a))return a}function o(e,n){var t,r={};for(t in e)r[t]=e[t];if(n)for(t in n)r[t]=n[t];return r}function u(e){var n=[];return function r(e,i){for(var a=e.firstChild;a;a=a.nextSibling)3===a.nodeType?i+=a.nodeValue.length:1===a.nodeType&&(n.push({event:"start",offset:i,node:a}),i=r(a,i),t(a).match(/br|hr|img|input/)||n.push({event:"stop",offset:i,node:a}));return i}(e,0),n}function c(e,r,i){function a(){return e.length&&r.length?e[0].offset!==r[0].offset?e[0].offset<r[0].offset?e:r:"start"===r[0].event?e:r:e.length?e:r}function o(e){function r(e){return" "+e.nodeName+'="'+n(e.value)+'"'}l+="<"+t(e)+w.map.call(e.attributes,r).join("")+">"}function u(e){l+="</"+t(e)+">"}function c(e){("start"===e.event?o:u)(e.node)}for(var s=0,l="",f=[];e.length||r.length;){var g=a();if(l+=n(i.substring(s,g[0].offset)),s=g[0].offset,g===e){f.reverse().forEach(u);do c(g.splice(0,1)[0]),g=a();while(g===e&&g.length&&g[0].offset===s);f.reverse().forEach(o)}else"start"===g[0].event?f.push(g[0].node):f.pop(),c(g.splice(0,1)[0])}return l+n(i.substr(s))}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(i,a){if(!i.compiled){if(i.compiled=!0,i.k=i.k||i.bK,i.k){var u={},c=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");u[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof i.k?c("keyword",i.k):E(i.k).forEach(function(e){c(e,i.k[e])}),i.k=u}i.lR=t(i.l||/\w+/,!0),a&&(i.bK&&(i.b="\\b("+i.bK.split(" ").join("|")+")\\b"),i.b||(i.b=/\B|\b/),i.bR=t(i.b),i.e||i.eW||(i.e=/\B|\b/),i.e&&(i.eR=t(i.e)),i.tE=n(i.e)||"",i.eW&&a.tE&&(i.tE+=(i.e?"|":"")+a.tE)),i.i&&(i.iR=t(i.i)),null==i.r&&(i.r=1),i.c||(i.c=[]);var s=[];i.c.forEach(function(e){e.v?e.v.forEach(function(n){s.push(o(e,n))}):s.push("self"===e?i:e)}),i.c=s,i.c.forEach(function(e){r(e,i)}),i.starts&&r(i.starts,a);var l=i.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([i.tE,i.i]).map(n).filter(Boolean);i.t=l.length?t(l.join("|"),!0):{exec:function(){return null}}}}r(e)}function l(e,t,i,a){function o(e,n){var t,i;for(t=0,i=n.c.length;i>t;t++)if(r(n.c[t].bR,e))return n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function c(e,n){return!i&&r(n.iR,e)}function g(e,n){var t=N.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function h(e,n,t,r){var i=r?"":y.classPrefix,a='<span class="'+i,o=t?"":C;return a+=e+'">',a+n+o}function p(){var e,t,r,i;if(!E.k)return n(B);for(i="",t=0,E.lR.lastIndex=0,r=E.lR.exec(B);r;)i+=n(B.substring(t,r.index)),e=g(E,r),e?(M+=e[1],i+=h(e[0],n(r[0]))):i+=n(r[0]),t=E.lR.lastIndex,r=E.lR.exec(B);return i+n(B.substr(t))}function d(){var e="string"==typeof E.sL;if(e&&!x[E.sL])return n(B);var t=e?l(E.sL,B,!0,L[E.sL]):f(B,E.sL.length?E.sL:void 0);return E.r>0&&(M+=t.r),e&&(L[E.sL]=t.top),h(t.language,t.value,!1,!0)}function b(){k+=null!=E.sL?d():p(),B=""}function v(e){k+=e.cN?h(e.cN,"",!0):"",E=Object.create(e,{parent:{value:E}})}function m(e,n){if(B+=e,null==n)return b(),0;var t=o(n,E);if(t)return t.skip?B+=n:(t.eB&&(B+=n),b(),t.rB||t.eB||(B=n)),v(t,n),t.rB?0:n.length;var r=u(E,n);if(r){var i=E;i.skip?B+=n:(i.rE||i.eE||(B+=n),b(),i.eE&&(B=n));do E.cN&&(k+=C),E.skip||(M+=E.r),E=E.parent;while(E!==r.parent);return r.starts&&v(r.starts,""),i.rE?0:n.length}if(c(n,E))throw new Error('Illegal lexeme "'+n+'" for mode "'+(E.cN||"<unnamed>")+'"');return B+=n,n.length||1}var N=R(e);if(!N)throw new Error('Unknown language: "'+e+'"');s(N);var w,E=a||N,L={},k="";for(w=E;w!==N;w=w.parent)w.cN&&(k=h(w.cN,"",!0)+k);var B="",M=0;try{for(var I,j,O=0;;){if(E.t.lastIndex=O,I=E.t.exec(t),!I)break;j=m(t.substring(O,I.index),I[0]),O=I.index+j}for(m(t.substr(O)),w=E;w.parent;w=w.parent)w.cN&&(k+=C);return{r:M,value:k,language:e,top:E}}catch(T){if(T.message&&-1!==T.message.indexOf("Illegal"))return{r:0,value:n(t)};throw T}}function f(e,t){t=t||y.languages||E(x);var r={r:0,value:n(e)},i=r;return t.filter(R).forEach(function(n){var t=l(n,e,!1);t.language=n,t.r>i.r&&(i=t),t.r>r.r&&(i=r,r=t)}),i.language&&(r.second_best=i),r}function g(e){return y.tabReplace||y.useBR?e.replace(M,function(e,n){return y.useBR&&"\n"===e?"<br>":y.tabReplace?n.replace(/\t/g,y.tabReplace):void 0}):e}function h(e,n,t){var r=n?L[n]:t,i=[e.trim()];return e.match(/\bhljs\b/)||i.push("hljs"),-1===e.indexOf(r)&&i.push(r),i.join(" ").trim()}function p(e){var n,t,r,o,s,p=a(e);i(p)||(y.useBR?(n=document.createElementNS("http://www.w3.org/1999/xhtml","div"),n.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/<br[ \/]*>/g,"\n")):n=e,s=n.textContent,r=p?l(p,s,!0):f(s),t=u(n),t.length&&(o=document.createElementNS("http://www.w3.org/1999/xhtml","div"),o.innerHTML=r.value,r.value=c(t,u(o),s)),r.value=g(r.value),e.innerHTML=r.value,e.className=h(e.className,p,r.language),e.result={language:r.language,re:r.r},r.second_best&&(e.second_best={language:r.second_best.language,re:r.second_best.r}))}function d(e){y=o(y,e)}function b(){if(!b.called){b.called=!0;var e=document.querySelectorAll("pre code");w.forEach.call(e,p)}}function v(){addEventListener("DOMContentLoaded",b,!1),addEventListener("load",b,!1)}function m(n,t){var r=x[n]=t(e);r.aliases&&r.aliases.forEach(function(e){L[e]=n})}function N(){return E(x)}function R(e){return e=(e||"").toLowerCase(),x[e]||x[L[e]]}var w=[],E=Object.keys,x={},L={},k=/^(no-?highlight|plain|text)$/i,B=/\blang(?:uage)?-([\w-]+)\b/i,M=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,C="</span>",y={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},I={"&":"&","<":"<",">":">"};return e.highlight=l,e.highlightAuto=f,e.fixMarkup=g,e.highlightBlock=p,e.configure=d,e.initHighlighting=b,e.initHighlightingOnLoad=v,e.registerLanguage=m,e.listLanguages=N,e.getLanguage=R,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(n,t,r){var i=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return i.c.push(e.PWM),i.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),i},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("java",function(e){var a="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",t=a+"(<"+a+"(\\s*,\\s*"+a+")*>)?",r="false synchronized int abstract float private char boolean static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private module requires exports do",s="\\b(0[bB]([01]+[01_]+[01]+|[01]+)|0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)|(([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?|\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))([eE][-+]?\\d+)?)[lLfF]?",c={cN:"number",b:s,r:0};return{aliases:["jsp"],k:r,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return else",r:0},{cN:"function",b:"("+t+"\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:r,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:r,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},c,{cN:"meta",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("cpp",function(t){var e={cN:"keyword",b:"\\b[a-z\\d_]*_t\\b"},r={cN:"string",v:[{b:'(u8?|U)?L?"',e:'"',i:"\\n",c:[t.BE]},{b:'(u8?|U)?R"',e:'"',c:[t.BE]},{b:"'\\\\?.",e:"'",i:"."}]},s={cN:"number",v:[{b:"\\b(0b[01']+)"},{b:"\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{b:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],r:0},i={cN:"meta",b:/#\s*[a-z]+\b/,e:/$/,k:{"meta-keyword":"if else elif endif define undef warning error line pragma ifdef ifndef include"},c:[{b:/\\\n/,r:0},t.inherit(r,{cN:"meta-string"}),{cN:"meta-string",b:"<",e:">",i:"\\n"},t.CLCM,t.CBCM]},a=t.IR+"\\s*\\(",c={keyword:"int float while private char catch import module export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue inline delete alignof constexpr decltype noexcept static_assert thread_local restrict _Bool complex _Complex _Imaginary atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong new throw return",built_in:"std string cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr",literal:"true false nullptr NULL"},n=[e,t.CLCM,t.CBCM,s,r];return{aliases:["c","cc","h","c++","h++","hpp"],k:c,i:"</",c:n.concat([i,{b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:c,c:["self",e]},{b:t.IR+"::",k:c},{v:[{b:/=/,e:/;/},{b:/\(/,e:/\)/},{bK:"new throw return else",e:/;/}],k:c,c:n.concat([{b:/\(/,e:/\)/,k:c,c:n.concat(["self"]),r:0}]),r:0},{cN:"function",b:"("+t.IR+"[\\*&\\s]+)+"+a,rB:!0,e:/[{;=]/,eE:!0,k:c,i:/[^\w\s\*&]/,c:[{b:a,rB:!0,c:[t.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:c,r:0,c:[t.CLCM,t.CBCM,r,s,e]},t.CLCM,t.CBCM,i]}]),exports:{preprocessor:i,strings:r,k:c}}});hljs.registerLanguage("python",function(e){var r={cN:"meta",b:/^(>>>|\.\.\.) /},b={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[r],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[r],r:10},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},e.ASM,e.QSM]},a={cN:"number",r:0,v:[{b:e.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:e.CNR+"[lLjJ]?"}]},l={cN:"params",b:/\(/,e:/\)/,c:["self",r,a,b]};return{aliases:["py","gyp"],k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda async await nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)|=>/,c:[r,a,b,e.HCM,{v:[{cN:"function",bK:"def"},{cN:"class",bK:"class"}],e:/:/,i:/[${=;\n,]/,c:[e.UTM,l,{b:/->/,eW:!0,k:"None"}]},{cN:"meta",b:/^[\t ]*@/,e:/$/},{b:/\b(print|exec)\(/}]}});hljs.registerLanguage("cs",function(e){var i={keyword:"abstract as base bool break byte case catch char checked const continue decimal default delegate do double else enum event explicit extern finally fixed float for foreach goto if implicit in int interface internal is lock long object operator out override params private protected public readonly ref sbyte sealed short sizeof stackalloc static string struct switch this try typeof uint ulong unchecked unsafe ushort using virtual void volatile while nameof add alias ascending async await by descending dynamic equals from get global group into join let on orderby partial remove select set value var where yield",literal:"null false true"},r={cN:"string",b:'@"',e:'"',c:[{b:'""'}]},t=e.inherit(r,{i:/\n/}),a={cN:"subst",b:"{",e:"}",k:i},n=e.inherit(a,{i:/\n/}),c={cN:"string",b:/\$"/,e:'"',i:/\n/,c:[{b:"{{"},{b:"}}"},e.BE,n]},s={cN:"string",b:/\$@"/,e:'"',c:[{b:"{{"},{b:"}}"},{b:'""'},a]},o=e.inherit(s,{i:/\n/,c:[{b:"{{"},{b:"}}"},{b:'""'},n]});a.c=[s,c,r,e.ASM,e.QSM,e.CNM,e.CBCM],n.c=[o,c,t,e.ASM,e.QSM,e.CNM,e.inherit(e.CBCM,{i:/\n/})];var l={v:[s,c,r,e.ASM,e.QSM]},b=e.IR+"(<"+e.IR+"(\\s*,\\s*"+e.IR+")*>)?(\\[\\])?";return{aliases:["csharp"],k:i,i:/::/,c:[e.C("///","$",{rB:!0,c:[{cN:"doctag",v:[{b:"///",r:0},{b:"<!--|-->"},{b:"</?",e:">"}]}]}),e.CLCM,e.CBCM,{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef warning error line region endregion pragma checksum"}},l,e.CNM,{bK:"class interface",e:/[{;=]/,i:/[^\s:]/,c:[e.TM,e.CLCM,e.CBCM]},{bK:"namespace",e:/[{;=]/,i:/[^\s:]/,c:[e.inherit(e.TM,{b:"[a-zA-Z](\\.?\\w)*"}),e.CLCM,e.CBCM]},{bK:"new return throw await",r:0},{cN:"function",b:"("+b+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:i,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:i,r:0,c:[l,e.CNM,e.CBCM]},e.CLCM,e.CBCM]}]}});hljs.registerLanguage("javascript",function(e){var r="[A-Za-z$_][0-9A-Za-z$_]*",t={keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},a={cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},n={cN:"subst",b:"\\$\\{",e:"\\}",k:t,c:[]},c={cN:"string",b:"`",e:"`",c:[e.BE,n]};n.c=[e.ASM,e.QSM,c,a,e.RM];var s=n.c.concat([e.CBCM,e.CLCM]);return{aliases:["js","jsx"],k:t,c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,c,e.CLCM,e.CBCM,a,{b:/[{,]\s*/,r:0,c:[{b:r+"\\s*:",rB:!0,r:0,c:[{cN:"attr",b:r,r:0}]}]},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+r+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:r},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,c:s}]}]},{b:/</,e:/(\/\w+|\w+\/)>/,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:r}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:s}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}});
================================================
FILE: static/style.css
================================================
.toggleSelected {
background-color: #62b06b;
color: #ffffff;
}
textarea {
font-family: monospace;
}
.cardContent .tagContent h4 {
margin-top: 0;
}
.alignContainer {
display: table;
width: 100%;
}
.alignMiddle {
height: 20em;
display: table-cell;
vertical-align: middle;
}
.cardBack {
display: none;
}
.largerText {
font-size: 2em;
}
/* disables collapsing header menu */
.navbar-collapse.collapse {
display: block!important;
}
.navbar-nav>li, .navbar-nav {
float: left !important;
}
.navbar-nav.navbar-right:last-child {
margin-right: 0 !important;
}
.navbar-right {
float: right!important;
}
================================================
FILE: templates/cards.html
================================================
{% extends "layout.html" %}
{% block body %}
<div class="well editPanel">
<h2>Add a Card</h2>
<form action="{{ url_for('add_card') }}" method="post" class="cardForm">
<div class="form-group">
{% for tag in tags %}
<label for={{tag.tagName}} class="toggleButton btn btn-default btn-lg">{{tag.tagName}}
<input type="radio" name="type" value={{tag.id}} id={{tag.tagName}}>
</label>
{% endfor %}
</div>
<div class="form-group fieldFront">
<label for="front">Front of Card</label>
<input type="text" name="front" id="front" class="form-control">
</div>
<div class="form-group fieldBack">
<label for="back">Back of Card</label>
<textarea name="back"
class="form-control"
id="back"
placeholder="back of card"
rows="12"></textarea>
</div>
<div class="form-group">
<button type="submit" class="saveButton btn btn-lg btn-primary">Save</button>
</div>
</form>
</div>
<div class="page-header">
<h2>{{ cards|length }} Card{{ '' if (cards|length == 1) else 's' }}</h2>
</div>
{% endblock %}
================================================
FILE: templates/createDb.html
================================================
{% extends "layout.html" %}
{% block body %}
<div class="well editPanelTag">
<h2>Init database</h2>
<form action="{{ url_for('init') }}" method="post" class="dbForm">
<div class="form-group fieldDbName">
<label for="dbName">Database name</label>
<input type="text" name="dbName" id="dbName" class="form-control">
</div>
<div class="form-group">
<button type="submit" class="saveButton btn btn-lg btn-primary">Create</button>
</div>
</form>
</div>
{% endblock %}
================================================
FILE: templates/edit.html
================================================
{% extends "layout.html" %}
{% block body %}
<div class="well editPanel">
<h2>Edit Card #{{ card.id }}</h2>
<form action="{{ url_for('edit_card') }}" method="post" class="cardForm">
<div class="form-group">
{% for tag in tags %}
<label for={{tag.tagName}} class="toggleButton btn btn-default btn-lg">{{tag.tagName}}
<input type="radio" name="type" value={{tag.id}}
id={{tag.tagName}} {{ "checked" if (card.type == tag.id) else "" }} />
</label>
{% endfor %}
<!-- <label for="general" class="btn btn-default btn-lg">General
<input type="radio" name="type" value="1"
id="general" {{ "checked" if (card.type == 1) else "" }} />
</label>
<label for="code" class="btn btn-default btn-lg">Code
<input type="radio" name="type" value="2" id="code" {{ "checked" if (card.type == 2) else "" }} />
</label> -->
</div>
<div class="form-group">
<label for="front">Front of Card</label>
<input type="text" name="front" id="front" class="form-control" value="{{ card.front|e }}">
</div>
<div class="form-group">
<label for="back">Back of Card</label>
<textarea name="back"
class="form-control"
id="back"
placeholder="back of card"
rows="12">{{ card.back|e }}</textarea>
</div>
<div class="row">
<div class="col-xs-6">
<div class="checkbox">
<label>
<input type="checkbox" name="known"
value="1" {{ "checked" if (card.known == 1) else "" }} /> Known
</label>
</div>
</div>
<div class="col-xs-6 text-right">
<a href="{{ url_for('delete', card_id=card.id) }}" class="btn btn-danger btn-xs">
<i class="fa fa-trash"></i>
Remove
</a>
</div>
</div>
<hr />
<div class="form-group">
<input type="hidden" name="card_id" value="{{ card.id|e }}" />
<button type="submit" class="saveButton btn btn-lg btn-primary">Save</button>
</div>
</form>
</div>
{% endblock %}
================================================
FILE: templates/editTag.html
================================================
{% extends "layout.html" %}
{% block body %}
<div class="well">
<h2>Edit Tag #{{ tag.id }}</h2>
<form action="{{ url_for('update_tag') }}" method="post" class="tagForm">
<div class="form-group">
<label for="tagName">Tag name</label>
<input type="text" name="tagName" id="tagName" class="form-control" value="{{ tag.tagName|e }}">
</div>
<hr />
<div class="form-group">
<input type="hidden" name="tag_id" value="{{ tag.id|e }}" />
<button type="submit" class="saveButton btn btn-lg btn-primary">Save</button>
</div>
</form>
</div>
{% endblock %}
================================================
FILE: templates/layout.html
================================================
<!doctype html>
<html>
<head>
<title>CS Flash Cards</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel=stylesheet type=text/css href="{{ url_for('static', filename='style.css') }}"/>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='highlight-theme-github.css') }}" />
<script src="{{ url_for('static', filename='highlight.pack.js') }}"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-xs-12">
<br/>
<nav class="navbar navbar-default">
<div class="navbar-header">
<a class="navbar-brand" href="{{ url_for('index') }}">CS Flash Cards</a>
<ul class="nav navbar-nav navbar-right">
{% if not session.logged_in %}
<li><a href="{{ url_for('login') }}">log in</a></li>
{% else %}
<li><a href="{{ url_for('cards') }}">cards</a></li>
<li><a href="{{ url_for('tags') }}">tags</a></li>
<li><a href="{{ url_for('show') }}">show</a></li>
<li><a href="{{ url_for('list_db') }}">list database</a></li>
<li><a href="{{ url_for('create_db') }}">create database</a></li>
<li><a href="{{ url_for('memorize', card_type='1') }}">memorize</a></li>
<li><a href="{{ url_for('memorize_known', card_type='1') }}">memorize known items</a></li>
<li> </li>
<li><a href="{{ url_for('logout') }}">log out</a></li>
{% endif %}
</ul>
</div>
</nav>
{% for message in get_flashed_messages() %}
<div class="alert alert-success" role="alert">{{ message }}</div>
{% endfor %}
{% block body %}{% endblock %}
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://use.fontawesome.com/8cea844162.js"></script>
<script src="{{ url_for('static', filename='fastclick.min.js') }}"></script>
<script src="{{ url_for('static', filename='general.js') }}"></script>
</body>
</html>
================================================
FILE: templates/listDb.html
================================================
{% extends "layout.html" %}
{% block body %}
<table class="table table-bordered">
{% for db in dbs %}
<tr>
<td>
<a href="{{ url_for('load_db', name=db) }}" class="btn btn-lg btn-primary">Load</a>
</td>
<td class="dbContent">
<h4>
{{ db }}
</h4>
</td>
</tr>
{% else %}
<tr>
<td>
<em>No dbs to show.</em>
</td>
</tr>
{% endfor %}
</table>
{% endblock %}
================================================
FILE: templates/login.html
================================================
{% extends "layout.html" %}
{% block body %}
<h2>Login</h2>
{% if error %}
<div class="alert alert-danger" role="alert">{{ error }}</div>
{% endif %}
<div class="well">
<form action="{{ url_for('login') }}" method=post>
<div class="form-group">
<label for="username">Username:</label>
<input type="text" name="username" class="form-control">
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" name="password" class="form-control">
</div>
<div class="form-group">
<button type="submit" class="btn btn-lg btn-primary">Log in</button>
</div>
</form>
</div>
{% endblock %}
================================================
FILE: templates/memorize.html
================================================
{% extends "layout.html" %}
{% block body %}
<div class="row">
<div class="col-xs-12 text-center">
<div class="btn-group btn-group-lg" role="group" aria-label="card type">
{% for tag in tags %}
<a href="{{ url_for('memorize', card_type=tag.id) }}" class="btn btn-{{ "primary" if card_type == tag.id else "default" }}">{{tag.tagName}}</a>
{% endfor %}
</div>
</div>
</div>
<hr/>
<div class="row memorizePanel">
<!--
<div class="col-xs-2">
<div class="alignContainer">
<div class="alignMiddle text-right">
<br/>
<br/>
<a href="wewetw"><i class="fa fa-chevron-left fa-5x"></i></a>
</div>
</div>
</div>
-->
<div class="col-xs-8 col-xs-offset-2">
<div class="panel panel-default cardFront">
<div class="panel-body">
<div class="alignContainer">
<div class="alignMiddle frontText">
<h3 class="text-center">{{ card.front }}</h3>
</div>
</div>
</div>
</div>
<div class="panel panel-primary cardBack">
<div class="panel-body">
<div class="alignContainer">
<div class="alignMiddle frontText">
{% if card.type == 1 %}
{% if short_answer %}
<div class="text-center largerText">
{% endif %}
{{ card.back|replace("\n", "<br />")|safe }}
{% if short_answer %}
</div>
{% endif %}
{% else %}
<pre><code>{{ card.back|escape }}</code></pre>
{% endif %}
</div>
</div>
</div>
</div>
</div>
<!--
<div class="col-xs-2">
<div class="alignContainer">
<div class="alignMiddle text-left">
<br/>
<br/>
<a href="ergergerge"><i class="fa fa-chevron-right fa-5x"></i></a>
</div>
</div>
</div>
-->
</div>
<div class="row">
<div class="col-xs-12 text-center">
<a href="javascript:" class="btn btn-primary btn-lg flipCard">
<i class="fa fa-exchange"></i>
Flip Card
</a>
<a href="{{ url_for('mark_known', card_id=card.id, card_type=card_type) }}" class="btn btn-success btn-lg">
<i class="fa fa-check"></i>
I Know It
</a>
<a href="{{ url_for('memorize', card_type=card_type) }}" class="btn btn-primary btn-lg">
Next Card
<i class="fa fa-arrow-right"></i>
</a>
</div>
</div>
<div class="row">
<div class="col-xs-12 text-center">
<br />
<br />
<br />
<a href="{{ url_for('bookmark', card_type=3, card_id=card.id) }}" class="btn btn-default btn-sm">
<i class="fa fa-bookmark"></i>
bookmark this card (#{{ card.id }})
</a>
</div>
</div>
{% endblock %}
================================================
FILE: templates/memorize_known.html
================================================
{% extends "layout.html" %}
{% block body %}
<div class="row">
<div class="col-xs-12 text-center">
<div class="btn-group btn-group-lg" role="group" aria-label="card type">
{% for tag in tags %}
<a href="{{ url_for('memorize_known', card_type=tag.id) }}" class="btn btn-{{ "primary" if card_type == tag.id else "default" }}">{{tag.tagName}}</a>
{% endfor %}
</div>
</div>
</div>
<hr/>
<div class="row memorizePanel">
<div class="col-xs-8 col-xs-offset-2">
<div class="panel panel-default cardFront">
<div class="panel-body">
<div class="alignContainer">
<div class="alignMiddle frontText">
<h3 class="text-center">{{ card.front }}</h3>
</div>
</div>
</div>
</div>
<div class="panel panel-primary cardBack">
<div class="panel-body">
<div class="alignContainer">
<div class="alignMiddle frontText">
{% if card.type == 1 %}
{% if short_answer %}
<div class="text-center largerText">
{% endif %}
{{ card.back|replace("\n", "<br />")|safe }}
{% if short_answer %}
</div>
{% endif %}
{% else %}
<pre><code>{{ card.back|escape }}</code></pre>
{% endif %}
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 text-center">
<a href="javascript:" class="btn btn-primary btn-lg flipCard">
<i class="fa fa-exchange"></i>
Flip Card
</a>
<a href="{{ url_for('mark_unknown', card_id=card.id, card_type=card_type) }}" class="btn btn-success btn-lg">
<i class="fa fa-check"></i>
I Unknow It
</a>
<a href="{{ url_for('memorize_known', card_type=card_type) }}" class="btn btn-primary btn-lg">
Next Card
<i class="fa fa-arrow-right"></i>
</a>
</div>
</div>
<div class="row">
<div class="col-xs-12 text-center">
<br />
<br />
<br />
<a href="{{ url_for('bookmark', card_type=3, card_id=card.id) }}" class="btn btn-default btn-sm">
<i class="fa fa-bookmark"></i>
bookmark this card (#{{ card.id }})
</a>
</div>
</div>
{% endblock %}
================================================
FILE: templates/show.html
================================================
{% extends "layout.html" %}
{% block body %}
<div class="page-header">
<h2>{{ cards|length }} Card{{ '' if (cards|length == 1) else 's' }}</h2>
</div>
<div class="btn-group btn-group-md" role="group" aria-label="filters">
<a href="{{ url_for('filter_cards', filter_name="all") }}" class="btn btn-{{ "primary" if filter_name == "all" else "default" }}">all</a>
{% for tag in tags %}
<a href="{{ url_for('filter_cards', filter_name=tag.id) }}" class="btn btn-{{ "primary" if filter_name == tag.id else "default" }}">{{tag.tagName}}</a>
{% endfor %}
<a href="{{ url_for('filter_cards', filter_name="known") }}" class="btn btn-{{ "primary" if filter_name == "known" else "default" }}">known</a>
<a href="{{ url_for('filter_cards', filter_name="unknown") }}" class="btn btn-{{ "primary" if filter_name == "unknown" else "default" }}">unknown</a>
</div>
<br />
<br />
<table class="table table-bordered">
{% for card in cards %}
<tr>
<td>
<a href="{{ url_for('edit', card_id=card.id) }}" class="btn btn-xs btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i></a>
</td>
<td class="cardContent">
<h4>
{{ card.front }}
</h4>
{% if card.type == 1 %}
{{ card.back|replace("\n", "<br />")|safe }}
{% else %}
<pre><code>{{ card.back|escape }}</code></pre>
{% endif %}
</td>
</tr>
{% else %}
<tr>
<td>
<em>No cards to show.</em>
</td>
</tr>
{% endfor %}
</table>
{% endblock %}
================================================
FILE: templates/tags.html
================================================
{% extends "layout.html" %}
{% block body %}
<div class="well editPanelTag">
<h2>Add a Tag</h2>
<form action="{{ url_for('add_tag') }}" method="post" class="tagForm">
<div class="form-group fieldTagName">
<label for="tagName">Tag name</label>
<input type="text" name="tagName" id="tagName" class="form-control">
</div>
<div class="form-group">
<button type="submit" class="saveButton btn btn-lg btn-primary">Save</button>
</div>
</form>
</div>
<div class="page-header">
<h2>{{ tags|length }} Tag{{ '' if (tags|length == 1) else 's' }}</h2>
</div>
<br />
<br />
<table class="table table-bordered">
{% for tag in tags %}
<tr>
<td>
<a href="{{ url_for('edit_tag', tag_id=tag.id) }}" class="btn btn-xs btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i></a>
</td>
<td class="tagContent">
<h4>
{{ tag.tagName }}
</h4>
</td>
</tr>
{% else %}
<tr>
<td>
<em>No tags to show.</em>
</td>
</tr>
{% endfor %}
</table>
{% endblock %}
================================================
FILE: wsgi.py
================================================
from flash_cards import app
if __name__ == "__main__":
app.run()
gitextract_vd9a3nyi/ ├── .gitignore ├── Dockerfile ├── README.md ├── config.txt ├── data/ │ ├── handle_old_schema.sql │ └── schema.sql ├── db/ │ └── .gitkeep ├── docker-compose.yml ├── entrypoint.sh ├── flash_cards.ini ├── flash_cards.py ├── flash_cards.service ├── license.md ├── requirements.txt ├── static/ │ ├── general.js │ ├── highlight-theme-github.css │ ├── highlight.pack.js │ └── style.css ├── templates/ │ ├── cards.html │ ├── createDb.html │ ├── edit.html │ ├── editTag.html │ ├── layout.html │ ├── listDb.html │ ├── login.html │ ├── memorize.html │ ├── memorize_known.html │ ├── show.html │ └── tags.html └── wsgi.py
SYMBOL INDEX (61 symbols across 5 files)
FILE: data/handle_old_schema.sql
type tags (line 1) | create table if not exists tags (
FILE: data/schema.sql
type cards (line 2) | create table cards (
type tags (line 10) | create table tags (
FILE: flash_cards.py
function load_config (line 11) | def load_config():
function connect_db (line 23) | def connect_db():
function init_db (line 29) | def init_db():
function get_db (line 35) | def get_db():
function close_db (line 45) | def close_db(error):
function index (line 51) | def index():
function cards (line 59) | def cards():
function filter_cards (line 75) | def filter_cards(filter_name):
function add_card (line 105) | def add_card():
function edit (line 120) | def edit(card_id):
function edit_card (line 136) | def edit_card():
function delete (line 164) | def delete(card_id):
function memorize (line 176) | def memorize(card_type, card_id=None):
function memorize_known (line 199) | def memorize_known(card_type, card_id=None):
function get_card (line 220) | def get_card(type):
function get_card_by_id (line 238) | def get_card_by_id(card_id):
function mark_known (line 255) | def mark_known(card_id, card_type):
function login (line 265) | def login():
function logout (line 280) | def logout():
function getAllTag (line 286) | def getAllTag():
function tags (line 301) | def tags():
function add_tag (line 309) | def add_tag():
function edit_tag (line 321) | def edit_tag(tag_id):
function update_tag (line 329) | def update_tag():
function init_tag (line 347) | def init_tag():
function show (line 362) | def show():
function getTag (line 368) | def getTag(tag_id):
function bookmark (line 382) | def bookmark(card_type, card_id):
function list_db (line 392) | def list_db():
function load_db (line 400) | def load_db(name):
function create_db (line 410) | def create_db():
function init (line 416) | def init():
function check_table_tag_exists (line 426) | def check_table_tag_exists():
function create_tag_table (line 432) | def create_tag_table():
function handle_old_schema (line 438) | def handle_old_schema():
function get_card_already_known (line 444) | def get_card_already_known(type):
function mark_unknown (line 462) | def mark_unknown(card_id, card_type):
FILE: static/general.js
function checkit (line 32) | function checkit() {
FILE: static/highlight.pack.js
function n (line 2) | function n(e){return e.replace(/[&<>]/gm,function(e){return I[e]})}
function t (line 2) | function t(e){return e.nodeName.toLowerCase()}
function r (line 2) | function r(e,n){var t=e&&e.exec(n);return t&&0===t.index}
function i (line 2) | function i(e){return k.test(e)}
function a (line 2) | function a(e){var n,t,r,a,o=e.className+" ";if(o+=e.parentNode?e.parentN...
function o (line 2) | function o(e,n){var t,r={};for(t in e)r[t]=e[t];if(n)for(t in n)r[t]=n[t...
function u (line 2) | function u(e){var n=[];return function r(e,i){for(var a=e.firstChild;a;a...
function c (line 2) | function c(e,r,i){function a(){return e.length&&r.length?e[0].offset!==r...
function s (line 2) | function s(e){function n(e){return e&&e.source||e}function t(t,r){return...
function l (line 2) | function l(e,t,i,a){function o(e,n){var t,i;for(t=0,i=n.c.length;i>t;t++...
function f (line 2) | function f(e,t){t=t||y.languages||E(x);var r={r:0,value:n(e)},i=r;return...
function g (line 2) | function g(e){return y.tabReplace||y.useBR?e.replace(M,function(e,n){ret...
function h (line 2) | function h(e,n,t){var r=n?L[n]:t,i=[e.trim()];return e.match(/\bhljs\b/)...
function p (line 2) | function p(e){var n,t,r,o,s,p=a(e);i(p)||(y.useBR?(n=document.createElem...
function d (line 2) | function d(e){y=o(y,e)}
function b (line 2) | function b(){if(!b.called){b.called=!0;var e=document.querySelectorAll("...
function v (line 2) | function v(){addEventListener("DOMContentLoaded",b,!1),addEventListener(...
function m (line 2) | function m(n,t){var r=x[n]=t(e);r.aliases&&r.aliases.forEach(function(e)...
function N (line 2) | function N(){return E(x)}
function R (line 2) | function R(e){return e=(e||"").toLowerCase(),x[e]||x[L[e]]}
Condensed preview — 30 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (87K chars).
[
{
"path": ".gitignore",
"chars": 67,
"preview": ".idea/\npy3env/\n__pycache__/\n*.pyc\nconfig-personal.txt\ncards.db\nenv\n"
},
{
"path": "Dockerfile",
"chars": 294,
"preview": "FROM python:3.9\nLABEL maintainer=\"Tinpee <tinpee.dev@gmail.com>\"\n\nADD . /src\nWORKDIR /src\nRUN pip install --upgrade pip "
},
{
"path": "README.md",
"chars": 7423,
"preview": "# Computer Science Flash Cards\n\nThis is a little website I've put together to allow me to easily make flash cards and qu"
},
{
"path": "config.txt",
"chars": 86,
"preview": "SECRET_KEY='some very long key here'\nUSERNAME='username-test'\nPASSWORD='password-test'"
},
{
"path": "data/handle_old_schema.sql",
"chars": 100,
"preview": "create table if not exists tags (\n id integer primary key autoincrement,\n tagName text not null\n);"
},
{
"path": "data/schema.sql",
"chars": 309,
"preview": "-- drop table if exists cards;\ncreate table cards (\n id integer primary key autoincrement,\n type tinyint not null, /* "
},
{
"path": "db/.gitkeep",
"chars": 0,
"preview": ""
},
{
"path": "docker-compose.yml",
"chars": 238,
"preview": "version: '3'\n\nservices:\n\n cs-flash-cards:\n build: .\n ports:\n - 8000:8000\n volumes:\n - ./cards-empty."
},
{
"path": "entrypoint.sh",
"chars": 171,
"preview": "#!/bin/bash\n\nif [ ! -f /src/db/cards.db ]; then\n\tcp cards-empty.db /src/db/cards.db\nfi\n\nexport CARDS_SETTINGS=/src/confi"
},
{
"path": "flash_cards.ini",
"chars": 137,
"preview": "[uwsgi]\nmodule = wsgi:app\n\nmaster = true\nprocesses = 5\n\nsocket = flash_cards.sock\nchmod-socket = 660\nvacuum = true\n\ndie-"
},
{
"path": "flash_cards.py",
"chars": 12646,
"preview": "import os\nimport sqlite3\nfrom flask import Flask, request, session, g, redirect, url_for, abort, \\\n render_template, "
},
{
"path": "flash_cards.service",
"chars": 390,
"preview": "[Unit]\nDescription=uWSGI instance to serve flash_cards\nAfter=network.target\n\n[Service]\nUser=john\nGroup=www-data\nWorkingD"
},
{
"path": "license.md",
"chars": 20127,
"preview": "Attribution-ShareAlike 4.0 International\n\n=======================================================================\n\nCreat"
},
{
"path": "requirements.txt",
"chars": 413,
"preview": "boto==2.40.0\nclick==6.7\nconfigparser==3.5.0\ncryptography==43.0.1\nenum34==1.1.6\nFlask==2.3.2\nfuture==0.18.3\nhttplib2==0.1"
},
{
"path": "static/general.js",
"chars": 1827,
"preview": "$(document).ready(function(){\n if ($('.memorizePanel').length != 0) {\n\n $('.flipCard').click(function(){\n "
},
{
"path": "static/highlight-theme-github.css",
"chars": 1148,
"preview": "/*\n\ngithub.com style (c) Vasily Polovnyov <vast@whiteants.net>\n\n*/\n\n.hljs {\n display: block;\n overflow-x: auto;\n padd"
},
{
"path": "static/highlight.pack.js",
"chars": 16530,
"preview": "/*! highlight.js v9.9.0 | BSD3 License | git.io/hljslicense */\n!function(e){var n=\"object\"==typeof window&&window||\"obje"
},
{
"path": "static/style.css",
"chars": 656,
"preview": ".toggleSelected {\n background-color: #62b06b;\n color: #ffffff;\n}\n\ntextarea {\n font-family: monospace;\n}\n\n.cardC"
},
{
"path": "templates/cards.html",
"chars": 1399,
"preview": "{% extends \"layout.html\" %}\n{% block body %}\n\n <div class=\"well editPanel\">\n <h2>Add a Card</h2>\n <form"
},
{
"path": "templates/createDb.html",
"chars": 544,
"preview": "{% extends \"layout.html\" %}\n{% block body %}\n\n<div class=\"well editPanelTag\">\n <h2>Init database</h2>\n <form actio"
},
{
"path": "templates/edit.html",
"chars": 2679,
"preview": "{% extends \"layout.html\" %}\n{% block body %}\n <div class=\"well editPanel\">\n <h2>Edit Card #{{ card.id }}</h2>\n"
},
{
"path": "templates/editTag.html",
"chars": 702,
"preview": "{% extends \"layout.html\" %}\n{% block body %}\n <div class=\"well\">\n <h2>Edit Tag #{{ tag.id }}</h2>\n <for"
},
{
"path": "templates/layout.html",
"chars": 2945,
"preview": "<!doctype html>\n<html>\n<head>\n <title>CS Flash Cards</title>\n <meta name=\"viewport\" content=\"width=device-width, i"
},
{
"path": "templates/listDb.html",
"chars": 553,
"preview": "{% extends \"layout.html\" %}\n{% block body %}\n\n<table class=\"table table-bordered\">\n {% for db in dbs %}\n <tr>\n"
},
{
"path": "templates/login.html",
"chars": 808,
"preview": "{% extends \"layout.html\" %}\n{% block body %}\n <h2>Login</h2>\n {% if error %}\n <div class=\"alert alert-dange"
},
{
"path": "templates/memorize.html",
"chars": 3695,
"preview": "{% extends \"layout.html\" %}\n{% block body %}\n\n <div class=\"row\">\n <div class=\"col-xs-12 text-center\">\n "
},
{
"path": "templates/memorize_known.html",
"chars": 3025,
"preview": "{% extends \"layout.html\" %}\n{% block body %}\n\n <div class=\"row\">\n <div class=\"col-xs-12 text-center\">\n "
},
{
"path": "templates/show.html",
"chars": 1696,
"preview": "{% extends \"layout.html\" %}\n{% block body %}\n\n<div class=\"page-header\">\n <h2>{{ cards|length }} Card{{ '' if (cards|l"
},
{
"path": "templates/tags.html",
"chars": 1367,
"preview": "{% extends \"layout.html\" %}\n{% block body %}\n\n <div class=\"well editPanelTag\">\n <h2>Add a Tag</h2>\n <fo"
},
{
"path": "wsgi.py",
"chars": 71,
"preview": "from flash_cards import app\n\nif __name__ == \"__main__\":\n app.run()\n\n"
}
]
About this extraction
This page contains the full source code of the jwasham/computer-science-flash-cards GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 30 files (80.1 KB), approximately 22.4k tokens, and a symbol index with 61 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.