This file contains 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
type ServerSettings = { | |
Host : string | |
Port : int | |
} | |
type ServerSettingsBuilder() = | |
member _.Yield (_) = None, None | |
member _.Run((host, port)) = { Host = Option.get host; Port = Option.get port } | |
[<CustomOperation("host")>] | |
member _.SetHost ((_:string option, port:int option), host:string) = Some(host), port | |
[<CustomOperation("port")>] |
This file contains 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
module Program | |
open Microsoft.Extensions.DependencyInjection | |
open Microsoft.Extensions.Logging | |
type ResultBuilder(logger:ILogger<ResultBuilder>) = | |
member _.Return x = Ok(x) | |
member _.ReturnFrom (m:Result<_, _>) = m | |
member _.Bind (m, f) = Result.bind f m | |
member _.Delay f = |
This file contains 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
open System.Text | |
let append : string list -> string = | |
List.fold (fun (builder:StringBuilder) -> builder.Append) (StringBuilder()) | |
>> fun builder -> builder.ToString() | |
// aA | |
append ["a"; "A"] |> printfn "%s" | |
// aAbB | |
append ["b"; "B"] |> printfn "%s" |
This file contains 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
default: | |
db: | |
drv: !expr RPostgres::Postgres() | |
host: localhost | |
password: password | |
user: user | |
dbname: dbname |
This file contains 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
def c(*args): | |
l = [] | |
for x in args: | |
if hasattr(x, '__iter__'): | |
l.extend(list(x)) | |
else: | |
l.append(x) | |
return l | |
# [0, 1, 2, 3, 4, 9, 14, 15, 16, 17] |
This file contains 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
package logrus_ext | |
import ( | |
"encoding/json" | |
"fmt" | |
"github.com/Sirupsen/logrus" | |
"github.com/aws/aws-sdk-go/aws" | |
"github.com/aws/aws-sdk-go/aws/session" | |
"github.com/aws/aws-sdk-go/service/cloudwatchlogs" | |
"github.com/oleiade/lane" |
This file contains 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
suppressPackageStartupMessages({ | |
library(magrittr) | |
library(stringr) | |
library(Rook) | |
library(shadowy) | |
library(logging) | |
library(aws.s3) | |
library(ggplot2) | |
library(scales) | |
}) |
This file contains 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
kansuuji <- function(x) { | |
# 漢字から数値へのマッピング | |
# 万未満の位 | |
map_low <- c( | |
〇 = 0, 一 = 1, 二 = 2, 三 = 3, 四 = 4, | |
五 = 5, 六 = 6, 七 = 7, 八 = 8, 九 = 9, | |
十 = 10, 百 = 100, 千 = 1000 | |
) | |
# 万以上の位 | |
map_up <- c( |
This file contains 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
Option Explicit | |
' アクティブシートの結合されたセルの結合を解除して,すべてのセルの値を結合元のセルの値で埋めます。 | |
Public Sub Unmerge() | |
Dim OuterCell As Variant | |
Dim InnerCell As Variant | |
Dim Value As Variant | |
Dim MergeArea As Object | |
Dim Updating As Boolean ' 現在のスクリーン更新状態 | |
This file contains 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
#!/bin/bash | |
LAMBDA=$1 | |
X=0 | |
V=0 | |
while [ `echo "$V <= $LAMBDA" | bc` -eq 1 ] | |
do | |
W=`echo "$V - l(1 - $RANDOM / 32768)" | bc -l` | |
V=$W |
NewerOlder