Skip to content

Instantly share code, notes, and snippets.

@dhruvkar
dhruvkar / mkdir.py
Last active August 23, 2017 19:03
best way to make a directory in python
def mkdir(dir_path)
try:
os.makedirs(dir_path)
except OSError as e:
if e.errno != errno.EEXIST:
raise
@dhruvkar
dhruvkar / config.js
Last active December 20, 2017 20:01
Config file for Ghost
// # Ghost Configuration
// Setup your Ghost install for various environments
var path = require('path'),
config;
config = {
// ### Development **(default)**
development: {
// The url to use when providing links to the site, E.g. in RSS and email.
@dhruvkar
dhruvkar / biz_ratings.py
Last active March 22, 2019 02:51
Get Yelp and Google ratings of a business, given the business name, address, & phone number.
#!/usr/bin/env python
from __future__ import print_function
import json
import re
import requests # pip install requests
from yelpapi import YelpAPI # pip install yelpapi. Not a very mature library, use at your own risk.
from requests.compat import urljoin, quote_plus

Keybase proof

I hereby claim:

  • I am dhruvkar on github.
  • I am dhruvkar (https://keybase.io/dhruvkar) on keybase.
  • I have a public key whose fingerprint is 4567 DD8B 3255 4C43 0B2F 6A0F 4FDC 3E91 57A4 50A2

To claim this, I am signing this object:

import os
import requests
from bs4 import BeautifulSoup as bs
USERNAME = "" # for instacart
PASSWORD = "" # for instacart
EMAIL = "" # where to send alert
@dhruvkar
dhruvkar / browser.py
Last active November 14, 2023 14:26
Run Browser in a Virtual Display using Selenium and transfer session to Python Requests
"""
If you use Chrome, get Chromedriver and put in your PATH:
http://chromedriver.chromium.org/downloads
If you use Firefox, get Geckodriver and put in your PATH:
https://github.com/mozilla/geckodriver/releases
Also install:
pip install requests