Skip to content

Instantly share code, notes, and snippets.

g<-c("http://www.google.com","http://www.google.co.in")
q<-c("thalassemia")
paste0(g[1],"/?q=",q)
library(rvest)
pg<-html(paste0(g[1],"/?q=",q))
#https://gist.github.com/dsparks/3710171
#MELT DATA
display.brewer.all()
myPalette <- colorRampPalette(brewer.pal(7, "RdYlGn"))
zp1 <- ggplot(star3[CIN=="H2643"],
aes(x = variable, y = CIN, fill = value))
zp1 <- zp1 + geom_tile()
server{
listen 80;
server_name rr.saurabhgaur.com;
location / {
proxy_pass http://127.0.0.1:8787;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
@srgist
srgist / gist:6338408
Created August 26, 2013 05:55
Venn Dia2 -- for stagewise -- diabetes progression
circle <- function(x, y, r, ...) {
ang <- seq(0, 2*pi, length = 100)
xx <- x + r * cos(ang)
yy <- y + r * sin(ang)
polygon(xx, yy, ...)
}
venndia2 <- function(A, B, C, label,getdata=FALSE, ...){
cMissing <- missing(C)
if(cMissing){ C <- c() }
@srgist
srgist / gist:6338396
Created August 26, 2013 05:51
Venn Diagram in R
circle <- function(x, y, r, ...) {
ang <- seq(0, 2*pi, length = 100)
xx <- x + r * cos(ang)
yy <- y + r * sin(ang)
polygon(xx, yy, ...)
}
venndia <- function(A, B, C, getdata=FALSE, ...){
cMissing <- missing(C)
if(cMissing){ C <- c() }
@srgist
srgist / Datetime fns
Created January 12, 2013 16:50
PY: Datetime
from datetime import datetime
import time
#-------------------------------------------------
# conversions to strings
#-------------------------------------------------
# datetime object to string
dt_obj = datetime(2008, 11, 10, 17, 53, 59)
date_str = dt_obj.strftime("%Y-%m-%d %H:%M:%S")
print date_str
@srgist
srgist / GAE datastore commands
Created January 12, 2013 13:37
PY:Datastore GAE commands
class Feeds(db.Model):
articleid = db.IntegerProperty()
feedlistid = db.IntegerProperty()
title = db.StringProperty()
itemurl = db.LinkProperty()
img = db.LinkProperty()
textmin = db.StringProperty()
textfull = db.TextProperty()
dated = db.DateTimeProperty()
isRead = db.BooleanProperty()
form_fields = json.dumps({
"consumer_key": "10919-c09bc8099013395a6bf878ac",
"redirect_uri": "http://saurabh.com",
"email_address": "Albert.Johnson@example.com"
})
url="https://getpocket.com/v3/oauth/request"
#form_data = urllib.urlencode(form_fields)
result = urlfetch.fetch(url=url,
payload=form_fields,
method=urlfetch.POST,
@srgist
srgist / gist:4409157
Created December 29, 2012 20:21
PY: Initiate
import os
import webapp2
import jinja2
import urllib2
from google.appengine.ext import db
from xml.dom import minidom
from datetime import datetime,timedelta
from google.appengine.api import urlfetch
import json
@srgist
srgist / app yaml for python app
Created December 29, 2012 20:19
PY: app.yaml
application: srbhgaur02
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico