Skip to content

Instantly share code, notes, and snippets.

View sugavaneshb's full-sized avatar

Sugavanesh B sugavaneshb

View GitHub Profile
@sugavaneshb
sugavaneshb / careercup-scrapper.py
Created July 26, 2013 16:26
A simple python script to scrap and get questions from careercup.com which can be later viewed Dependencies: beautifulsoup, urllib
from bs4 import BeautifulSoup
from urllib2 import urlopen
from urllib import urlretrieve
import os, sys, io, re, lxml
import mechanize
import codecs, string
br = mechanize.Browser()
base_url = "http://www.careercup.com"
directory = '/tmp/careercup/'
@sugavaneshb
sugavaneshb / grab-quora-yt.js
Last active December 27, 2015 12:29
Script to grab youtube links present in a quora answer. **Still working on it**
javascript: function init() {
// the minimum version of jQuery we want
var v = "1.3.2";
// check prior inclusion and version
if (window.jQuery === undefined || window.jQuery.fn.jquery < v) {
var done = false;
var script = document.createElement("script");
script.src = "http://ajax.googleapis.com/ajax/libs/jquery/" + v + "/jquery.min.js";
script.onload = script.onreadystatechange = function() {
if (!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete")) {
@sugavaneshb
sugavaneshb / json_to_csv.py
Created October 10, 2014 06:32
A simple JSON to CSV file converter
import os
import sys
import csv
import codecs
import json
reload(sys)
sys.setdefaultencoding('utf-8')
'''
Determine the different keys present in JSON
embeds_re = re_compile(r'''
(?:youtube(?:-nocookie)?\.com # youtube.com or youtube-nocookie.com
| # or
youtu\.be)/ # youtu.be
(?:embed/|watch\?v=|watch/\?v=|embed/\?v=)? # /embed/... or /watch?v=... or /watch/?v=... or /embed/?v=... or /...
([^\s\"\?&]{11}) # capture & stop at whitespace " ? &
''', VERBOSE)
javascript: (function () {var jsCode = document.createElement('script');jsCode.setAttribute('src', 'https://cdn.rawgit.com/sugavaneshb/c8d8116d05868416d9ae/raw/a35e1494b757646af178864861db00f3419040e3/grab-quora-yt.js'); document.body.appendChild(jsCode); }());
#/usr/bin
# Minute Hour Day of Month Month Day of Week Command
#starting synergy
0 11 * * * ~/scripts/start-synergy.sh
0 0 * * 0 find . -iname '*\~' -exec rm {} \;
from bs4 import BeautifulSoup
from urllib2 import urlopen
from urllib import urlretrieve
import os, sys, io, re, lxml
import mechanize
import codecs, string
br = mechanize.Browser()
base_url = "http://www.careercup.com"
down_url = 'http://www.careercup.com/page?pid=google-interview-questions'
@sugavaneshb
sugavaneshb / regex-search
Created May 3, 2015 12:48
Regex Search Bookmarklet
@sugavaneshb
sugavaneshb / regex-highlight
Created May 3, 2015 12:58
Regular Expression Inline highlighter on the web
javascript:(/**Source: http://superuser.com/a/419272/256674**/function(){var count=0, text, regexp;text=prompt("Search regexp:", "");if(text==null || text.length==0)return;try{regexp=new RegExp("(" + text +")", "i");}catch(er){alert("Unable to create regular expression using text '"+text+"'.\n\n"+er);return;}function searchWithinNode(node, re){var pos, skip, spannode, middlebit, endbit, middleclone;skip=0;if( node.nodeType==3 ){pos=node.data.search(re);if(pos>=0){spannode=document.createElement("SPAN");spannode.style.backgroundColor="yellow";middlebit=node.splitText(pos);endbit=middlebit.splitText(RegExp.$1.length);middleclone=middlebit.cloneNode(true);spannode.appendChild(middleclone);middlebit.parentNode.replaceChild(spannode,middlebit);++count;skip=1;}}else if( node.nodeType==1 && node.childNodes && node.tagName.toUpperCase()!="SCRIPT" && node.tagName.toUpperCase!="STYLE"){for (var child=0; child < node.childNodes.length; ++child){child=child+searchWithinNode(node.childNodes[child], re);}}return skip;}wind