Skip to content

Instantly share code, notes, and snippets.

Avatar

matstani matstani

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

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

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
View docker-bridge-trouble.md

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

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

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

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

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

作ったもの

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

規模

  • DBテーブル数80程度
  • 画面数200程度
View mysqldump
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 Dec 29, 2017
PHPで英数字混在パスワード生成
View genpwd.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 Mar 29, 2016
clojure 全角カナ-半角カナ map
View katakana-hannkakukatakana-map.clj
(def katakana-hannkakukatakana-map
{"" "" "" "" "" "" "" "" "" ""
"" "" "" "" "" "" "" "" "" ""
"" "" "" "" "" "" "" "" "" "ソ"
"" "" "" "" "" "" "" "" "" ""
"" "" "" "" "" "" "" "" "" ""
"" "" "" "" "" "" "" "" "" ""
"" "" "" "" "" "" "" "" "" ""
"" "" "" "" "" ""
"" "" "" "" "" "" "" "" "" ""
@matstani
matstani / project.clj
Created Jan 8, 2016
figwheel in remote server.
View project.clj
(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 Dec 9, 2015
update nested map in clojure.
View nested.clj
(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 Dec 9, 2015
process nested map in clojure.
View nested.clj
(def divisions
{:division1
{:group1 [:staff1 :staff2]
:group2 [:staff3 :staff4 :staff5]}
:division2
{:group3 [:staff6 :staff7]}})
(for [[d groups] divisions
[g staffs] groups]
[d g staffs])