Skip to content

Instantly share code, notes, and snippets.

View adarsh0806's full-sized avatar
🎯

Adarsh adarsh0806

🎯
  • San Francisco
View GitHub Profile
def delete_first(self):
deleted = self.head
if self.head:
self.head = self.head.next
deleted.next = None
return deleted
#!/usr/bin/python
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
PORT_NUMBER = 8080
#This class will handles any incoming request from
#the browser
class myHandler(BaseHTTPRequestHandler):
#Handler for the GET requests
adarshnair (master) Downloads $ python puppies.py
adarshnair (master) Downloads $ python puppypopulator.py
adarshnair (master) Downloads $ sqlite3
SQLite version 3.8.4.1 2014-03-11 15:27:36
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .open puppyshelter.db
sqlite> .schema
@adarsh0806
adarsh0806 / gconnect.py
Created October 19, 2015 22:14
Google OAuth gconnect with comments.
def gconnect():
""" Handles the Google+ sign-in process on the server side.
Server side function to handle the state-token and the one-time-code
send from the client callback function following the seven steps of the
Google+ sign-in flow. See the illustrated flow on
https://developers.google.com/+/web/signin/server-side-flow.
Returns:
When the sign-in was successful, a html response is sent to the client
signInCallback-function confirming the login. Otherwise, one of the
following responses is returned: