Skip to content

Instantly share code, notes, and snippets.

@edesilets
edesilets / mila_api_scratchpad.py
Created December 26, 2022 15:43 — forked from sanghviharshit/mila_api_scratchpad.py
Scratch pad for working with Milacares API for monitoring and controlling Mila air purifier. Read my blog post for more details - https://blog.sanghviharshit.com/reverse-engineering-private-api-ssl-pinning/
# 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
@edesilets
edesilets / nestSummaryToHeatPerHour.php
Created November 23, 2022 15:02
Just messing around trying to get total heating hours out of the google takeout nest summary.json file. What a pain in the ass.
<?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"
]);
@edesilets
edesilets / mailChimpDesignTemplate.html
Last active February 19, 2024 16:45
MailChimp basic 1 column template use to have Content and Design Panels
<!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>
@edesilets
edesilets / users.js
Created April 6, 2016 15:44
Updated express/app/models/user.js
'use strict';
const bcrypt = require('bcrypt');
const Knex = require("knex")({
client: "pg",
connection: {
host: "localhost",
user: "pi",
password: "password",
database: "homestatus"
@edesilets
edesilets / users.js
Created April 6, 2016 15:42
Abridged express/app/controllers/users.js
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) {
@edesilets
edesilets / user.js
Created April 6, 2016 14:12
Current Code express/app/models/user.js
// express/app/models/user.js
'use strict';
const bcrypt = require('bcrypt');
const Knex = require("knex")({
client: "pg",
connection: {
host: "localhost",
user: "pi",
password: "password",
@edesilets
edesilets / users.js
Created April 6, 2016 14:10
Code as it currently stands. express/app/controllers/users.js
// 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');
@edesilets
edesilets / package.son
Created April 1, 2016 20:58
My custom Package
{
"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": {
{ [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,
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'