Skip to content

Instantly share code, notes, and snippets.

$ cat ~/code/me/dotfiles/install.sh
#!/bin/bash
set -eo pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ ! -e ~/.oh-my-zsh ]; then
echo "Installing oh-my-zsh..."
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
@sidoh
sidoh / auth_provider.py
Created September 30, 2019 08:11
Custom HomeAssistant auth provider
import logging
import jwt
from urllib.parse import urlparse
import urllib.request
from collections import OrderedDict
from typing import Any, Dict, Optional, cast
import voluptuous as vol
11:27 AM] sidoh: Hello! I’m working on a custom auth provider and have a commit I’d like to open a PR for, but wanted to sanity check here beforehand. The change is here: https://github.com/sidoh/home-assistant/commit/1c5bb8b0ef696532b8225e6ab6ceb8d42a74c2df. It’s just adding headers and cookies from the /auth/login_flow request to the flow context dict. The commit summarizes some scenarios where I think this would be useful.
(( sidebar -- I know custom auth providers aren’t directly supported yet; I’m just patching it into my home-assistant install right now to get this done. ))
[1:02 PM] balloob: @sidoh I don't fully see how headers would work, you would need to make your auth service aware of the auth provider
[1:02 PM] balloob: And then that one makes a POST request ?
[1:02 PM] balloob: because right now the POST request is made from the login page via JS
[1:03 PM] sidoh: Right, I discovered that as I was developing :slight_smile:
[1:03 PM] sidoh: In the second bullet, I think the header that'd be mo
11:27 AM] sidoh: Hello! I’m working on a custom auth provider and have a commit I’d like to open a PR for, but wanted to sanity check here beforehand. The change is here: https://github.com/sidoh/home-assistant/commit/1c5bb8b0ef696532b8225e6ab6ceb8d42a74c2df. It’s just adding headers and cookies from the /auth/login_flow request to the flow context dict. The commit summarizes some scenarios where I think this would be useful.
(( sidebar -- I know custom auth providers aren’t directly supported yet; I’m just patching it into my home-assistant install right now to get this done. ))
[1:02 PM] balloob: @sidoh I don't fully see how headers would work, you would need to make your auth service aware of the auth provider
[1:02 PM] balloob: And then that one makes a POST request ?
[1:02 PM] balloob: because right now the POST request is made from the login page via JS
[1:03 PM] sidoh: Right, I discovered that as I was developing :slight_smile:
[1:03 PM] sidoh: In the second bullet, I think the header that'd be mo
@sidoh
sidoh / keybase.md
Created June 6, 2019 00:26
keybase.md

Keybase proof

I hereby claim:

  • I am sidoh on github.
  • I am cmullins (https://keybase.io/cmullins) on keybase.
  • I have a public key ASDwxlkXkq5kiCoszaWGhprgYL95ZgX4c8Edk0EKoww4Owo

To claim this, I am signing this object:

@sidoh
sidoh / alarm_clock.json
Created May 30, 2019 06:08
alarm_clock.json
{
"rotation": 1,
"lines": [
{
"x1": 0,
"y1": 50,
"x2": 300,
"y2": 50
},
{
void HttpServer::handleUpdateSettings(RequestContext& request) {
JsonObject req = request.getJsonBody().as<JsonObject>();
if (req.isNull()) {
request.response.json["error"] = "Invalid JSON";
request.response.setCode(400);
return;
}
ConfigurationDictionary params;
{
"background_color": "white",
"lines": [
{
"x1": 260,
"y1": 0,
"x2": 260,
"y2": 55
},
{
$ curl http://10.133.8.158/gateways/1234/rgbw/\{1,2,3,4\}
[1/4]: http://10.133.8.158/gateways/1234/rgbw/1 --> <stdout>
--_curl_--http://10.133.8.158/gateways/1234/rgbw/1
{"color":{"r":255,"g":255,"b":255}}
[2/4]: http://10.133.8.158/gateways/1234/rgbw/2 --> <stdout>
--_curl_--http://10.133.8.158/gateways/1234/rgbw/2
{"color":{"r":255,"g":255,"b":255}}
[3/4]: http://10.133.8.158/gateways/1234/rgbw/3 --> <stdout>
--_curl_--http://10.133.8.158/gateways/1234/rgbw/3
@sidoh
sidoh / fast_ap_recreate.log
Created December 15, 2017 04:04
WiFi debug logs
287) wifi: mode=0
V (289) wifi: mode=0
V (291) wifi: type=8 p1=1 p2=254 p3=254 p4=0 p5=fefefefe
V (296) wifi: ioctl: sync
V (296) wifi: ioctl_process: flag=1 type=8 p1=1 p2=254 p3=254 p4=0 p5=fefefefe