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 -xe | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
brew install --cask 1password | |
brew install 1password-cli chezmoi | |
open -a '1Password' | |
echo "chezmoi init https://github.com/takuma-saito/dotfiles" |
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 -eu | |
cat <<EOF > main.rb | |
require 'json' | |
require 'date' | |
items = JSON.parse(\$stdin.read) | |
items | |
.group_by {|a| a['state']} | |
.map {|state, val| [ | |
state, | |
val.sort_by {|x| x['updatedAt']} |
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
struct TreeNode<T> { | |
value: T, | |
left: TreeNodeRef<T>, | |
right: TreeNodeRef<T> | |
} | |
type TreeNodeRef<T> = Option<Box<TreeNode<T>>>; | |
type Node = TreeNode<i64>; |
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
socat Examples | |
=============== | |
* 注意 | |
- SYSTEM で : を使う時は必ずエスケープすること | |
* 相手に接続 | |
# telnet, netcat, socat それぞれの場合 | |
$ socat - TCP:127.0.0.1:8000 |
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
import AVFoundation | |
import AVKit | |
import UIKit | |
extension CMTime { | |
var asDouble: Double { | |
get { | |
return Double(self.value) / Double(self.timescale) | |
} |
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 -xe | |
role_arn="$1" | |
eval $(aws sts assume-role --role-arn "$role_arn" --role-session-name $RANDOM | jq -r '.Credentials | "export AWS_ACCESS_KEY_ID=\(.AccessKeyId)\nexport AWS_SECRET_ACCESS_KEY=\(.SecretAccessKey)\nexport AWS_SESSION_TOKEN=\(.SessionToken)\n"') |
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
0 0 2 21 2 23 15 18 | |
4 22 24 17 12 4 11 19 | |
3 3 11 15 5 12 6 8 | |
18 23 6 12 18 24 15 11 | |
9 7 19 18 16 18 14 18 | |
2 17 10 6 5 7 20 7 | |
5 24 5 24 18 0 1 3 | |
24 21 6 8 21 23 18 13 |
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
# げんせんちょうしゅうの計算の仕方, N = xxxxx | |
# 源泉徴収金額 | |
echo $[floor(0.1021 * (N / 1.10))] |
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 Puzzle | |
class Board | |
include Enumerable | |
def initialize(board) | |
@board = board | |
end | |
def rows(row) | |
@board[row * 9, 9].compact | |
end | |
def cols(col) |
NewerOlder