Skip to content

Instantly share code, notes, and snippets.

View mcwitt's full-sized avatar

Matt Wittmann mcwitt

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mcwitt
mcwitt / wake-up-light-alarm-with-sunrise-effect.yaml
Created September 22, 2023 17:16 — forked from sbyx/wake-up-light-alarm-with-sunrise-effect.yaml
Home Assistant Blueprint: Wake-up light alarm with sunrise effect
blueprint:
name: Wake-up light alarm with sunrise effect
description: 'A wake-up light alarm with a brightness and color temperature sunrise
effect. Note: Requires date_time_iso sensor in configuration, not manually executable!'
domain: automation
input:
light_entity:
name: Wake-up light entity
description: The light to control. Turning it off during the sunrise will keep
it off. Color temperature range is auto-detected.
# mypy mypy_repro.py fails with
# mypy_repro.py:28: error: Incompatible return value type (got "Union[List[Bar], List[Baz]]", expected "List[A]") [return-value]
# no issues with pyright
# mypy --version: mypy 1.2.0 (compiled: yes)
from typing import List, TypeVar, Union
TFoo = TypeVar("TFoo", bound="Foo")
2023-03-19 18:20:12.8460000 [client] INFO Finding haskell-language-server
2023-03-19 18:20:12.8530000 [client] INFO Searching for server executables haskell-language-server-wrapper,haskell-language-server in $PATH
2023-03-19 18:20:12.8530000 [client] INFO $PATH environment variable: /nix/store/gxb3l954lhykfsx2rhcf97dj30rl7df7-glib-2.74.3-bin/bin:/run/wrappers/bin:/usr/bin:/usr/sbin:/nix/store/ib00bp5c7dqvxwsr7irrk1q5i1qi8hp2-emacs-git-with-packages-20230316.0/bin:/nix/store/k96lmwpdbffjpd4y7kjq8rlgzfb4jr5c-cabal-fmt-0.1.6/bin:/nix/store/rn4y8l2vwcq7wa34h1jgq105gydlcbqz-cabal-install-3.8.1.0/bin:/nix/store/xqwdr3bx1k90jqy0664xl9bafjk3ikmi-ghc-9.2.7/bin:/nix/store/cm6gxnfxg3i3ap07zj8w0iiwaw14z7ma-haskell-language-server-1.9.1.0/bin:/nix/store/c7p96yk0p9r90bk9fjf3iga80z4ljp9i-aeson-pretty-0.8.9/bin:/nix/store/wzpill8yp80lnrmcqwifkcfvhka822r2-ghcide-1.9.1.0/bin:/nix/store/mn1kywrh08i6lpjlc2c7gb5iy3wk8dlv-constraints-extras-0.3.2.1/bin:/nix/store/31qjybjsqmawms38r66gkmda8wwixamx-hie-bios-0.11.0/bin:/nix/store/13k3
@mcwitt
mcwitt / py3Dmol-mapping-demo.ipynb
Created March 6, 2023 20:29
Demo of using py3Dmol to visualize atom mappings
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mcwitt
mcwitt / fix.py
Last active February 26, 2023 20:30
Fixed-point combinator in Python
from functools import partial
def fix1(f, x):
return f(partial(fix1, f), x)
fact = lambda f, n: 1 if n <= 1 else n * f(n - 1)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Using existing settings (`complete_rings=True`, `connected_core=True`, `enforce_chiral=True`):
Py37:
[[20 20]
[32 18]
[27 31]
[15 12]
[ 4 7]
[16 13]
[ 1 4]
import traceback
from concurrent import futures
executor = futures.ProcessPoolExecutor(2)
def raise_if_42(n: int):
if n == 42:
raise Exception("got scary number")
return n
@mcwitt
mcwitt / build-log
Created August 5, 2022 16:12
Build log for python310Packages.tensorflow on x86_64-linux @ 8a8c18b
these 2 derivations will be built:
/nix/store/ly4bn6p4m3acfd7fr2qlh4p28fqc9c8v-tensorflow-2.9.1.drv
/nix/store/vf9knk42lipbjg5a4dwgh9cpd45jb3wr-python3.10-tensorflow-2.9.1.drv
building '/nix/store/ly4bn6p4m3acfd7fr2qlh4p28fqc9c8v-tensorflow-2.9.1.drv'...
unpacking sources
unpacking source archive /nix/store/p2ci1pc05lsl68awpqgs46k7y9jxw40s-source
source root is source
patching sources
configuring
patching script interpreter paths in configure