Skip to content

Instantly share code, notes, and snippets.

View matstani's full-sized avatar

matstani matstani

View GitHub Profile
@matstani
matstani / codedeploy-agent.log.md
Created July 11, 2018 04:52
codedeploy-agent.logのエラー

ログを読んだだけではわからなかったものをメモ

Error validating the SSL configuration

2018-07-11 00:33:16 ERROR [codedeploy-agent(4374)]: Error validating the SSL configuration: Invalid server certificate
2018-07-11 00:33:16 ERROR [codedeploy-agent(4374)]: booting child: error during start or run: SystemExit - Stopping CodeDeploy agent due to SSL validation error. - /opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_poller.rb:64:in `abort

SSL証明書がどうとか書いてあるが、ネットワーク不通でも出る

NetworkingError end of file reached

2018-07-11 12:25:50 INFO  [codedeploy-agent(21035)]: [Aws::CodeDeployCommand::Client 0 240.175208 3 retries] poll_host_command(host_identifier:"arn:aws:ec2:ap-northeast-1:xxxxxxxxx:instance/i-xxxxxx") Seahorse::Client::NetworkingError end of file reached

dockerのホストOSになぜか接続できず。 原因は、接続元ネットワークとdockerのブリッジネットワークがかぶっていたため。

https://qiita.com/chroju/items/5bff99d1c2c792575d32

AWS上でVPC Peeringを行う環境だったため

  • Peering設定
  • ルートテーブル
  • セキュリティグループ
@matstani
matstani / null_coalescing.php
Created January 31, 2018 07:40
Null coalescing in php7
$person = ['name' => 'matsutani'];
if ($name = $person['name'] ?? null) {
echo "hello, ${name}.\n";
} else {
echo "you are anonymous.\n";
}
@matstani
matstani / clojurememo.md
Created December 28, 2017 01:11
Clojureで業務システムを作ったメモ

Clojureを仕事で使った経験をメモしておきます。 2015年の冬に本番稼働したシステムのため、使用したライブラリ等については、必ずしも現在の流行に沿っていないと思います。

作ったもの

  • スタッフがウェブブラウザによりアクセスし、ログインして使用する業務システム
    • 商品管理、売上管理、支払管理etc..

規模

  • DBテーブル数80程度
  • 画面数200程度
mysqldump -u user -p -h 127.0.0.1 --skip-lock-tables --single-transaction db | gzip > dump_`date +"%Y%m%d%H%M%S"`.sql.gz
@matstani
matstani / genpwd.php
Last active December 29, 2017 01:55
PHPで英数字混在パスワード生成
<?php
define('PASSWORD_LENGTH', 6);
function randGet($chars) {
$n = rand(0, strlen($chars) - 1);
return $chars[$n];
}
function genpwd($length) {
$alpha = 'abcdefghijklmnopqrstuwxyz';
@matstani
matstani / katakana-hannkakukatakana-map.clj
Last active March 29, 2016 05:47
clojure 全角カナ-半角カナ map
(def katakana-hannkakukatakana-map
{"ア" "ア" "イ" "イ" "ウ" "ウ" "エ" "エ" "オ" "オ"
"カ" "カ" "キ" "キ" "ク" "ク" "ケ" "ケ" "コ" "コ"
"サ" "サ" "シ" "シ" "ス" "ス" "セ" "セ" "ソ" "ソ"
"タ" "タ" "チ" "チ" "ツ" "ツ" "テ" "テ" "ト" "ト"
"ナ" "ナ" "ニ" "ニ" "ヌ" "ヌ" "ネ" "ネ" "ノ" "ノ"
"ハ" "ハ" "ヒ" "ヒ" "フ" "フ" "ヘ" "ヘ" "ホ" "ホ"
"マ" "マ" "ミ" "ミ" "ム" "ム" "メ" "メ" "モ" "モ"
"ヤ" "ヤ" "ユ" "ユ" "ヨ" "ヨ"
"ラ" "ラ" "リ" "リ" "ル" "ル" "レ" "レ" "ロ" "ロ"
@matstani
matstani / project.clj
Created January 8, 2016 06:03
figwheel in remote server.
(defproject flappy-bird-demo "0.1.1-SNAPSHOT"
:description "The original figwheel flappybird demo"
:url "http://rigsomelight.com/2014/05/01/interactive-programming-flappy-bird-clojurescript.html"
:dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.170"]
[org.clojure/core.async "0.2.371"]
[cljsjs/react "0.13.3-1"]
[sablono "0.4.0"]]
@matstani
matstani / nested.clj
Created December 9, 2015 04:53
update nested map in clojure.
(def divisions
{:division1
{:group1 [:staff1 :staff2]
:group2 [:staff3 :staff4 :staff5]}
:division2
{:group3 [:staff6 :staff7]}})
(reduce
(fn [ds [d g staffs]]
(assoc-in ds [d g] (remove #{:staff2} staffs)))
@matstani
matstani / nested.clj
Created December 9, 2015 04:27
process nested map in clojure.
(def divisions
{:division1
{:group1 [:staff1 :staff2]
:group2 [:staff3 :staff4 :staff5]}
:division2
{:group3 [:staff6 :staff7]}})
(for [[d groups] divisions
[g staffs] groups]
[d g staffs])