Skip to content

Instantly share code, notes, and snippets.

View AnjaneyuluBatta505's full-sized avatar

Anjaneyulu Batta AnjaneyuluBatta505

View GitHub Profile
@AnjaneyuluBatta505
AnjaneyuluBatta505 / meta-tags.md
Created November 29, 2017 13:06 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@AnjaneyuluBatta505
AnjaneyuluBatta505 / nginx-uwsgi-python3
Created November 30, 2017 10:30 — forked from simoncoulton/nginx-uwsgi-python3
Setting up Nginx, uWSGI & Python3
======================================
Setting up Nginx, uWSGI and Python3
======================================
First off, I'm traditionally a PHP developer, but am looking at moving across to Python. I really struggled to find decent documentation on how to get a server up and running for deploying Python web applications from the point of view of someone coming from PHP. The main problems I came across with documentation were:
1) Only showed you how to run the server for a single web application.
2) Only showed you how to configure the app, not the server it was running on.
My preferred workflow for development is by setting up a new VM in VMware Fusion and then forwarding through all requests to that VM via /etc/hosts. This might not be the optimal way to get things up and running, but it works for me.
@AnjaneyuluBatta505
AnjaneyuluBatta505 / thoughtworks_problems.md
Last active December 2, 2017 08:18
thoughtworks coding problems

Inventory-MinCost

Thoughtworks agile bootcamp problem solution in Core Java

Inventory Management Recently a new online store opened on the Internet that sells iPods & iPhones. They are faced with an interesting problem of managing their inventory distributed across 2 countries: Brazil and Argentina. You have been assigned to write a program to minimize

@AnjaneyuluBatta505
AnjaneyuluBatta505 / python_iterator.py
Created December 17, 2017 10:44
Custom python iterator
class Fibonacci:
def __init__(self, limit):
self.limit = limit
self.counter = 0
self.fib_data = []
def __iter__(self):
return self
def next(self):
@AnjaneyuluBatta505
AnjaneyuluBatta505 / blogpost_ld+json.js
Created January 5, 2018 07:02
schema for blogpost in json ld
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BlogPosting",
"mainEntityOfPage":{
"@type":"WebPage",
"@id":"http://applefostering.co.uk/skills-foster/"
},
"headline": "The Skills to Foster",
"image": {
@AnjaneyuluBatta505
AnjaneyuluBatta505 / python_mgetattr.py
Created January 25, 2018 12:48
deep attribute lookup
def mgetattr(obj, lookup):
# deep attribute lookup
for attr in lookup.split('.'):
obj = getattr(obj, attr)
return obj
@AnjaneyuluBatta505
AnjaneyuluBatta505 / property.py
Created January 26, 2018 12:55
suage of python property
class Person(object):
def __init__(self, first_name, last_name):
self.first_name = first_name
self.last_name = last_name
@property
def full_name(self):
return self.first_name + ' ' + self.last_name
@full_name.setter
def full_name(self, value):
first_name, last_name = value.split(' ')
@AnjaneyuluBatta505
AnjaneyuluBatta505 / create_pdf_using_pdfkit_and_wkhtml.py
Created February 18, 2018 10:56
html to pdf using pdfkit and wkhtmltopdf
import pdfkit
from django.http import HttpResponse
from django.template import loader
def create_pdf(request):
"""
url: https://learnbatta.com/blog/django-html-to-pdf-using-pdfkit-and-wkhtmltopdf-5/
"""
html = loader.render_to_string('invoice.html', {})
output= pdfkit.from_string(html, output_path=False)
@AnjaneyuluBatta505
AnjaneyuluBatta505 / workon.sh
Created April 23, 2018 06:15
workon is a bash completion function
workon is a function
workon ()
{
typeset -a in_args;
typeset -a out_args;
in_args=("$@");
if [ -n "$ZSH_VERSION" ]; then
i=1;
tst="-le";
else
@AnjaneyuluBatta505
AnjaneyuluBatta505 / get_oauth2_token.py
Created April 27, 2018 11:29 — forked from clarketm/get_oauth2_token.py
How to get Google OAuth 2.0 access token in console using the Python API
#!/usr/bin/env python
'''
This script will attempt to open your webbrowser,
perform OAuth 2.0 authentication and print your access token.
To install dependencies from PyPI:
$ pip install oauth2client
Then run this script: