Skip to content

Instantly share code, notes, and snippets.

View santoshpy's full-sized avatar
🐍
Focusing

Santosh Purbey santoshpy

🐍
Focusing
View GitHub Profile
@santoshpy
santoshpy / pip_install_package_from_github.md
Created November 12, 2017 02:17
pip install package from github

pip install package from github

comand in shell:

pip install git+https://github.com/username/repository.git@branch
@santoshpy
santoshpy / javascript_framework.md
Created November 12, 2017 16:30
javascript_framework
from django.contrib.auth.models import User
admin.site.unregister(User)
from app_name.models import User
admin.site.register(User)
@santoshpy
santoshpy / models.py
Last active April 28, 2018 04:50
Choices for Choices in Django CharFields
from .utils import ChoiceEnum
class Car(models.Model):
# Encapsulation, we meet again.
class Colors(ChoiceEnum):
RED = 'red'
WHITE = 'white'
BLUE = 'blue'
color = models.CharField(max_length=5, choices=Colors.choices(), default=Colors.RED)
@santoshpy
santoshpy / git_commit_message.md
Last active October 14, 2018 10:36
How to write git commit message

How to Write a Git Commit Message


It is useful to write good commit message which shows professionalism. it shows whether a developer is a good collaborator or not?

The most basic element of keeping a healthy commit history: How to write a great commit message.

Just follow the seven rules below and you’re on your way to committing like a pro.

@santoshpy
santoshpy / string_exercise.py
Last active December 7, 2018 14:04
String exercise
"""
1. Write a Python program to get a string from a given string
where all occurrences of its first char have been changed to '$',
except the first char itself.
Sample String : 'restart'
Expected Result : 'resta$t'
"""
"""
@santoshpy
santoshpy / inspect_mate.py
Created December 26, 2018 09:40 — forked from MacHu-GWU/inspect_mate.py
``inspect_mate`` provides more methods to get information about class attribute than the standard library ``inspect``.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
``inspect_mate`` provides more methods to get information about class attribute
than the standard library ``inspect``.
This module is Python2/3 compatible, tested under Py2.7, 3.3, 3.4, 3.5, 3.6.
Includes tester function to check:
@santoshpy
santoshpy / hello_world.py
Created February 20, 2019 07:33
Hello World Examples
class HelloWorld:
def __init__(self, name):
self.name = name.capitalize()
def sayHi(self):
print "Hello " + self.name + "!"
hello = HelloWorld("world")
hello.sayHi()
@santoshpy
santoshpy / python_3.ipynb
Created May 15, 2019 01:52
things_you_are_probably_not_using_in_python_3_but_should/python 3 examples.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@santoshpy
santoshpy / producer_consumer_using_thread.py
Created March 3, 2020 10:28
Python queue for multithreading, multi-thread-example
import time
import random
import threading
from queue import Queue
from threading import Thread
def crawler(queue):
while True: