Skip to content

Instantly share code, notes, and snippets.

View evalphobia's full-sized avatar

evalphobia

View GitHub Profile
@evalphobia
evalphobia / The_Site_Reliability_Workbook.ch06a.md
Last active January 26, 2019 10:33
The Site Reliability Workbook: Chapter 6 (part A)

Chapter.6 トイルの排除 (Eliminating Toil)

  • GoogleのSRE: 最適化に時間を使う
    • コンピューティングリソースだけでなく、時間の使い方も最適化する
    • トイルに時間を使いたくない
    • トイルに関する包括的な話はSRE本の5章参照
    • この章でのトイルの定義:
      • サービス維持に関するもので、繰り返され、予測可能な一連のタスク
  • 本番運用にトイルは避けられない
@evalphobia
evalphobia / The_Site_Reliability_Workbook.ch01.md
Last active August 24, 2022 14:21
The Site Reliability Workbook: Chapter 1

Ch.1の前に、この本の簡単な説明。

SRE本が教科書/参考書とするとワークブックは問題集。 SRE本は主に原則や哲学を説明していたが、ワークブックはその原則をどのように適用していくかについて説明。 SRE本はGoogle内でのSREの実践例の話だったが、ワークブックはその他の企業(GCPユーザー)での話もあり。

  • Evernote, Home Depot, NY Times, Spotify

1. SREはDevOpsにどのように関わっていくのか

@evalphobia
evalphobia / action.js
Created July 5, 2018 08:14
To fetch Google Calendar event. (Running on Firebase Functions for Dialogflow)
class Action {
constructor(req, res){
this.request = req;
this.response = res;
this.requestSource = (req.body.originalRequest) ? req.body.originalRequest.source : undefined;
this.app = new DialogflowApp({req, res});
console.log('api-v2')
}
@evalphobia
evalphobia / 20170524.go
Created May 24, 2017 12:09
Women Who Go Lineボットの話
// Copyright 2016 LINE Corporation
//
// LINE Corporation licenses this file to you under the Apache License,
// version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at:
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
@evalphobia
evalphobia / 08.md
Last active March 23, 2017 11:38
The Go Programming Language

8 ゴルーチンとチャネル

2つのスタイルの並行処理

  • CSPモデル
    • プロセス間で直接相互通信をしない (?)
    • Goでは独立したプロセスとしてゴルーチンを使い、相互通信のためにチャネルを用いる(?)
  • 伝統的な共有メモリマルチスレッディング
    • 他の言語では一般的にスレッドが使われる
  • Ch.9で取り扱う
@evalphobia
evalphobia / exec.sh
Created March 9, 2017 08:09
Execute query from the list file to Elasticsearch
#!/bin/bash
# Read user_id from list.txt and executes query to ES.
# Usage:
# $ bash exec.sh list.txt
HOST='http://localhost:9200'
INDEX='index_name_1,index_name_2,my_awesome_index'
LIMIT=1000
OUTPUT='[.user_id, .status]' # jq expression
@evalphobia
evalphobia / slicebench_test.gp
Created November 30, 2016 01:58
[Golang] benchmark for unshifting to slice operation
package main
import (
"testing"
)
type User struct {
ID int
a int
b int64
@evalphobia
evalphobia / ptquery_mail_qiita.rb
Last active November 1, 2017 20:06
RDS(MySQL) log analyzer using pt-query-digest and https://github.com/wvanbergen/request-log-analyzer
#!/usr/bin/env ruby
require "qiita"
require "slack-notifier"
require "aws-sdk"
require 'yaml'
require 'json'
class RDSLogDownloader
@evalphobia
evalphobia / ssh_notify_to_slack.sh
Created October 24, 2016 03:07
Send Slack to SSH login alert
#!/bin/sh
# original from http://sandrinodimattia.net/posting-successful-ssh-logins-to-slack/
if [ "$PAM_TYPE" != "close_session" ]; then
whitelist="127.0.0.1 localhost" # change here
is_white=0
# check authorized host
for HOST in $whitelist
@evalphobia
evalphobia / README.md
Last active February 22, 2024 18:28
Golang Benchmark: gob vs json

tl;dr

  • JSON is faster for small size data
    • map (key size < 50 and Unmarshalling intensive workload)
    • single struct
  • gob is faster for big size data
    • map (key size > 50 or Marshalling intensive workload)
    • slice

(old) about