Skip to content

Instantly share code, notes, and snippets.

View harishvc's full-sized avatar

Harish Chakravarthy harishvc

View GitHub Profile
@harishvc
harishvc / bigquery-quota-exceeded
Created August 17, 2014 19:23
Bigquery quota exceeded output
Error:'{\n "error": {\n "errors": [\n {\n "domain": "global",\n "reason": "quotaExceeded",\n "message": "Exceeded quota: too many free query bytes scanned for this project"\n }\n ],\n "code": 403,\n "message": "Exceeded quota: too many free query bytes scanned for this project"\n }\n}\n'
None
@harishvc
harishvc / Output
Last active August 29, 2015 14:05
Bigquery - Popular new github repositories
{"kind": "bigquery#queryResponse", "rows": [{"f": [{"v": "https://github.com/the4dpatrick/possible-email"}, {"v": "Ruby"}, {"v": "71"}]}, {"f": [{"v": "https://github.com/djyde/V2EX-API"}, {"v": null}, {"v": "36"}]}, {"f": [{"v": "https://github.com/rails/globalid"}, {"v": "Ruby"}, {"v": "30"}]}, {"f": [{"v": "https://github.com/benbalter/markdown-to-pdf"}, {"v": "Ruby"}, {"v": "26"}]}, {"f": [{"v": "https://github.com/dboudro/AnimateSVGText"}, {"v": null}, {"v": "26"}]}], "jobReference": {"projectId": "oceanic-column-675", "jobId": "job_UXl9bVcv0K3HL9KdMMmt7Q7gYr8"}, "jobComplete": true, "totalRows": "5", "totalBytesProcessed": "28273995336", "cacheHit": false, "schema": {"fields": [{"type": "STRING", "name": "repository_url", "mode": "NULLABLE"}, {"type": "STRING", "name": "repository_language", "mode": "NULLABLE"}, {"type": "INTEGER", "name": "cnt", "mode": "NULLABLE"}]}}
@harishvc
harishvc / youtube-embed
Created October 9, 2014 06:32
Howto embed a YouTube clip with autoplay, full screen and no related videos on a webpage?
<!-- YouTube options -->
<!-- https://developers.google.com/youtube/player_parameters -->
<iframe width=100% height=100% src="//www.youtube.com/embed/##something##
?autoplay=1&cc_load_policy=1&rel=0&showinfo=0"
frameborder="0" allowfullscreen>
</iframe>
@harishvc
harishvc / Metadata driving Ellen's selfie tweet
Last active August 29, 2015 14:11
Metadata driving Ellen's history making 10 word selfie tweet at the end of Oscars 2014. Tweet anatomy article at http://harishvc.com/2014/03/25/tweet-anatomy/
{
"created_at": "Mon Mar 03 03:06:13 +0000 2014",
"id": 440322224407314432,
"id_str": "440322224407314432",
"text": "If only Bradley's arm was longer. Best photo ever. #oscars http:\/\/t.co\/C9U5NOtGap",
"source": "\u003Ca href=\"http:\/\/twitter.com\/download\/android\" rel=\"nofollow\"\u003ETwitter for Android\u003C\/a\u003E",
"truncated": false,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
@harishvc
harishvc / gist:44ef94d4aa85d18d1478
Created February 6, 2015 02:45
Autoplay Prezi Slides
<html>
<head>
<title>Autoplay Prezi using API</title>
<script type='text/javascript' src='https://cdn.firebase.com/js/client/1.0.2/firebase.js'></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="http://prezi.github.io/prezi-player/lib/PreziPlayer/prezi_player.js"></script>
<style>
body {
margin: 0;
}
###Output Log###
2015-02-15 07:33:01 start processing ... http://data.githubarchive.org/2015-02-15-13.json.gz
## entries generated from githubarchive.org: 14,983
2015-02-15 07:33:07 end processing
2015-02-15 07:33:07 start inserting to mongodb
Deleting entries older than 1423928036142
## deleted: 16,182
start re-index
### documents: 310,514
2015-02-15 07:34:10 end inserting to mongodb
@harishvc
harishvc / gist:42d4caefd75e7dc1983f
Last active December 29, 2022 07:21
Search results pagination using Flask and MongoDB. Visit Ask GitHub.com to see pagination in action.
#All code is visible at https://github.com/harishvc/githubanalytics
#Reference:
# [Flask paginate extension] (http://flask-paginate.readthedocs.org/en/latest/)
# http://flask-paginate.readthedocs.org/en/latest/
#Step 1: Install flask paginate extension
$> pip install flask-paginate
@harishvc
harishvc / gist:2ae4de25bfa75e5bd680
Last active October 29, 2015 00:31
MongoDB & Neo4j Query
#MongoDB
pipeline = [
{ '$match': {'type':'WatchEvent'}},
{ '$group': {'_id': {'full_name': '$full_name'}, 'stars': { '$sum' : 1 }}},
{ '$project': { '_id': 0, 'full_name': '$_id.full_name', 'stars': '$stars' } },
{ '$sort' : { 'stars': -1 }},
{ '$limit': 10}
]
mycursor = db.aggregate(pipeline)
@harishvc
harishvc / .travis.yml
Last active January 25, 2016 15:32
.travis.yml
language: python
python:
- '2.7'
env:
global:
- secure: **something special**
- secure: **something special**
addons:
sauce_connect: true
services:
@harishvc
harishvc / travis-testcases.py
Last active January 25, 2016 15:32
Selenium Test Cases
import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from sauceclient import SauceClient
import os
class AskGitHubTestSuite(unittest.TestCase):
def setUp(self):
#Sauce Labs