Skip to content

Instantly share code, notes, and snippets.

Avatar

Pratap Vardhan pratapvardhan

View GitHub Profile
@pratapvardhan
pratapvardhan / GFinSectorIndustryBasic.py
Created Jun 5, 2014
Python Script to extract Sector and Industry for a company stock listed on Google Finance
View GFinSectorIndustryBasic.py
from urllib import urlopen
from lxml.html import parse
'''
Returns a tuple (Sector, Indistry)
Usage: GFinSectorIndustry('IBM')
'''
def GFinSectorIndustry(name):
tree = parse(urlopen('http://www.google.com/finance?&q='+name))
return tree.xpath("//a[@id='sector']")[0].text, tree.xpath("//a[@id='sector']")[0].getnext().text
@pratapvardhan
pratapvardhan / .block
Last active Feb 10, 2018
Vega-lite: Horizontal Stacked Bar Chart with Labels
View .block
license: gpl-3.0
@pratapvardhan
pratapvardhan / .block
Last active Aug 1, 2017
Network Wavy Path - III - Springy
View .block
license: gpl-3.0
@pratapvardhan
pratapvardhan / .block
Last active Aug 1, 2017
Network Wavy Path - I
View .block
license: gpl-3.0
@pratapvardhan
pratapvardhan / .block
Last active Aug 1, 2017
Network Wavy Path - II
View .block
license: gpl-3.0
View git-alias
alias gst='git status'
alias gl='git pull'
alias gp='git push'
alias gd='git diff | mate'
alias gau='git add --update'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gb='git branch'
alias gba='git branch -a'
alias gco='git checkout'
View party.py
''' A faithful Python plug for party-time.js
developed by @HarryStevens at HindustanTimesLabs
https://github.com/HindustanTimesLabs/party-time/
import party as pt
pt.convert("BJP")
# "Bharatiya Janata Party"
pt.convert("BJP", { "greedy": False })
# { abbr: "BJP", name: "Bharatiya Janata Party" }
View aam-aadmi-mohalla-clinics-in-delhi.csv
District Sno Assembly Asno Address Status
North 1 NARELA 1 Sant Kirpal Singh Public Trust,811,GT Road Alipur,Delhi 36 Functioning
North 2 NARELA 1 Hno.246,Tyagi mohalla ,Narela,Delhi 36 Functioning
Central 3 Burari 2 PO Building ,Near Takia Chowk,Burari Functioning
Central 4 Burari 2 Mohalla Clinic Nathupura: - Budh Bazar Road,Nathupura,Burari,Delhi Functioning
Central 5 Timarpur 3 Khasara No -120,Gali No-17 ,Main Road,Wazirabad Functioning
North 6 Adarsh Nagar 4 H.No.467 D Near Budh Mandir,Village Azadpur Functioning
North 7 Badli 5 A-215,Bhalaswa Dairy Near Police Station Functioning
North West 8 Rithala 6 H.No. 231-32,Kh. No.28/ 19,Mange Ram Park,Budh,Vihar Phase-2,Deihi-86 Functioning
North West 9 Rithala 6 F4/6,Sector 16 Rohini,Delhi 85 Functioning
@pratapvardhan
pratapvardhan / vega-horizontalbar.json
Created Sep 3, 2015
horizontal barchart using vega.js
View vega-horizontalbar.json
{
"width": 400,
"height": 200,
"padding": {"top": 10, "left": 30, "bottom": 30, "right": 10},
"data": [
{
"name": "table",
"values": [
{"x": 1, "y": 28}, {"x": 2, "y": 55},
{"x": 3, "y": 43}, {"x": 4, "y": 91},
@pratapvardhan
pratapvardhan / jsrc
Created Sep 4, 2014
Include js src from console
View jsrc
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= 'script.js';
document.head.appendChild(script);