Instantly share code, notes, and snippets.

from __future__ import division
from bs4 import BeautifulSoup as bs
import requests
import re
import time
from pymongo import MongoClient
from time import mktime
from datetime import datetime
import plotly.plotly as py
import plotly.graph_objs as go
View proxy.pac
function FindProxyForURL(url, host)
if (dnsDomainIs(host, ""))
return "PROXY"
if (dnsDomainIs(host, ""))
return "PROXY"
return "DIRECT"

Keybase proof

I hereby claim:

  • I am thinrhino on github.
  • I am thinrhino ( on keybase.
  • I have a public key whose fingerprint is 76EB 936C 5D76 6E82 E9A9 68FF 96C8 359B CC53 9C5F

To claim this, I am signing this object:

# First download the twitter archive
# Get API_KEY and API_SECRET from
import os
import json
import glob
import base64
import requests
from requests_oauthlib import OAuth1Session
View emacs
;; Enable mouse support
(unless window-system
(require 'mouse)
(xterm-mouse-mode t)
(global-set-key [mouse-4] '(lambda ()
(scroll-down 1)))
(global-set-key [mouse-5] '(lambda ()
(scroll-up 1)))
#!/usr/bin/env python -i
A local interactive IPython shell for Google App Engine on Mac OSX.
cd /to/project/folder/with/app.yaml
View main.js
$(document).ready(function() {
chart: chart,
title: title,
xAxis: xAxis,
yAxis: yAxis,
series: series
View vagrant-scp
# Change these settings to match what you are wanting to do
OPTIONS=`vagrant ssh-config | awk -v ORS=' ' '{print "-o " $1 "=" $2}'`
scp ${OPTIONS} $FILE vagrant@$SERVER:$PATH
# ref:
# Example:
# Consider a document containing 100 words wherein the word cat appears 3 times.
# The term frequency (i.e., tf) for cat is then (3 / 100) = 0.03. Now, assume we
# have 10 million documents and the word cat appears in one thousand of these.
# Then, the inverse document frequency (i.e., idf) is calculated as log(10,000,000 / 1,000) = 4.
# Thus, the Tf-idf weight is the product of these quantities: 0.03 * 4 = 0.12.
# Hence:
# 1. Calculate term frequency
from collections import defaultdict
import matplotlib.pyplot as plt
data = open('<data_file>', 'r')
r_data = []
# reading relevant data
while True:
l = data.readline()
if l == '':