Skip to content

Instantly share code, notes, and snippets.

@jabaraster
jabaraster / template.yaml
Created November 7, 2019 00:13
AWS LamdaからAWS SESを使ってメールを送るRoleのSAMテンプレート記述
SendMailRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service: lambda.amazonaws.com
Action: "sts:AssumeRole"
@jabaraster
jabaraster / format-comma.elm
Last active August 16, 2019 00:10
comma format for Int by Elm. required 'elm-community/list-split'
String.join "," << List.reverse << List.map String.fromList << List.Split.chunksOfRight 3 << String.toList << String.fromInt
@jabaraster
jabaraster / MonthCalendar2.hs
Created June 10, 2019 23:31
カレンダ整形問題別解
import Data.Time.Calendar
import Data.Time.Format
import Data.Time.LocalTime
import Data.Time.Calendar.WeekDate
{- --------------------
この関数がエントリポイント.
--------------------- -}
main = putStrLn =<< pure . formatToMonthCalendar =<< currentMonth
@jabaraster
jabaraster / MonthCalendar.hs
Last active June 10, 2019 07:20
カレンダ整形問題:遊びのないHaskell版
import Data.List
import Data.List.Split
import Data.Time.Calendar
import Data.Time.Calendar.WeekDate
import Data.Time.Format
import Data.Time.LocalTime
{- --------------------
この関数がエントリポイント.
--------------------- -}
@jabaraster
jabaraster / MonthCalendar.kt
Created June 10, 2019 06:22
カレンダ整形問題:Kotlin版
import java.text.SimpleDateFormat
import java.time.LocalDate
import java.time.Month
import java.time.temporal.ChronoUnit
import java.util.GregorianCalendar
import java.util.Locale
fun main() {
val now = LocalDate.now()
println(Main.formatMonthCalendar(now.year, now.month))
@jabaraster
jabaraster / dining-philosophers.hs
Created October 27, 2018 16:39
プログラミング言語Rustの「食事する哲学者」をHaskellで書いてみた
module Main where
import Control.Concurrent (forkIO, threadDelay)
import Control.Concurrent.Async
import Control.Concurrent.MVar
data Philosopher = Philosopher {
name :: String
, left :: Int
, right :: Int
module Main where
import System.Exit
main :: IO ()
main = do
c <- getContents
mapM_ core $ lines c
where
core :: String -> IO ()
@jabaraster
jabaraster / amazonka-dynamodb.hs
Created December 6, 2017 16:00
amazonka-dynamodbの使い方を調査. ローカルのDynamoDBに接続できるようになった。
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE FlexibleContexts #-}
module Lib where
import Control.Lens
import Data.Aeson
import Data.Aeson.Lens
import Data.HashMap.Strict as M
import Data.Maybe
@jabaraster
jabaraster / Handler.java
Last active June 24, 2018 02:23
JavaでServerless Frameworkを使うときのリクエストとレスポンスには注意が必要 ref: https://qiita.com/jabaraster/items/f5805223d87a9f888774
package hello;
import java.io.IOException;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
public class Handler implements RequestHandler<Request, Response> {
@Override
@jabaraster
jabaraster / file0.txt
Created April 19, 2017 09:37
Xamarin.Mac + F#のソリューションがビルドできないときは ref: http://qiita.com/jabaraster/items/0e35b1774b4038c87680
Error: <solution_path>/FSharpSample/FSharpSample.fsproj
: /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac/Xamarin.Mac.FSharp.targets
: Project file could not be imported, it was being imported by
<solution_path>/FSharpSample/FSharpSample/FSharpSample.fsproj
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac/Xamarin.Mac.FSharp.targets
could not import "$(FSharpTargets)"