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 datetime | |
# get the week of the year | |
week_number = datetime.datetime.now().isocalendar()[1] | |
print(f"Its the {week_number} week of the year") | |
# this is True every other week | |
should_update_users = week_number % 2 == 0 | |
if should_update_users: |
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 string | |
# mostly copied form here | |
# https://www.mathsisfun.com/numbers/cardinal-ordinal-chart.html | |
nth = { | |
1: "First", | |
2: "Second", | |
3: "Third", | |
4: "Fourth", | |
5: "Fifth", |
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 <ESP8266WiFi.h> | |
#include <EEPROM.h> | |
// networking and request related | |
int inputVal = 0; | |
int addr = 0; | |
int lastValue; | |
// networking and request related | |
void sendMessageToLambda(int currentState) { | |
// networking and request related |
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
// memory | |
#include <EEPROM.h> | |
// networking | |
#include <ESP8266WiFi.h> | |
#include <WiFiClientSecure.h> | |
#include <ESP8266WebServer.h> | |
#include <ESP8266HTTPClient.h> | |
#include <ArduinoJson.h> |
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 json | |
import boto3 | |
import datetime | |
import dateutil.tz | |
eastern = dateutil.tz.gettz('US/Eastern') | |
dynamodb = boto3.resource('dynamodb') | |
table = dynamodb.Table("<DOOR-STATE-TABLE-NAME>") | |
def lambda_handler(event, context): |
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 json | |
import boto3 | |
import decimal | |
import datetime | |
import calendar | |
class DecimalEncoder(json.JSONEncoder): | |
def default(self, o): | |
if isinstance(o, decimal.Decimal): | |
return float(o) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
const range = (start, end, length = end - start) => | |
Array.from({ length }, (_, i) => start + i); | |
const randomNumber = (min, max) => { | |
min = Math.ceil(min); | |
max = Math.floor(max); | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} | |
const points_in_circle = (r, n) => { |
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
### Keybase proof | |
I hereby claim: | |
* I am drbh on github. | |
* I am drbh (https://keybase.io/drbh) on keybase. | |
* I have a public key ASBjal2m3iJOdayg_el6CbiP0F7wTd4I23tUu64PeAkcGwo | |
To claim this, I am signing this object: |