Giter Site home page Giter Site logo

examples's Introduction

Examples of code

This repository contains code examples of projects written using Python and other related technologies: Django, HTML, CSS, SQLite, PostgreSQL, Redis, Celery, Git, etc. Here is just a brief description of each project. For more information, go to the appropriate folder.

Sections: Apps, Bots, Utils, Tests.

Apps

  • /socialblog — Test task for creating a blog platform with social media capabilities. The version is implemented using Python and Django.

  • /smarthome — An example of the interaction between Smart Home systems that supports real-time state configuration. The application is written in Python. The following tools are used: Django, SQLite, Celery, Redis.

  • /somemart — Realization of a simple API for an online store: add a product, add a review to the product, get a product description and all reviews for it. All actions are performed via GET or POST requests using JSON. Unauthorized users can get a product description or add a review to the product. Admin's rights allow to add new products. User authentication is performed via HTTP Basic Auth. Data validation is performed using django.forms, jsonschema and marshmallow. The project is made using Django. For testing used pytest.

  • /herokuapp — Step-by-step guide to creating a simple web application that shows the number of page views in Python and Django using Redis. It also shows how to roll out the application to Heroku hosting using Git.

  • /gameoflife — Console utility for demonstrating the famous "Conway's Game of Life". The implementation is made using the Python language and OOP principles.

  • /asyncsocket — A system for collecting and storing metrics based on a client-server architecture. Examples of such systems are Graphite and InfluxDB. The clients and server communicate with each other over a simple text protocol via TCP-sockets. To implement an asynchronous server, the following popular Python-library is used: asyncio. To implement clients, the other popular library is used: socket.

Bots

Bots are written in Python, can be run locally and prepared for rolling out to Heroku-hosting. Data is stored using PostgreSQL or locally (in-memory and files).

  • /geotelebot — Prototype of a working Telegram Bot. Helps the user to save and view interesting places (name, address, geo-position and photo). When sending a location, it shows which of these places are within a 500-meter radius.

  • /facevoicebot — The bot has two features. One of them is to detect faces in a photos and save only photo with faces (using OpenCV). The second feature is getting voice messages, process the frame rate to 16 kHz (256 kbps) and saving it in this form for later use (using PyDub).

Utils

This section contains single-file utilities that perform simple actions. They can be modified and they will be useful in development.

  • /cipher — Implementation of the Caesar cipher and its two variations Rot13 and Vigenere. The performance of each of the ciphers is checked by using unit testing.

  • /kvstore — Simple key-value storage. Saves data in JSON-format to a file with the following command $ python keyvaluestorage.py --key KEY --val VAL. When writing, the new value is added to the previous one. For reading value, you only need to specify the key as a parameter python keyvaluestorage.py --key KEY.

Tests

This section is dedicated to code testing, approaches to testing, examples, etc.

  • /utestapproaches — Using the implementation of sorting algorithm are considered different unit testing approaches: doctest, contracts, self-writing tests, unittest, pytest.

  • /primefactor — TDD on the example of implementation prime factor algorithm.

  • /evenfibonacci — Function returns even elements of Fibonacci sequence. Covered by contract tests, doctests, unit tests.

Note. If the project contains a projectname-git.zip-archive (the full contents of the project and .git-folder), you can download and unzip it. As a result you will get the files and commit history of this project.

examples's People

Contributors

dependabot[bot] avatar ptaiga 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.