$ vim cat .ssh/config
Host github.com
HostName github.com
IdentityFile ~/.ssh/github_id_rsa
User username
$ sudo -u jenkins ssh -T [email protected]
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
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
curl -fsSL https://mackerel.io/file/script/amznlinux/setup-yum.sh | sh | |
sudo cp /etc/mackerel-agent/mackerel-agent.conf.rpmsave /etc/mackerel-agent/mackerel-agent.conf | |
sudo yum clean all | |
sudo yum install -y mackerel-agent mackerel-agent-plugins mackerel-check-plugins mkr | |
sudo /sbin/service mackerel-agent start |
grep -rl "before" ./ | xargs perl -i -pe "s/before/after/g"
関数は一つ以上の結果を返すことが出来る。
これまでに、2つ以上の値を結果として返す標準pkg内の関数の例をみることが出来る、計算された結果とそのエラーの値もしくは、計算が機能したかどうかを示すブール値など。
https://github.com/adonovan/gopl.io/blob/master/ch5/findlinks2/main.go
4つのreturn
があり、それらは結果のペアを返す。
# suspend
aws autoscaling suspend-processes --auto-scaling-group-name hoge
# resume
aws autoscaling resume-processes --auto-scaling-group-name hoge
メソッドは、関数名の前に特別なパラメータを置いて宣言されます。 そのパラメータは、関数にその型のパラメータを付与します。
私達の最初のメソッドを見ていきましょう。
https://github.com/adonovan/gopl.io/blob/master/ch6/geometry/geometry.go
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
var TWITTER_CONSUMER_KEY = ''; | |
var TWITTER_CONSUMER_SECRET = ''; | |
var SHEET_NAME = ''; | |
function trigger() { | |
search('#検索単語', 0); | |
} | |
function reset() { | |
var service = getService(); |
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
require 'net/http' | |
require 'uri' | |
require 'json' | |
resp = JSON.parse($stdin.gets) | |
if resp["exitCode"] != 0 then | |
uri = URI.parse("https://hooks.slack.com/services/***") | |
payload = { | |
text: "```#{JSON.pretty_generate(resp)}```", |
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
SELECT | |
count(*) AS count, | |
floor( | |
COUNT(*) * date_part('day', DATE_TRUNC('month', now() + '1 months') + '-1 days') / date_part('day', now()) | |
) AS forecast | |
FROM user | |
WHERE registered_at >= CAST(DATE_TRUNC('month', now()) AS TIMESTAMP) |
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
SELECT | |
SUM( | |
CASE WHEN registered_at >= DATE_TRUNC('month', now()) THEN 1 ELSE 0 END | |
) AS COUNT, | |
SUM( | |
CASE WHEN registered_at >= DATE_TRUNC('month', now()) THEN 1 ELSE 0 END | |
) + SUM( | |
CASE WHEN registered_at BETWEEN DATE_TRUNC('day', now() + '-14 days') AND DATE_TRUNC('day', now()) THEN 1 ELSE 0 END | |
) / 14 * ( | |
date_part('day', DATE_TRUNC('month', now() + '1 months') + '-1 days') - date_part('day', DATE_TRUNC('day', now())) |