- A Relying Party: like github.com or google.com.
- A User Agent: a browser or smartphone.
- A Authenticator: security key manager.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #[macro_export] | |
| macro_rules! hash_map { | |
| ($($key:expr => $val:expr),* ,) => ( | |
| $crate::hash_map!($($key => $val),*) | |
| ); | |
| ($($key:expr => $val:expr),*) => { | |
| { | |
| let mut dict = ::std::collections::HashMap::new(); | |
| $( dict.insert($key, $val); )* | |
| dict |
If the pattern was strict, the tuples must have been evaluated to WHNF
forcing the whole list to be traversed before p x could be evaluated.
This would not work on infinite lists nor bottom values.
partition :: (a -> Bool) -> [a] -> ([a],[a])
partition p xs = foldr (select p) ([],[]) xs
where
select :: (a -> Bool) -> a -> ([a], [a]) -> ([a], [a])
select p x ~(ts,fs) | p x = (x:ts,fs)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::{cmp::Ordering, fmt::Debug, marker::PhantomData, ops::Add}; | |
| trait Nat { | |
| fn new() -> Self; | |
| fn usize() -> usize; | |
| } | |
| #[derive(Copy, Clone, PartialEq, Eq)] | |
| struct Z; |
Check nixpkgs/pkgs/build-support/trivial-builders.nix for more information about:
- runCommand / runCommandCC
- writeTextFile / writeTextDir
- writeScript / writeScriptBin
- writeShellScript / writeshellScriptBin
- writeShellApplication
- ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=c7d98a91435963f2cc8568b7dfd04366 | |
| use std::fmt::Debug; | |
| trait MyTrait { | |
| type R: Debug; | |
| fn get_r(&self) -> Box<Self::R>; | |
| } | |
| #[derive(Debug)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE RecordWildCards #-} | |
| module JsonSchema where | |
| import Control.Monad (unless, when, zipWithM_) | |
| import Data.Foldable (for_) | |
| import Data.Map.Strict (Map) | |
| import qualified Data.Map.Strict as Map | |
| import Data.Maybe (isJust, isNothing) | |
| type Key = String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {- | |
| coerceFirst :: (Coercible a b) => [f a] -> Maybe (f b) | |
| coerceFirst [] = Nothing | |
| coerceFirst (x:_) = Just (coerce x) | |
| * Couldn't match representation of type `f a' with that of `f b' | |
| arising from a use of `coerce' | |
| NB: We cannot know what roles the parameters to `f' have; | |
| we must assume that the role is nominal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE AllowAmbiguousTypes #-} | |
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# LANGUAGE RankNTypes #-} | |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| {-# LANGUAGE StandaloneKindSignatures #-} | |
| {-# LANGUAGE TypeApplications #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| {-# LANGUAGE TypeOperators #-} | |
| {-# LANGUAGE UndecidableInstances #-} |
Create file docker-compose.yml (fix the parameters to your configuration):
version: "3.9"
services:
bitcoin-core:
container_name: bitcoin-server
image: ruimarinho/bitcoin-core
command:
-printtoconsole