Photo by Roman Synkevych on Unsplash

If you wish to push the code in your local computer system to a particular branch in remote, then this article is for you. Follow the steps below.

  1. Add a .gitgnore file [The files and directories mentioned in this file will not be pushed to the remote]

2. Initialise git. This command will add a .git file to your local directory

3. Add the files to be committed to the remote code

4. Add a commit message

5. Add it to the remote repository

6. Push it to the master

7. If you wish to push it to some other branch instead of master, run the following command.


Flask is a micro-framework written in python. Flask is based on the Werkzeug WSGI toolkit and Jinja2 template engine. It is called a micro framework because it does not require tools or libraries. Flask supports various extensions that can add additional functionalities. Few applications that use flask are

  1. Pinterest
  2. LinkedIn
  3. Community web page of the flask

Disadvantages of flask

Some of the major disadvantages of the flask framework are,

  1. Not suitable for big applications.
  2. Community.
  3. Full-Stack experience.
  4. No admin site.
  5. No login or authentication.
  6. ORM.
  7. Migrations can be difficult.

These disadvantages are based on comparing flask with Django. …


Photo by Hitesh Choudhary on Unsplash

The string module has some of the built-in constant variables. We can use this instead of declaring the constants again in our code. Some of the string constants that will be discussed here are,

  1. ascii_letters
  2. ascii_lowercase
  3. ascii_uppercase
  4. octdigits
  5. punctuation
  6. whitespace

Let us look at these constants one by one with a code snippet printing each of these string constants.

1. ascii_letters

The ascii_letters constant is the concatenation of both lowercase and uppercase alphabets as a string. Let us import the string module and print this constant.


Photo by Behnam Norouzi on Unsplash

The calendar module in python enables us to print calendars on the terminal and other cool functions with the calendar.

Import the calendar module to access all these functions.

Print a month’s calendar

The prmonth() method helps us to print a month’s calendar. It requires the year and the month in the form of integers as arguments.


Photo by Annie Spratt on Unsplash

The math module provides us various functions. Some of them are discussed in this article. Import the math function to begin.

The ten methods in this article are

  1. ceil and floor
  2. factorial
  3. gcd
  4. sqrt
  5. pow
  6. sin, cos, tan
  7. exp
  8. fabs
  9. isclose
  10. constants

Ceil and floor functions

The ceil() method returns an integer that is greater than or equal to the given float value. Similarly, the floor() method returns an integer that is lesser or equal to the given float value. If an integer value is given the same value is returned.


Photo by Chris Liverani on Unsplash

Python has a built-in library called statistics. This module provides functions for calculating mathematical statistics of numeric (Real-valued) data.

Unless explicitly noted, these functions support int, float, Decimal and Fraction.

Some of the most common methods supported by this module are,

  1. mean()
  2. fmean()
  3. geometric_mean()
  4. median()
  5. median_low()
  6. median_high()
  7. mode()
  8. multimode()

Let us look at the above methods one by one with an example for each.

1. mean()

The first method is the mean(). This method returns the sample arithmetic mean of data which can be a sequence or iterable.

The arithmetic mean is the sum of the data divided by the number of…


Photo by Nick Fewings on Unsplash

I was always amazed by how easily things can be done using python. Some of the tedious tasks can be done in a single line of code using python. I have gathered some of my favorite one-liners from python. I have listed out 50 of them below with an example for each.

1. Anagram

2. Binary to decimal

3. Converting string to lower case

4. Converting string to upper case


Photo by Firmbee.com on Unsplash

This blog post focuses on finding various information about the nature of the browser and os from which the HTTP requests are made. The following information can be obtained from the requests.

  1. If the device is a mobile/PC
  2. Browser name
  3. Browser version
  4. OS of the computer or mobile
  5. OS version
  6. Device name

Let us get started. There are actually two ways to obtain this information.

  1. The 'HTTP_USER_AGENT' header data from the request object
  2. Using a django-user-agents library.

Let us get started.

1. The 'HTTP_USER_AGENT' data from the header

In Django, each type of HTTP request is received at the backend via a request object. This request object…


Photo by Laika Notebooks on Unsplash

This article is about copying the contents of one file to another using python. This is possible with the help of a built-in python library called shutil. This library just copies the contents of the source file to the destination file in a single line of code.

How does it work?

The shutil module has a method called copyfile(). This method takes the source file name and the destination file name as the parameters. The copy of the source file is made in the same directory as the program unless a complete path is given as the destination file name.

code


Photo by Solen Feyissa on Unsplash

Is your inbox cluttered with promotional emails or newsletters from websites that you cannot unsubscribe to? Don't worry there is a way to hide these emails from your inbox.

Gmail inbox filter

Gmail enables us to create advanced filters to filter our emails. With the help of the filters that we created, either we can apply them to the inbox in case we only need to perform a search or we can specify certain actions to the filtered emails.

Allwin Raju

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store