Skip to content

Instantly share code, notes, and snippets.

View anishmenon's full-sized avatar

Anish Menon anishmenon

View GitHub Profile
@anishmenon
anishmenon / recap-py
Last active July 13, 2018 08:11
recap.py
result = requests.post('https://www.google.com/recaptcha/api/siteverify',\
data = {'secret':private_key,'remoteip':get_client_ip(request),'response':rp('token')},verify=True)
if result.json()['success']:
def get_client_ip(request):
@anishmenon
anishmenon / testlat.html
Created December 5, 2016 11:54
sanjaytestlathtml
// Shorthand for $( document ).ready()
$(function() {
$.get( "{% url 'sanjay' %}", {'q':'xyz'})
.done(function( returndata ){
if(returndata.status == 'success')
@anishmenon
anishmenon / testlat.py
Last active December 5, 2016 12:03
sanjaytestlat
import json
def sanjay(request):
rg = request.GET.get
print rg('q')
response_data = {}
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
paginator = Paginator(customers, 30)
page = rg('page')
try:
customers = paginator.page(page)
<!-- PAGINATION SECTION START -->
{% if customers %}
<nav>
<ul class="pagination">
{% if customers.has_previous %}
<li> <a href="?{% for key, values in request.GET.iterlists %}{% ifnotequal key "page" %}{% for value in values%}{{key}}={{value}}&amp;{% endfor %}{% endifnotequal %}{% endfor %}page={{customers.previous_page_number}}" aria-label="Previous"> <span aria-hidden="true">&laquo;</span> </a> </li>
<!DOCTYPE html>
<html>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link href="font/fonts.css" rel="stylesheet" type="text/css">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Ammras- Mobile App</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
#Create a list of integers from 2 to 30, and another list from 3-50
def 2_30():
a = []
return a.append(range(2,33))
def 3_50():
a = []
filenames = ["/home/node4/anish/varnan/1.jpg", "/home/node4/anish/varnan/2.jpg"]
import zipfile
import glob, os
import os
import zipfile
import StringIO
from django.http import HttpResponse
def getfiles(request):
@anishmenon
anishmenon / django freshdesk integration
Created September 7, 2014 18:39
Freshdesk Django integration
#settings.py
FRESHDESK_URL = 'YOUR FRESHDESK URL'
FRESHDESK_SECRET_KEY = 'YOUR Single Sign On KEY' # you can find admin->security inside freshdesk admin
#views.py
from django.http import Http404