Giter VIP home page Giter VIP logo

computer-science-flash-cards's Introduction

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

How to run it on a server

  1. Clone project to a directory on your web server.
  2. 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.
  3. 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
      • you can see the paths where I installed it, and the name of my virtualenv directory
    • when done with tutorial:
    sudo systemctl restart flash_cards
    sudo systemctl daemon-reload
    
  4. When you see a login page, you're good to go.
  5. Uncomment the commented block in flash_cards.py
  6. Restart Flask. You have to use sudo systemctl restart flash_cards.
  7. Hit the URL /initdb on your web server. You'll see a message that the database has been initialized.
  8. Comment that code again.
  9. Restart Flask.
  10. Go to / on your webserver.
  11. Log in.
  12. Click the "General" or "Code" button and make a card!
  13. When you're ready to start memorizing, click either "General" or "Code" in the top menu.

How to run with Docker

Provided by @Tinpee - [email protected]

Make sure you already installed docker

  1. Clone project to any where you want and go to source folder.
  2. 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.
  3. Build image: docker build . -t cs-flash-cards
  4. Run container: docker run -d -p 8000:8000 --name cs-flash-cards cs-flash-cards
  5. 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. 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 convenient, if you don't have cards.db, this container will auto copy a new one from cards-jwasham.db. So you don't need to initdb.

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 :)

Happy learning!

computer-science-flash-cards's People

Contributors

jwasham avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.