Skip to content

Instantly share code, notes, and snippets.

View madhavan-rp's full-sized avatar

Madhavan Rajagopal Padmanabhan madhavan-rp

View GitHub Profile
@madhavan-rp
madhavan-rp / google_contact.py
Created May 30, 2014 06:49
Simple script that prints a given google contact in JSON
client_id = r'<Client ID>'
client_secret = r'<Client Secret>'
redirect_uri = 'https://localhost:5000/authorized'
scope = ['https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.google.com/m8/feeds',
'https://mail.google.com/'
]
from requests_oauthlib import OAuth2Session
import requests
@madhavan-rp
madhavan-rp / tag-sets
Last active August 29, 2015 14:00
NLTK
// https://github.com/nltk/nltk
$: dollar
$ -$ --$ A$ C$ HK$ M$ NZ$ S$ U.S.$ US$
'': closing quotation mark
' ''
(: opening parenthesis
( [ {
): closing parenthesis
) ] }
@madhavan-rp
madhavan-rp / app.py
Last active August 29, 2015 13:56
Flask Snippets
from apscheduler.scheduler import Scheduler
from datetime import datetime, timedelta
sched = Scheduler()
def eat():
print("I'm eating a sandwich")
from flask import Flask
app = Flask(__name__)
app.config['DEBUG'] = True
@madhavan-rp
madhavan-rp / ViewController+Swizzle.h
Last active August 29, 2015 13:56
ViewController+Swizzle
//
// ViewController+Swizzle.h
// TryingOutStuff
//
#import "ViewController.h"
@interface ViewController (Swizzle)
@end
@madhavan-rp
madhavan-rp / Http Requests
Last active August 29, 2015 13:56
Javascript Snippets
function f1() {
xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST","/api/v1/endpoint",true);
xmlhttp.setRequestHeader("Content-Type","application/json");
xmlhttp.send(JSON.stringify({"text":"Classify this!"}));
console.log("" + xmlhttp.responseText);
}
function get() {
xmlhttp = new XMLHttpRequest();
@madhavan-rp
madhavan-rp / gmail-label-imap.rb
Last active January 19, 2018 03:47
Mailman gem - IMAP & POP3 Configuration with rails
#!/usr/bin/env ruby
# Program to download emails through imap.
#Uses Gmail's imap extensions to download all emails of a label.
require "rubygems"
require "bundler/setup"
require "mailman"
@madhavan-rp
madhavan-rp / importexport
Last active December 21, 2015 19:48
Mongo Shell Commands Quick Reference
//Import
mongoimport --db myDB --collection myCollection --file myJSONFile.json
//Export
mongoexport --db myDB --collection myCollection --out myJSONFile.json