Skip to content

Instantly share code, notes, and snippets.

Fibinse Xavier` fx86

View GitHub Profile
@fx86
fx86 / query_redash.py
Last active Jul 27, 2018
Takes a Redash query ID and returns cached-data in a Pandas dataframe
View query_redash.py
# save your redash API key in a text file as below
api_key = open('api_key.config', 'r').readlines()[0]
def api_to_df(query_id, api_key=api_key):
'''
Takes a Redash query ID and returns cached-results
in a Pandas dataframe
'''
@fx86
fx86 / boilerplate.py
Last active Jun 24, 2018
Boilerplate code for scrapers - has query-caching, geocoding, refreshing proxies & enabling detailed logging
View boilerplate.py
from glob import glob
from hashlib import md5
from fake_useragent import UserAgent as ua
from splinter import Browser
from splinter.exceptions import *
from selenium.common.exceptions import *
from random import randint
from time import sleep
import requests
import time
@fx86
fx86 / string_similarity.py
Created May 28, 2016
A much more effective algorithm for string similarity found on Stack Overflow
View string_similarity.py
import wikipedia
def get_bigrams(string):
'''
Takes a string and returns a list of bigrams
'''
s = string.lower()
return [s[i:i+2] for i in xrange(len(s) - 1)]
def string_similarity(str1, str2):
You can’t perform that action at this time.