Skip to content

Instantly share code, notes, and snippets.

View install.sh
$ 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 Sep 30, 2019
Custom HomeAssistant auth provider
View auth_provider.py
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
View gist:ca6ef785b4bcb4dde613cb5b7cf35f8d
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
View gist:053c17e48ca256699559d1c2604a3c22
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
View 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:

View alarm_clock.json
{
"rotation": 1,
"lines": [
{
"x1": 0,
"y1": 50,
"x2": 300,
"y2": 50
},
{
View bleeper_json.cpp
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;
View epaper_information_display_template.json
{
"background_color": "white",
"lines": [
{
"x1": 260,
"y1": 0,
"x2": 260,
"y2": 55
},
{
View gist:605bac2ca01e9a13b9f8a9df2a9c27c0
$ 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
View fast_ap_recreate.log
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