This file contains hidden or 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
# Scratch pad for working with Milacares API for monitoring and controlling their air purifier devices. | |
# Based on the code from https://www.stefaanlippens.net/oauth-code-flow-pkce.html for PKCE code verifier and challenge. | |
import base64 | |
import hashlib | |
import html | |
import json | |
import os | |
import re | |
import urllib.parse |
This file contains hidden or 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
<?php | |
class MonthlySummary extends Summary { | |
public function __toString(): string | |
{ | |
return implode("\n", [ | |
'-------------------------- MONTHLY REPORT --------------------------', | |
'Month of ' . $this->date . ' contained ' . $this->cycleCounts . ' Heating cycles.', | |
'For a total of ' . $this->heatingInHours() . " hours.", | |
"\n" | |
]); |
This file contains hidden or 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<!doctype html> | |
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> | |
<head> | |
<!-- NAME: 1 COLUMN --> | |
<!--[if gte mso 15]> | |
<xml> | |
<o:OfficeDocumentSettings> | |
<o:AllowPNG/> | |
<o:PixelsPerInch>96</o:PixelsPerInch> |
This file contains hidden or 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
'use strict'; | |
const bcrypt = require('bcrypt'); | |
const Knex = require("knex")({ | |
client: "pg", | |
connection: { | |
host: "localhost", | |
user: "pi", | |
password: "password", | |
database: "homestatus" |
This file contains hidden or 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 changepw = (req, res, next) => { | |
debug('Changing password'); | |
let credentials = req.body.passwords; | |
let search = { | |
id: req.params.id, | |
token: req.currentUser.token, | |
}; | |
new User(search).fetch() | |
.then((data) => { | |
if (data) { |
This file contains hidden or 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
// express/app/models/user.js | |
'use strict'; | |
const bcrypt = require('bcrypt'); | |
const Knex = require("knex")({ | |
client: "pg", | |
connection: { | |
host: "localhost", | |
user: "pi", | |
password: "password", |
This file contains hidden or 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
// express/app/controllers/users.js | |
'use strict'; | |
const debug = require('debug')('thermal-monitor:users'); | |
const controller = require('express/lib/wiring/controller'); | |
const models = require('express/app/models'); | |
const User = models.user; | |
const crypto = require('crypto'); |
This file contains hidden or 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
{ | |
"name": "thermal-comfort-system-api", | |
"version": "1.0.0", | |
"private": true, | |
"description": "Packages for my Thermal comfort system project", | |
"main": "index.js", | |
"scripts": { | |
"start": "./express/bin/express server" | |
}, | |
"repository": { |
This file contains hidden or 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
{ [error: SELEC FROM "user" AS "user" - syntax error at or near "SELEC"] | |
name: 'error', | |
length: 86, | |
severity: 'ERROR', | |
code: '42601', | |
detail: undefined, | |
hint: undefined, | |
position: '1', | |
internalPosition: undefined, | |
internalQuery: undefined, |
This file contains hidden or 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 Knex from 'knex' | |
import _ from 'lodash' | |
import camelize from 'camelize' | |
import WaterlineSequel from 'waterline-sequel' | |
import KnexPostgis from 'knex-postgis' | |
import WaterlineError from 'waterline-errors' | |
import AdapterError from './error' | |
import Util from './util' | |
import SpatialUtil from './spatial' |
NewerOlder