Skip to content

Instantly share code, notes, and snippets.

View soudai's full-sized avatar

soudai sone soudai

View GitHub Profile
@soudai
soudai / metadata-rpm-packages.php
Last active June 4, 2017 19:03
yumのインストールパッケージを雑にmackerelのmetadataとして登録する
<?php
$list = explode("\n", `yum list installed`);
foreach ($list as $key => $val) {
if (empty($val)) {
continue;
}
$base_list = array_filter(explode(" ", $val));
$json_base[$key]['name'] = array_shift($base_list);
@soudai
soudai / mackerel-plugin-sample.php
Last active March 19, 2019 09:01
最もシンプルなPHPでのpluginの作成例
<?php
$time = time();
$value = rand(5, 50);
$value1 = rand(5, 50);
$value2 = rand(5, 50);
$value3 = rand(5, 50);
$metric_name = 'random.count';
echo "{$metric_name}\t{$value}\t{$time}\n";
echo "{$metric_name}_1\t{$value1}\t{$time}\n";
@soudai
soudai / addSpreadsheetToTrelloCard.gs
Last active June 22, 2018 15:41
Google SpreadsheetからTrelloに自動登録する
var scriptProp = PropertiesService.getScriptProperties().getProperties();
var trelloKey = scriptProp.TRELLO_API_KEY;
var trelloToken = scriptProp.TRELLO_TOKEN;
var username = scriptProp.TRELLO_USERNAME;
var trelloBaseURL = scriptProp.TRELLO_BASE_URL;
function addTrelloCard(){
var values = getSpreadsheet();
// リクエスト用のURL文字列を作成
127.0.0.1
ServerVersion: Apache/2.4.27 (Amazon) PHP/5.6.31
ServerMPM: prefork
Server Built: Sep 24 2017 23:19:50
CurrentTime: Tuesday, 28-Nov-2017 08:25:28 UTC
RestartTime: Monday, 27-Nov-2017 03:20:01 UTC
ParentServerConfigGeneration: 6
ParentServerMPMGeneration: 5
ServerUptimeSeconds: 104726
ServerUptime: 1 day 5 hours 5 minutes 26 seconds
@soudai
soudai / endpoint2Mackerel.gs
Created December 29, 2017 09:12
Send Endpoint JSON of Google Apps Script to Mackerel service metric
var scriptProp = PropertiesService.getScriptProperties().getProperties();
var mackerelApiKey = scriptProp.MACKEREL_API_KEY;
var serviceName = scriptProp.MACKEREL_SERVICE_NAME;
var BaseURL = scriptProp.BASE_URL;
function main() {
var mackerelPostRes = postMackerelServiceMetric(mackerelApiKey, serviceName, getEndpointJSON());
}
function postMackerelServiceMetric(apiKey, serviceName, payload) {
@soudai
soudai / trip.md
Last active June 29, 2020 03:00
そーだいなる海外旅行の準備&知見

事前に買うと良いもの

100均で買う

  • 体を洗うナイロンタオル
    • ホテルに置いて無い
    • お好みで(自分は使わなかった)
  • 歯ブラシ
    • ホテルに無い
    • 場所によっては現地で買うことも出来るが100均で買って帰りに捨てるでも良い(自分はそうした)
  • 汗ふきシート
  • 夏場は特にあるといい
@soudai
soudai / check_memory.php
Created January 21, 2019 15:24
Mackerelのメトリック監視に合わせてメモリーを数値化する
<?php
/**
* [plugin.checks.check_memory]
* command = "php /usr/local/bin/check_memory.php -c 90"
* max_check_attempts = 5
* check_interval = 1
* action = { command = "/etc/init.d/httpd graceful" }
* memo = "httpdによってmemoryが圧迫されたらhttpdをgracefulする"
**/
@soudai
soudai / make-j.md
Last active December 22, 2020 06:56
makeで簡単に並列

ファイルの中身を並列実行

FILE := list.txt
LIST := $(shell cat $(FILE))
TARGETS := $(addsuffix .run,$(LIST))
all: $(TARGETS)
%.run:
    sh hoge.sh $*