Skip to content

Instantly share code, notes, and snippets.

Tisham Dhar whatnick

Block or report user

Report or block whatnick

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@whatnick
whatnick / pydrive-dance.py
Created Jun 13, 2019
Integration between PyDrive and Flask-Dance
View pydrive-dance.py
oauth_token = session['google_oauth_token']
from oauth2client.client import OAuth2Credentials
from datetime import datetime
expirty_str = str(datetime.fromtimestamp(oauth_token['expires_at']))
with flask_app.app_context():
token_data = {
'access_token' : oauth_token['access_token'],
'token_expiry' : expirty_str,
'user_agent' : 'PyDrive Automation',
'refresh_token' : None,
@whatnick
whatnick / pydrive-dance.py
Created Jun 13, 2019
Integration between PyDrive and Flask-Dance
View pydrive-dance.py
oauth_token = session['google_oauth_token']
from oauth2client.client import OAuth2Credentials
from datetime import datetime
expirty_str = str(datetime.fromtimestamp(oauth_token['expires_at']))
with flask_app.app_context():
token_data = {
'access_token' : oauth_token['access_token'],
'token_expiry' : expirty_str,
'user_agent' : 'PyDrive Automation',
'refresh_token' : None,
View gist:d9a6692fef67a158fcb2b8ce1a85b0f7
import machine
import time
SysStatus = 0x01 #System Status
sck = machine.Pin(5,machine.Pin.OUT)
mosi = machine.Pin(18,machine.Pin.OUT)
miso = machine.Pin(19,machine.Pin.IN)
cs1 = machine.Pin(15,machine.Pin.OUT)
cs2 = machine.Pin(33,machine.Pin.OUT)
@whatnick
whatnick / DS1682_DeepSleep.ino
Created May 8, 2017
DS1682+ESP8266 based pulse counter with deepsleep
View DS1682_DeepSleep.ino
#include <Wire.h>
/* Comment this out to disable prints and save space */
//#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define DS1682_ADDR 0x6B
#define EVENT_COUNTER 0x09
@whatnick
whatnick / RealPowerMeter_NoWifi
Last active Aug 15, 2018
Real Power Measurement over Serial port for classice through-hole ADS1115 + NodeMCU Energy Monitor
View RealPowerMeter_NoWifi
/*
* This sketch sends ads1115 current sensor data via out over serial port.
* It needs the following libraries to work (besides the esp8266 standard libraries supplied with the IDE):
*
* - https://github.com/adafruit/Adafruit_ADS1X15
* - https://github.com/adafruit/Adafruit_SSD1306
* - https://github.com/adafruit/Adafruit-GFX-Library
*
* The above libraries can be directly installed via the Arduino IDE
*
View sensor_thingspeak.py
import time
from tentacle_pi.LM75 import LM75
import httplib, urllib
from time import localtime, strftime
lm = LM75(0x48,"/dev/i2c-1")
while(True):
temperature = lm.temperature()
print "temperature: %0.2f" % temperature
@whatnick
whatnick / test_LM75.py
Created Jul 10, 2016
Test LM75 temperature sensor
View test_LM75.py
import time
from tentacle_pi.LM75 import LM75
lm = LM75(0x48,"/dev/i2c-1")
temperature = lm.temperature()
print "temperature: %0.2f" % temperature
time.sleep(2)
@whatnick
whatnick / test_mpl3115.py
Last active Jul 21, 2016
Test MPL3115 barometer/altimeter using Python
View test_mpl3115.py
temp_raw_file = open('/sys/class/i2c-dev/i2c-1/device/1-0060/iio:device0/in_temp_raw','r')
temp_scale_file = open('/sys/class/i2c-dev/i2c-1/device/1-0060/iio:device0/in_temp_scale','r')
print "temperature: %.2f" %(int(temp_raw_file.read())*float(temp_scale_file.read()))
pres_raw_file = open('/sys/class/i2c-dev/i2c-1/device/1-0060/iio:device0/in_pressure_raw','r')
pres_scale_file = open('/sys/class/i2c-dev/i2c-1/device/1-0060/iio:device0/in_pressure_scale','r')
print "pressure: %.4f" %(int(pres_raw_file.read())*float(pres_scale_file.read()))
View trash_recog.py
'''
Created on Apr 24, 2016
@author: tisham
'''
import time
import requests
import cv2
import operator
import numpy as np
@whatnick
whatnick / Blink_7seg.ino
Last active Apr 19, 2016
Random number display on 7-segment LED
View Blink_7seg.ino
You can’t perform that action at this time.