Open18
《スクラップ・リサイクラー》
SaaS
開発
- https://www.postman.com/
- auth0
- circleci
- sentry
- codecov
- https://github.com/marketplace
- https://smartbear.com/test-management/zephyr/
- https://zenn.dev/seya/articles/eb03a550b7f19b
- https://console.cloud.google.com/healthcare/marketplace(cameo:browse)?project=duxca-298210&filter=category:health
- https://console.cloud.google.com/marketplace/browse?filter=category:health&project=duxca-298210
- https://www.datadoghq.com/ja/customers/
- https://qiita.com/mouse_484/items/394a4984f749cc201422 gitpod
db
- https://www.prisma.io/
- https://zenn.dev/tak_iwamoto/articles/b27151d22d9e6a planetscale
- https://vitess.io/
オーケストレーション
- https://www.integromat.com/en/integrations
- https://zapier.com/explore
- https://automate.io/integrations
- https://github.com/huginn/huginn
データ
可視化
課金
- stripe
IaaC
脱中央集権的アーキテクチャ
- 真のサーバーレスに一段近づけるフロントエンドアーキテクチャーの話 - https://zenn.dev/teatwo/articles/efb99ea52876fb
- https://www.unisonweb.org/
- https://github.com/seed-rs/awesome-seed-rs
- https://github.com/lunatic-solutions/lunatic
- https://github.com/yatima-inc
- https://github.com/Uniswap/uniswap-interface
- matrix
- https://ipfs.io/team/
wasmtime
wasmer
ipfs
- https://ipfs-book.decentralized-web.jp/naming_contents/
- https://docs.ipfs.io/how-to/command-line-quick-start/#ipfs-companion
- https://blog.ipfs.io/2020-03-18-announcing-rust-ipfs/
- https://areweipfsyet.rs/
- https://docs.ipfs.io/how-to/command-line-quick-start/#take-your-node-onlinehttps://docs.ipfs.io/how-to/command-line-quick-start/#take-your-node-online
- https://peergos.org/
tor
dapp
アンチョコ
全コミットから文字列検索する
git grep 【キーワード】 $(git rev-list --all)
202x 年代に生きる上で認識を革めるべきこと
政治・経済・社会
- 中国はいまや米国に匹敵する経済規模を持つ超大国であること
- 日本はもはや世界第三位の経済大国ですらないこと
- 日本の高齢化は負荷逆に進み今後若者はますます希少になること
- 海外の物価が上がり続けているので外貨を稼がない限り海外旅行にいくことすら困難になること
コンピュータ・IT・AIoT
- クラウド SaaS 化が進み、ローコードでますます大きな価値を生み出せるようになっていること
- プログラミング言語やフレームワークに依存する技術者は世界一レベルの専門性を持たない限り生き残れないこと
- リアル人生とネット人生という区分は時代錯誤も甚だしく、リアルとインターネットは融合するということ(IoT 含む)
- AI学習のイテレーションを早く回して現実に適応するほど価値が生まれること
- 人工知能(無能ではない) bot の作成が当たり前になること
- 低速回線で Vim を使うよりも高速回線で Cloud Shell や vscode-online を使うほうが開発効率がよくなること
- クラウドの寡占が進むことで(逆説的に)クライアントサイド技術への投資が進むこと
モナドはテストできないから使うべきではない
async fn hoge(){
let a = io1().await;
let b = if ... {
Some(io2(a).await)
} else { None };
let c = io3(b).await;
Ok(c)
}
みたいなモナディックな関数はテストできない
fn hoge() -> impl Future<Outut=Result<_, _>> {
io1().and_then(pure1).and_then(io2).and_then(pure2).and_then(io3)
}
のようなアプリカティブな形に書き下すべきである
すると
iot1, io2, io3, および pure1, pure2 はそれぞれ unit test が書けるようになる
use futures::Future;
use futures::FutureExt;
use futures::future::TryFutureExt;
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
let d = source()
.then(|o| futures::future::ready(pure1(o)))
.and_then(|o| { unite(o, io1, io2).map(Ok) })
.then(|o| futures::future::ready(pure2(o.unwrap())))
.and_then(|o|{
sink(o).map(Ok)
})
.then(|o| futures::future::ready(pure3(o.unwrap())))
.await;
let ret = source().await;
let b = pure1(ret)?;
let ret = unite(b, io1, io2).await;
let c = pure2(ret)?;
let ret = sink(c).await;
let d = pure3(ret)?;
Ok(())
}
fn unite<L, R, L2, R2, FL, FR>(
o: either::Either<L, R>,
io1: impl FnOnce(L) -> FL,
io2: impl FnOnce(R) -> FR,
) -> impl Future<Output=either::Either<L2, R2>,>
where
FL: Future<Output=L2>,
FR: Future<Output=R2>,
{
match o {
either::Either::Left(o)=>
futures::future::Either::Left(
io1(o)
.map(either::Either::<L2, R2>::Left)),
either::Either::Right(o)=>
futures::future::Either::Right(
io2(o)
.map(either::Either::<L2, R2>::Right)),
}
}
struct SourceRes{}
#[derive(thiserror::Error, Debug)]
#[error("")]
struct SourceError{}
fn source(
) -> impl Future<Output=Result<SourceRes, SourceError>> {
futures::future::ready(Ok(SourceRes{}))
}
fn pure1(o: Result<SourceRes, SourceError>) -> Result<either::Either<Io1Req, Io2Req>, anyhow::Error> {
o.map(|_| either::Either::Left(Io1Req{})).map_err(|_| anyhow::anyhow!(""))
}
struct Io1Req{}
struct Io1Res{}
#[derive(thiserror::Error, Debug)]
#[error("")]
struct Io1Error{}
fn io1(o: Io1Req) -> impl Future<Output=Result<Io1Res, Io1Error>> {
futures::future::ready(Ok(Io1Res{}))
}
struct Io2Req{}
struct Io2Res{}
#[derive(thiserror::Error, Debug)]
#[error("")]
struct Io2Error{}
fn io2(o: Io2Req) -> impl Future<Output=Result<Io2Res, Io2Error>> {
futures::future::ready(Ok(Io2Res{}))
}
fn pure2(o: either::Either<Result<Io1Res, Io1Error>, Result<Io2Res, Io2Error>>) -> Result<SinkReq, anyhow::Error> {
match o {
either::Either::Left(o) => o.map(|_| SinkReq{}).map_err(|_| anyhow::anyhow!("")),
either::Either::Right(o) => Err(anyhow::anyhow!("")),
}
}
struct SinkReq{}
struct SinkRes{}
#[derive(thiserror::Error, Debug)]
#[error("")]
struct SinkError{}
fn sink(o: SinkReq) -> impl Future<Output=Result<SinkRes, SinkError>> {
futures::future::ready(Ok(SinkRes{}))
}
fn pure3(o: Result<SinkRes, SinkError>) -> Result<(), anyhow::Error> {
o.map(|_| ()).map_err(|_| anyhow::anyhow!(""))
}
うーん
frunk の coproduct を使いつつ
(futureのthenを使わずに)独自型のメソッド呼び出しで関数合成っぽく書いていく
Context::new()
.a() // 実質 Into
.b(opt) // io は Future
.await? // Result<_, anyhow::Error>
.c() // Copro!(A, B)
.fold(hlist![ //条件分岐
|o|async move{
...
Ok(())
},
|o|async move{
...
Ok(())
},
])
.await?
.fin()
info
- https://www.bigocheatsheet.com/
- https://visualgo.net/en
- https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
- https://qiita.com/hatoo@github/items/fa14ad36a1b568d14f3e
- https://qiita.com/hatoo@github/items/5c6814e72ddd2ecaf48f
- https://zenn.dev/kawahara/scraps/5482ab07ffb39e
- https://github.com/qryxip/cargo-compete
- https://zenn.dev/kawahara/scraps/5a22db01d86ec9
- https://atcoder.jp/contests/typical90
- https://strangerxxx.hateblo.jp/entry/20200221/1582289855
- https://github.com/rust-lang-ja/atcoder-rust-resources/wiki/2020-Update
- https://github.com/tanakh/cargo-atcoder
- https://github.com/hatoo/cargo-snippet
- https://crates.io/crates/argio
- https://qiita.com/tanakh/items/73114d3c8402e90912b4
- https://github.com/rust-lang-ja/atcoder-rust-resources/wiki/Crates-2019
- https://blog.ymgyt.io/entry/proconio_input_macro
- https://qiita.com/maguro_tuna/items/b4472d7497eac57fc101
- https://crates.io/crates/argio
- おすすめ - https://qiita.com/masakinihirota/items/d1ffac54e70a1adf084c
- 過去問 いわゆる abc(AtCoder Beginner Contest) 問題 - https://kenkoooo.com/atcoder/#/table/
- 問題ランク: ABC << 知識の壁 << D << 発想の壁 << E << 専門知識の壁 << F
-
https://mobile.twitter.com/chokudai/status/986561875344158720/photo/1
- 白とオレンジだけでよい
- atcoder の色 - https://qiita.com/drken/items/8a6f139158cde8a61dce
- 灰 < 茶 << プロの壁 << 緑 < 水 << 業務最強の壁 << 青 << 研究者の壁 << 黄 < 橙 << 世界ランクの壁 << 赤
- 初級 - https://qiita.com/drken/items/2f56925972c1d34e05d8
- 中級 - https://qiita.com/drken/items/e77685614f3c6bf86f44
- leetcode - https://leetcode.com/problemset/all/
- しゃくとり法
- 計算量
- 最短経路 [ダイクストラ, ベルマンフォード, ワーシャルフロイド]
- 問題の解き方
- https://note.com/kirimin_chan/n/n889ec80b6fbc
libs
- https://github.com/rust-lang-ja/ac-library-rs/blob/master/src/
- https://github.com/rust-lang-ja/atcoder-rust-resources/wiki/提案から外すクレート
- https://docs.rs/algonium/0.1.0/algonium/
- https://docs.rs/algonium/0.1.0/algonium/math/index.html
- https://docs.rs/algonium/0.1.0/algonium/data_structure/struct.BIT.html
- https://docs.rs/algonium/0.1.0/algonium/data_structure/struct.UnionFind.html
- https://docs.rs/contest-algorithms/0.3.0/contest_algorithms/
- https://docs.rs/contest-algorithms/0.3.0/contest_algorithms/math/num/fn.fast_gcd.html
- https://docs.rs/contest-algorithms/0.3.0/contest_algorithms/math/fn.factorize.html
- https://docs.rs/contest-algorithms/0.3.0/contest_algorithms/math/fft/index.html
- https://docs.rs/contest-algorithms/0.3.0/contest_algorithms/math/fn.is_prime.html
- https://docs.rs/contest-algorithms/0.3.0/contest_algorithms/order/fn.merge_sort.html
- https://docs.rs/competitive-hpp/0.10.23/competitive_hpp/
- https://docs.rs/competitive-hpp/0.10.23/competitive_hpp/modulo/index.html
- https://docs.rs/competitive-hpp/0.10.23/competitive_hpp/union_find/index.html
- https://docs.rs/competitive-hpp/0.10.23/competitive_hpp/prime/eratosthenes/index.html
- https://docs.rs/prcn_lib/0.3.1/prcn_lib/binary_search/fn.binary_search.html
- https://docs.rs/prcn_lib/0.3.1/prcn_lib/graph/fn.make_directed_graph.html
- https://docs.rs/prcn_lib/0.3.1/prcn_lib/math/fn.scale_dight.html
- https://docs.rs/prcn_lib/0.3.1/prcn_lib/math/fn.dight_vec.html
- https://docs.rs/competitive-programming-rs/34.0.0/competitive_programming_rs/data_structure/segment_tree/index.html
- https://docs.rs/competitive-programming-rs/34.0.0/competitive_programming_rs/data_structure/suffix_array/index.html
- https://docs.rs/competitive-programming-rs/34.0.0/competitive_programming_rs/data_structure/bitset/index.html
- https://docs.rs/competitive-programming-rs/34.0.0/competitive_programming_rs/math/determinant/index.html
- https://docs.rs/competitive-programming-rs/34.0.0/competitive_programming_rs/string/z_algorithm/z_algorithm/index.html
- https://docs.rs/competitive-programming-rs/34.0.0/competitive_programming_rs/graph/maximum_flow/index.html
- https://github.com/kenkoooo/competitive-programming-rs/blob/HEAD/src/math/chinese_remainder_theorem.rs
- https://github.com/kenkoooo/competitive-programming-rs/blob/HEAD/src/graph/topological_sort.rs
- https://github.com/kenkoooo/competitive-programming-rs/blob/HEAD/src/geometry/convex_hull.rs
- https://github.com/hatoo/competitive-rust-snippets/blob/master/src/math.rs
- https://github.com/hatoo/competitive-rust-snippets/blob/master/src/modulo.rs
- https://docs.rs/fenwick/1.0.0/fenwick/
- https://docs.rs/fenwick-tree/0.1.0/fenwick_tree/
- https://docs.rs/ascii/1.0.0/ascii/
- https://docs.rs/prcn_lib/0.3.1/prcn_lib/
- https://docs.rs/arrayvec/0.7.1/arrayvec/
- https://docs.rs/im/15.0.0/im/
- https://docs.rs/slab/0.4.4/slab/
- https://docs.rs/ordered-float/2.8.0/ordered_float/
- https://github.com/kenkoooo/rust-programming-contest-solutions/tree/master/atcoder
- https://github.com/iwiwi/programming-contests
- https://github.com/hatoo/competitive-rust-snippets/tree/master/src
- https://github.com/weihanglo/rust-algorithm-club
- https://github.com/TheAlgorithms/Rust
- https://docs.rs/num/0.4.0/num/integer/fn.gcd.html
- https://docs.rs/primes/0.3.0/primes/fn.factors.html
- https://docs.rs/num/0.4.0/num/integer/fn.lcm.html
- https://docs.rs/num/0.4.0/num/integer/fn.gcd.html
funcs
- https://doc.rust-lang.org/std/macro.matches.html
- https://doc.rust-lang.org/std/primitive.u8.html#method.checked_add
- https://doc.rust-lang.org/std/primitive.slice.html#method.chunks
- https://doc.rust-lang.org/std/primitive.slice.html#method.repeat
- https://doc.rust-lang.org/std/primitive.slice.html#method.sort
- https://doc.rust-lang.org/std/primitive.slice.html#method.sort_unstable
- https://doc.rust-lang.org/std/primitive.slice.html#method.sort_by_cached_key
- https://doc.rust-lang.org/std/vec/struct.Vec.html#method.group_by
- https://doc.rust-lang.org/std/vec/struct.Vec.html#method.sort_by_key
- https://doc.rust-lang.org/std/vec/struct.Vec.html#method.binary_search
- https://doc.rust-lang.org/std/vec/struct.Vec.html#method.binary_search_by
- https://doc.rust-lang.org/std/vec/struct.Vec.html#method.contains
- https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.copied
- https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.cloned
- https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.any
- https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.all
- https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.rev
- https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.step_by
- https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.product
- https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.partition
- https://docs.rs/itertools/0.10.1/itertools/trait.Itertools.html#method.powerset
- https://docs.rs/itertools/0.10.1/itertools/trait.Itertools.html#method.cartesian_product
- https://docs.rs/itertools/0.10.1/itertools/trait.Itertools.html#method.multi_cartesian_product
- https://docs.rs/itertools/0.10.1/itertools/trait.Itertools.html#method.permutations
- https://docs.rs/itertools/0.10.1/itertools/trait.Itertools.html#method.combinations
- https://docs.rs/itertools/0.10.1/itertools/trait.Itertools.html#method.combinations_with_replacement
- https://docs.rs/itertools/0.10.1/itertools/trait.Itertools.html#method.group_by
- https://docs.rs/itertools/0.10.1/itertools/trait.Itertools.html#method.tee
- https://docs.rs/itertools/0.10.1/itertools/trait.Itertools.html#method.unique
- https://docs.rs/itertools-num/0.1.3/itertools_num/trait.ItertoolsNum.html#method.cumsum
- https://docs.rs/superslice/1.0.0/superslice/trait.Ext.html#tymethod.next_permutation
- https://docs.rs/superslice/1.0.0/superslice/trait.Ext.html#tymethod.prev_permutation
fn main() {
use itertools::Itertools; // 0.10.1
for a in 0..=1 {
for b in 0..=1 {
for c in 0..=1 {
for d in 0..=1 {
println!("prmtv:{:?}", (a, b, c, d));
}
}
}
}
for item in (0..=1).cartesian_product(0..=1).cartesian_product(0..=1).cartesian_product(0..=1) {
println!("prd2:{:?}", item);
}
for item in (1..=4).map(|_| 0..=1).multi_cartesian_product() {
println!("prdm:{:?}", item);
}
for item in (0..=2).permutations(3) {
println!("perm:{:?}", item);
}
for item in (0..=2).combinations(2) {
println!("comb:{:?}", item);
}
for item in (0..=2).combinations_with_replacement(2) {
println!("comb_r:{:?}", item);
}
let idx = vec![1,3,5,7].binary_search_by(|o|{ o.cmp(&3) });
assert_eq!(idx, Ok(1));
let idx = vec![1,3,5,7].binary_search_by(|o|{ o.cmp(&2) });
assert_eq!(idx, Err(1));
let idx = vec![1,3,5,7].binary_search_by(|o|{ o.cmp(&6) });
assert_eq!(idx, Err(3));
let target = 10;
let kuji = vec![1,3,5,7];
for item in (1..=4).map(|_| kuji.iter()).multi_cartesian_product() {
if item.iter().copied().sum::<i32>() == target {
println!("kujiprm:{:?}", item);
}
}
let mut fin = false;
for fst in kuji.iter().rev() {
if fin { break; }
let snd_acceptable = target - fst - 2;
let _ = kuji.binary_search_by(|snd|{
if fin { return std::cmp::Ordering::Equal; }
// println!("{} <= {} | {}", snd, snd_acceptable, fst);
if snd <= &snd_acceptable {
let trd_acceptable = target - (fst + snd) - 1;
let _ = kuji.binary_search_by(|trd|{
// if fin { return std::cmp::Ordering::Equal; }
// println!("{} <= {} | {}", trd, trd_acceptable, fst + snd);
if trd <= &trd_acceptable {
let fth = target - (fst + snd + trd);
if kuji.binary_search(&fth).is_ok() {
println!("kujibin:{:?}", (fst, snd, trd, fth));
fin = true;
return std::cmp::Ordering::Equal;
}
}
trd.cmp(&trd_acceptable)
});
}
snd.cmp(&snd_acceptable)
});
}
println!("kujibin:{:?}", fin);
assert_eq!(vec![1,7,3,4].iter().copied().min(), Some(1));
assert_eq!(vec![1,7,3,4].iter().copied().max(), Some(7));
assert_eq!(vec![1.0,7.0,3.0,4.0_f32].iter().copied().reduce(f32::min), Some(1.0));
assert_eq!(vec![1.0,7.0,3.0,4.0_f32].iter().copied().reduce(f32::max), Some(7.0));
assert_eq!(vec![1,7,3,4].iter().copied().minmax().into_option(), Some((1, 7)));
assert_eq!(vec![1.0,7.0,3.0,4.0_f32].iter().copied().minmax().into_option(), Some((1.0, 7.0)));
assert_eq!((1..10).step_by(2).collect::<Vec<_>>(), vec![1,3,5,7,9]);
}
strucs
- https://qiita.com/ngtkana/items/7d50ff180a4e5c294cb7
- https://docs.rs/petgraph/0.6.0/petgraph/unionfind/struct.UnionFind.html
- https://docs.rs/pathfinding/2.2.1/pathfinding/directed/dijkstra/fn.dijkstra.html
- https://docs.rs/petgraph/0.6.0/petgraph/algo/dijkstra/fn.dijkstra.html
- https://doc.rust-lang.org/std/collections/btree_map/struct.BTreeMap.html#method.range
- https://doc.rust-lang.org/std/collections/struct.BinaryHeap.html
- https://doc.rust-lang.org/std/collections/struct.LinkedList.html
- https://docs.rs/radix_trie/0.2.1/radix_trie/
- https://docs.rs/rayon/1.5.1/rayon/slice/trait.ParallelSliceMut.html#method.par_sort
- https://docs.rs/rayon/1.5.1/rayon/slice/trait.ParallelSliceMut.html#method.par_sort_unstable_by
- https://doc.rust-lang.org/std/collections/struct.BTreeMap.html
- https://doc.rust-lang.org/std/collections/vec_deque/struct.VecDeque.html
- https://docs.rs/rayon/1.5.1/rayon/collections/index.html
- https://docs.rs/rayon/1.5.1/rayon/iter/trait.ParallelIterator.html
- https://docs.rs/min-max-heap/1.3.0/min_max_heap/
- https://docs.rs/multimap/0.8.3/multimap/
- https://docs.rs/predicates/2.0.2/predicates/
- https://docs.rs/indexmap/1.7.0/indexmap/
- https://tikv.org/deep-dive/key-value-engine/b-tree-vs-lsm/
// AtCoder ABC 131 C - Anti-Division
fn main() {
use num; // 0.4.0
let a = 4;
let b = 9;
let c = 2;
let d = 3;
let ans = 2;
assert_eq!(calc2(a,b,c,d), ans);
let a = 314159265358979323_u64;
let b = 846264338327950288_u64;
let c = 419716939_u64;
let d = 937510582_u64;
let ans = 532105071133627368_u64;
let ret = calc2(a,b,c,d);
assert_eq!(ret, ans);
}
fn calc(a: u64, b: u64, c: u64, d: u64) -> u64 {
let mut count = 0;
for i in a..=b {
if i % c != 0 && i % d != 0 { count += 1; }
}
count
}
fn calc2(a: u64, b: u64, c: u64, d: u64) -> u64 {
dbg!(f(b, c, d)) - dbg!(f(a-1, c, d))
}
fn f(x: u64, c: u64, d: u64) -> u64 {
let lcm = num::integer::lcm(c, d);
x - x/c - x/d + x/lcm
}
- lexer generator
- 字句解析器生成器
- parser generator
- 構文解析器生成器
- lex - https://en.wikipedia.org/wiki/Lex_(software)
- lexer プログラム
- lex file という形式で書く
- flex という後継プロジェクトがある - https://en.wikipedia.org/wiki/Flex_(lexical_analyser_generator)
- Yacc https://en.wikipedia.org/wiki/Yacc
- LALR アルゴリズムに基づくパーサジェネレータ
- PEG - https://en.wikipedia.org/wiki/Parsing_expression_grammar
- BNF - 文脈自由文法を記述するメタ構文
- Parsec - https://wiki.haskell.org/Parsec
- LL1 アルゴリズムに基づくモナディックパーサコンビネータ
- 入力文法表記
- BNF
- Yacc
- PEG
- https://tryunoo.hatenablog.com/entry/2017/10/25/211646
- https://ayataka00.hatenablog.jp/entry/2018/07/09/181700
- https://linuxhint.com/nmap_scan_ip_ranges/
- https://mikeda.hatenablog.com/entry/20090314/1237108855
sudo apt install arp-scan nmap hydra
arp-scan
hydra -l root -P password 172.24.25.119 http-get /
-
sudo apt changelog vim
- 更新履歴 -
sudo apt clean
- deb パッケージの削除 -
sources.list
- パッケージの取得元 -
apt.conf
- apt の設定 -
preferences
-man apt_preference
sudo apt install vim:arm6
DI パターン
3 層レイヤードアーキテクチャを考える
IO <-> DomainLogic <-> Service
DIしない階層アーキテクチャの場合
依存関係はこう
IO <- DomainLogic <- Service
型を書くとこう
struct IOA {}
impl IOA { fn new()-> Self{ .. } }
struct DomainLogicA { io_a: IOA }
impl DomainLogicA { fn new()-> Self{ .. } }
struct ServiceA {dom_a: DomainLogicA}
impl ServiceA { fn new()-> Self{ ...} }
DIする場合
コンストラクタパターン
- https://qiita.com/Kuniwak/items/59106fbb02623393b494
- https://blog-dry.com/entry/2021/12/26/002649#レイヤードアーキテクチャ
依存関係の順番はこう
IO -> DomainLogic <- Service
型を書くとこう
trait IOA {}
struct DomainLogicA { io_a: Arc<dyn IOA> }
impl DomainLogicA { fn new(io_a: impl IOA)-> Self{ .. } }
struct ServiceA { dom_a: DomainLogicA }
impl ServiceA { fn new(io_a: impl IOA)-> Self{ .. } }
Cake Pattern (Keen Pattern)
trait UserDao {...}
trait HaveUserDao {
type UserDao: UserDao;
fn user_dao(&self) -> Self::UserDao;
}
struct UserService<U>{U);
impl<U:UserDao> UserService<U> {
pub fn get_user_by_id(&self, id: i32) -> Result<Option<User>> {
self.0.find_user(id)
}
}
Cake Pattern
trait UserDao {...}
struct UserService<U>{U);
impl<U: UserDao> UserService<U> {
pub fn get_user_by_id(&self, id: i32) -> Result<Option<User>> {
self.0.find_user(id)
}
}
functional
// DI コンテキスト, 依存性注入はここでする
struct SrvACtx {
lambda: Lambda,
dynamodb: DynamoDb,
logger: Logger,
}
// 引数
struct SrvAReq {
hoge: String,
huga: String
}
// 正常な返り値
struct SrvARes {}
// リトライしろ、等
struct SvcAErr {}
// anyhow::Error は事前条件が満たされなかった等の panic 相当の例外
async fn srv_a(ctx: SrvACtx, req: ServiceAReq) -> Result<Result<SvcARes, SvcAErr>, anyhow::Error> {
todo!()
}
Tagless Final
Free Monad
todo
契約駆動設計 Design By Contract
事前条件(requires)
不変条件(invariant)
事後条件(ensures)
ホーア論理
- https://ja.wikipedia.org/wiki/ホーア論理
- https://www.slideshare.net/kmt-t/design-by-contract-13258283
- https://www.slideshare.net/tednag/hoare
-
{P} C {Q}
: Hoare Triple- P: 事前条件
- Q: 事後条件
- C: コード
定理証明系
lean
- https://leanprover.github.io/theorem_proving_in_lean/
- https://leanprover-community.github.io//img/lean-tactics.pdf
- https://leanprover-community.github.io/learn.html
- https://leanprover.github.io/theorem_proving_in_lean4/axioms_and_computation.html
- https://leanprover.github.io/lean4/doc/dev/index.html
- https://agentultra.github.io/lean-for-hackers/
- https://leanprover.github.io/documentation/
- https://www.ma.imperial.ac.uk/~buzzard/xena/natural_number_game/?world=2&level=1
- https://leanprover-community.github.io/learn.html
syslog rsyslog journald 違い
syslog 用法
- 通信プロトコル
- ログフォーマット
- ログ転送集約システム
- linuxシステムの全体のログ
syslog 歴史
- https://logstorage.com/case/syslog/
- 1980 最初のソフトウェア(syslogd の原型)が作られる
- 1998 syslog-ng 開発開始
- 2001 syslog 実装が仕様として文書化された
- 2004 rsyslog 開発開始
- 2009 syslog の仕様が整理されマトモになった
- 2010 最初の systemd リリース
syslog
- 昔使われてたログ転送システム
- デーモンのログをファイルに保存する
- UDPで他のサーバに転送できる
syslogd
- syslog 実装のデファクト
- ログローテーションすらない
- https://atmarkit.itmedia.co.jp/ait/articles/0807/15/news131.html
syslog-ng
- syslogd の改良版、rsyslogの対抗候補だった
- 最低限の機能がついた
- https://atmarkit.itmedia.co.jp/ait/articles/0807/15/news131_3.html
rsyslog
- syslogd の改良版
- 転送が TCP、 TLS暗号化、圧縮、ログフィルタリングなどがついた
- https://atmarkit.itmedia.co.jp/ait/articles/0810/31/news147.html
systemd-journald
- デーモン管理が systemd 化されたときに導入された
-
- ログファイルはバイナリ
- 著名なディストリビューションでは互換性を保つため journald の出力を rsyslog が参照するように構成されている
- https://isleofhoso.com/diff-journald-rsyslog/
- https://gihyo.jp/admin/serial/01/ubuntu-recipe/0546
PPPって何
Serial Line Internet Protocol
- 1984 標準化
- 何らかの通信回線(電話回線など)からインターネットにつなぐプロトコル
- IP をもらうしくみ
- 誤り訂正がない
Point-to-Point Protocol
- 1992 SLIP の後継で作られた
- 特にダイヤルアップ(電話)回線でインターネットにつなぐためにつかう
- モデムを介してISPに電話して認証もらってIPをもらうプロトコル
PPPoE
- 「(何らかの通信回線で)認証もらってIPをもらうプロトコル」の何らかの通信回線が Ethernet になった
- ADSL時代に電話回線ごしに ISP と通信できるようになったが、ここで IP を振るのに使われるようになった
- Ethernet 単体でも IP が扱えるが PPPの「認証もらってIPをもらうプロトコル」だけが生き残った
- 光回線でもそのまま使われている
ADSL
- 既存のアナログ電話回線でISPと通信するしくみ
- IP をふるのに PPPoE を使った
ISDN
- ADSL がアナログ電話回線をつかってたので電話回線をデジタル化したもの
- 光ファイバーに負けた
IPv6 PPPoE
- NTTフレッツ網(NGN) 経由でIPv6 を割り当てるプロトコル
- NGNが整備されたことで ISDN は滅んだ
SORACOM の SIM ドングルで PPP を使う理由
- SIMカードを使って携帯電話回線(3G,LTE,5G)から携帯電話にIPを振るのに使ってる
参考資料
- https://www.cresc.co.jp/tech/network/NET_TUTORIAL/Section_20.htm
- https://ja.wikipedia.org/wiki/PPPoE
- https://ja.wikipedia.org/wiki/Serial_Line_Internet_Protocol
- https://ja.wikipedia.org/wiki/Point-to-Point_Protocol
- https://www.quora.com/What-is-the-difference-between-ethernet-and-PPPoE-Point-to-Point-Protocol-over-Ethernet
- https://www.tramsystem.jp/voice/voice-2065/