Skip to content

Instantly share code, notes, and snippets.

View ksoda's full-sized avatar
👯‍♀️
I may be slow to respond.

Ken Sonoda ksoda

👯‍♀️
I may be slow to respond.
  • Tokyo
View GitHub Profile
let
pkgs = import <nixpkgs> {};
stdenv = pkgs.stdenv;
in with pkgs; {
myProject = stdenv.mkDerivation {
name = "myProject";
version = "1";
src = if pkgs.lib.inNixShell then null else nix;
buildInputs = with rPackages; [
@ksoda
ksoda / LICENSE
Created September 18, 2019 12:49
LICENSE
MIT License
Copyright (c) 2019 Ken SONODA
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@ksoda
ksoda / host-only-nat.csv
Last active September 16, 2019 16:18
Research Selenium Grid connection
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 9.
"No.","Time","Source","Destination","Protocol","Length","Info"
"6","17.004176504","192.168.56.102","192.168.56.1","TCP","66","49931 > 4444 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 WS=256 SACK_PERM=1"
"7","17.004243596","192.168.56.1","192.168.56.102","TCP","66","4444 > 49931 [SYN, ACK] Seq=0 Ack=1 Win=64240 Len=0 MSS=1460 SACK_PERM=1 WS=128"
"8","17.004560848","192.168.56.102","192.168.56.1","TCP","54","49931 > 4444 [ACK] Seq=1 Ack=1 Win=2102272 Len=0"
"9","17.013046010","192.168.56.102","192.168.56.1","HTTP","202","GET /grid/api/hub HTTP/1.1 "
"10","17.013094764","192.168.56.1","192.168.56.102","TCP","54","4444 > 49931 [ACK] Seq=1 Ack=149 Win=64128 Len=0"
"13","17.056025","192.168.56.102","192.168.56.1","TCP","66","[TCP Retransmission] 49931 > 4444 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 WS=256 SACK_PERM=1"
"14","17.056329","192.168.56.1","192.168.56.102","TCP","66","[TCP Retransmission] 4444 > 49931 [SYN, ACK] Seq=0 Ack=1 Win=64240 Len=0 MSS=1460 SACK_PERM=1 WS=128"
"15","17.056409","192.168.56.102","1
@ksoda
ksoda / read.rs
Last active November 3, 2021 12:32
VS Code snippet
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> Option<T> {
let mut b = String::new();
std::io::stdin().read_line(&mut b).ok();
b.trim().parse().ok()
}
/// # Examples
/// ```
/// let mtx = (0..2).map(|_| read_v().unwrap()).collect();
(def alt-from-char {\U 1 \D -1})
(defn ending-valley? [step alt]
(and (= alt -1) (= step \U)))
(defn countingValleys [n s]
(:cnt
(reduce
(fn [acc step]
(let [{:keys [cnt alt]} acc]
var _require = function _require(cond) {
if (!cond) {
factor(-Infinity);
}
}
// Class attendance model.
var attendance = function(i_pl, i_stats, busy) {
var attendance = function (interest, busy) {
if (interest) {
@ksoda
ksoda / _main.md
Last active July 24, 2020 15:27
Intermezzo Alloy part 2

Alloy part 2

前回の続き。Part 3

アトムと関係

アトムとは不可分、不変、非解釈(性質が組み込まれていない)を満たす。これだけではモデル化する能力が足りない。 そこで時空間を表せる関係を導入する。これはアトムからなるタプルの集合だ。

論理系

@ksoda
ksoda / gist:7fdfa33f43148bc265779cbaa673274d
Last active June 6, 2023 15:38
メソドロジと可観測性ツール

Memo: メソドロジと可観測性ツール

詳解 システム・パフォーマンスから。よくわからない箇所を書き留めるための文書。

メソドロジと分析

仕事を省略できるので性能チューニングは仕事をする場所付近で行うと効果が高い。 チューニング2.3.4やワークロードの特性の把握2.5.10参照。

方向性を定めるため目標を定めると、行動を選択するとき役立つ。定まればあとは要因を探すだけだ。

@ksoda
ksoda / record.bash
Last active August 25, 2019 12:09
Record terminal
#!/bin/bash -eu
# Dependencies:
# npm install -g svg-term-cli
# pip3 install asciinema
cast_filename=$(mktemp -u)
asciinema rec ${cast_filename}
out_filename=$(mktemp -u)
svg-term --in ${cast_filename} --out ${out_filename}.svg
@ksoda
ksoda / recognition.js
Last active December 9, 2018 10:40
Echo using Web Speech API
[
"audioend",
"audiostart",
"end",
"error",
"nomatch",
"result",
"soundend",
"soundstart",
"speechend",