This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The MIT License (MIT) | |
// Copyright (c) 2019 Ha Thach for Adafruit Industries | |
#include "SdFat.h" | |
#include "Adafruit_SPIFlash.h" | |
// Uncomment to run example with custom SPI and SS e.g with FRAM breakout | |
// #define CUSTOM_CS A5 | |
// #define CUSTOM_SPI SPI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
# use long/lat at the end of the day to get the timezone, then correct each sleep date's time to UTC. | |
from timezonefinder import TimezoneFinder | |
import datetime | |
import pytz | |
# how to get offset from UTC from timezone name | |
pacific_now = datetime.datetime.now(pytz.timezone('US/Pacific')) | |
pacific_now.utcoffset().total_seconds()/60/60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <TinyWireM.h> | |
#include "SoftwareSerial.h" | |
byte ss=0, mi=0, hh=0, wd=6, dd=1, mo=1, yy=0; | |
const int Rx = 3; // this is physical pin 2 | |
const int Tx = 4; // this is physical pin 3 | |
SoftwareSerial mySerial(Rx, Tx); | |
void setup() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from datetime import datetime | |
from logging import INFO, Formatter, StreamHandler, getLogger | |
from urllib.error import HTTPError | |
import polars as pl | |
class Fetcher: | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file uses the sleep stress file's timestamp to convert each sleep row to its proper timezone | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import copy | |
stressFile = "cooked/Stress_Stress Score.csv" | |
sleepFile = "cooked/Sleep_sleep.csv" | |
# Each line in sleep has a few time-associated cols: (dateOfSleep, startTime, endTime) | |
# These are given in the timezone of the user's device and not in UTC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import os | |
import re | |
# We are loading in a data export from Fitbit. | |
allExports = "raw/" | |
curExport = [allExports+x for x in os.listdir(allExports) if os.path.isdir(allExports+x)][0] | |
curExport = curExport + "/" + [x for x in os.listdir(curExport) if os.path.isdir(curExport+"/"+x)][0] | |
print(f"Data export we're converting is \n\t{curExport}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import backtrader as bt | |
import pandas as pd | |
import time | |
############### Preprocess data | |
filename = "../data/BTC-USD_15min_2017-4-5.csv" | |
df = pd.read_csv(filename, header=0, parse_dates=['time'], index_col='time') | |
############### Create backtrader data feed, set up strategy and broker | |
# Create Cerebro backtesting instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.highlight-popup { | |
position: absolute; | |
background-color: #0044b3; | |
color: white; | |
padding: 4px; | |
border-radius: 4px; | |
z-index: 9999; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From the blog post andykong.org/blog/icloudconfusion/ | |
function boxTops(){ | |
HTMLCollection.prototype.toArray = function() { return Array.from(this); } | |
// Select all the time badges and parse out their total runtime in seconds | |
a = document.getElementsByClassName('video-text-badge').toArray() | |
b = a.map((x) => x.innerText) | |
c = b.map((y) => y.split(":").map((x) => parseInt(x))) | |
d = c.map((x) => x[0]*60 + x[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SerialLogger { | |
public String portname; | |
public String filename; | |
public Process p; | |
SerialLogger(String portname, String filename) { | |
this.portname = portname; | |
this.filename = sketchPath() + "/data/" + filename + ".csv"; | |
} |
NewerOlder