Skip to content

Instantly share code, notes, and snippets.

View np's full-sized avatar

Nicolas Pouillard np

View GitHub Profile
@np
np / scene-after-n-minutes-after-last-motion-detected.yaml
Last active March 26, 2022 13:34
scene-after-n-minutes-after-last-motion-detected
blueprint:
name: Scene after n minutes after last motion detected
domain: automation
input:
motion_entity_group:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
@np
np / entity-light-switch-off-group-after-n-minutes-after-last-motion-detected.yaml
Last active March 26, 2022 12:45
entity-light-switch-off-group-after-n-minutes-after-last-motion-detected
blueprint:
name: Entity (light/switch) OFF group after n minutes after last motion detected
domain: automation
input:
motion_entity_group:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
@np
np / entity-light-switch-off-after-n-minutes-after-last-motion-detected.yaml
Created March 26, 2022 09:51
entity-light-switch-off-after-n-minutes-after-last-motion-detected
blueprint:
name: Entity (light/switch) OFF after N minutes after last motion detected
domain: automation
input:
motion_entity_group:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
@np
np / testpipeline.hs
Created February 15, 2018 10:58
A pipeline example using MonadJob
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
import Data.Aeson
type URL = String
newtype JobServerURL i o = JobServerURL URL
class Monad m => MonadJob m where
callJob :: (ToJSON i, FromJSON o) => JobServerURL i o -> i -> m o
@np
np / test.hs
Created February 15, 2018 10:45
Cleaning Async resources upon cancel
{-# LANGUAGE ScopedTypeVariables #-}
import Control.Concurrent
import Control.Concurrent.Async
import Control.Exception
main :: IO ()
main = do
let f = 1000000
v <- newMVar ()
let debug = withMVar v . const . putStrLn
@np
np / gist:cd5f005a4e802af1d0973b7899244210
Created October 26, 2017 13:12
Verifying that "np.id" is my Blockstack ID. https://onename.com/np
Verifying that "np.id" is my Blockstack ID. https://onename.com/np
@np
np / RTTI.hs
Created June 12, 2017 13:24 — forked from edsko/RTTI.hs
Run-time type information in Haskell
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
[
{"timestamp": "2016-06-10 08:50:00 UTC+00:00", "amount": "+100 satoshis", "to": "[email protected]",
"desc": "You submitted work through the 21 Bitcoin Computer."},
{"timestamp": "2016-06-10 08:50:00 UTC+00:00", "amount": "+5 satoshis", "to": "[email protected]", "from": "[email protected]",
"desc": "You sold 'http://10.244.165.172:6002/?uri=21.co' to 21dotco"}
]
@np
np / timestamps
Last active October 26, 2015 11:49
c691e1b19a5e46d63eeaa37a455b6e74de9890ee
d6b02c6055b6bd4253ced4b0ad91070481032c76
Verifying I am +np on my passcard. https://onename.com/np