Skip to content

Instantly share code, notes, and snippets.

@yurakawa
yurakawa / main.go
Created February 25, 2021 14:51
interface slice
package main
import "fmt"
// https://github.com/golang/go/wiki/InterfaceSlice
func main() {
stringSlice := []string{"Tokyo", "Saitama"}
// var i interface {} = stringSlice // OK
// var is []interface{} = stringSlice // NG
@yurakawa
yurakawa / marshal.go
Created August 28, 2019 00:17
MarshalJSON
// https://github.com/nathany/get-programming-with-go/blob/master/lesson24/starship/starship.go
package main
import (
"encoding/json"
"fmt"
"os"
)
@yurakawa
yurakawa / validation.go
Last active March 10, 2019 07:19
go-playground/validator(validator.v9) で struct の tag情報を取得する
package main
import (
"fmt"
"gopkg.in/go-playground/validator.v9"
"reflect"
"strings"
)
type User struct {
@yurakawa
yurakawa / tips.bash
Last active December 23, 2015 16:49
シェルスクリプトのTipsをメモ
#!/bin/bash
# シェルスクリプトで一時的なファイル(中間ファイル)を作成
tmp=/tmp/$$
echo hoge > $tmp-hoge
rm $tmp-*
# あるファイルがなければシェルスクリプトを終了する
[ -f "/etc/passwd" ] || exit 1
@yurakawa
yurakawa / .cvimrc
Last active January 19, 2016 10:59
.cVimrc
" Settings
set noautofocus
set cncpcompletion
set nosmoothscroll
set nohud
set autohidecursor
set typelinkhints
let locale = "jp"
let scrollduration = 10
@yurakawa
yurakawa / anemone_template.rb
Last active November 30, 2016 14:20
anemone用テンプレートファイル
require 'anemone'
urls = [
"http://example.com/",
"http://example2.com/",
]
cookies = {
}
@yurakawa
yurakawa / setup_script_osx
Last active January 4, 2024 11:53
Setting up My Mac
#!/usr/bin/env bash
set -u
# --------------------
# Todo: Install xcode from App Store
# --------------------
# for System
@yurakawa
yurakawa / kanshi.md
Last active August 29, 2015 14:21
監視について

監視について

運用管理の現場においては、管理コストを抑えつつ、以下にして効率よくサーバを管理できるかが重要。

システム監視

  • システム内で動作しているサーバ、アプリケーション、ネットワークなどが正常に稼働しているかを 定期的に確認することで、システムで発生した障害やリソース不足を検知してシステム管理者に通知を 行うための作業や仕組みのこと。
  • システム監視は大きく分けて以下の3つ。

稼働監視

@yurakawa
yurakawa / command_list.md
Created May 17, 2015 11:53
状況確認コマンド

「w」

  • システムの稼働時間、ログインユーザ数、ロードアベレージを確認 [root@ip-10-0-0-61 ~]# w

-入力結果 20:33:50 up 18 days, 8:08, 1 user, load average: 0.00, 0.00, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root pts/0 119.244.165.240 14:51 0.00s 0.05s 0.01s w

「ss -lnp」

@yurakawa
yurakawa / logresolvemerge.pl
Created August 7, 2014 02:45
access.logマージ用スクリプト
#!/usr/bin/perl
# With some other Unix Os, first line may be
#!/usr/local/bin/perl
# With Apache for Windows and ActiverPerl, first line may be
#!C:/Program Files/ActiveState/bin/perl
#-Description-------------------------------------------
# Merge several log files into one and replace all IP addresses
# with resolved DNS host name.
# This tool is part of AWStats log analyzer but can be use
# alone for any other log analyzer.