Skip to content

Instantly share code, notes, and snippets.

View hiroakis's full-sized avatar

Hiroaki Sano hiroakis

View GitHub Profile
@mattn
mattn / aclog.go
Last active August 30, 2017 10:16
nginx のアクセスログからIP毎のアクセス回数(ステータス400以上)を表示するコード
package main
import (
"fmt"
"io"
"log"
"os"
"strconv"
"time"
@lmars
lmars / commands.txt
Last active January 22, 2016 20:43
Flynn Redis
# create a redis app
flynn create --remote "" redis
# create a release using the latest (at the time of writing) Docker Redis image
flynn -a redis release add -f config.json "https://registry.hub.docker.com?name=redis&id=868be653dea3ff6082b043c0f34b95bb180cc82ab14a18d9d6b8e27b7929762c"
# scale the server to one process. This may time out initially as the server pulls the image, but watch "flynn -a redis ps" and should come up.
flynn -a redis scale server=1
# redis should now be running in the cluster at redis.discoverd:6379
@hiroakis
hiroakis / spec_helper.rb.patch
Last active October 14, 2016 05:46
A patch for spec_helper.rb in serverspec. This patch enables "rake spec" command to require server login password.
--- spec_helper.rb.org 2013-11-04 19:21:50.000000000 +0900
+++ spec_helper.rb 2013-11-04 23:01:26.000000000 +0900
@@ -6,12 +6,9 @@
include Serverspec::Helper::DetectOS
RSpec.configure do |c|
- if ENV['ASK_SUDO_PASSWORD']
- require 'highline/import'
- c.sudo_password = ask("Enter sudo password: ") { |q| q.echo = false }
- else

http://ameblo.jp/principia-ca/entry-11573342807.html

  1. 復帰した旧masterが新masterになるわけじゃないんで「フェイルバック」 ではない感。
  2. sentinel 1台だと誤検知してもFOしちゃうので怖い。別ラックとかで複数sentinel配置すべきじゃないかなぁ。
  3. alias_ip_change.shは非常にまずい気がして、引数全く見てないのでFOが発動したときと完了したときの2回IP Alias切り替えちゃう。つまり元に戻るので落ちたmasterにVIPが付いちゃうんじゃないかなぁ?
  4. あとip addr del/addしたときって他サーバー/スイッチのarpテーブル/FDB更新されるんだっけ? Gratuitous ARP送ったほうがいいような気がするけどどうだろう?
  5. 注意点1はそんなことはなくて、ちゃんと引数をみてroleがleaderでstateがendのときだけVIPの移動処理すればOK 引数の説明はsentinel.confに書いてある
@myfinder
myfinder / Riak.pm
Created March 11, 2013 15:55
CloudForecast Data Object for Riak
package CloudForecast::Data::Riak;
use CloudForecast::Data -base;
use LWP::UserAgent;
use JSON;
=head1 NAME
CloudForecast::Data::Riak - riak resource monitor
@akuwano
akuwano / gist:5132283
Last active December 14, 2015 18:49
It is Python Command Line Template.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import argparse
import traceback
import logging
class ArgumentParse(object):
$.ajax({
url: "ajax.html",
success: function(data) {
alert('success!!');
},
error: function(data) {
alert('error!!!');
}
});
@Potherca
Potherca / README.md
Last active November 27, 2023 17:44
Create a branch on Github without access to a local git repo using http://hurl.eu/

Ever had the need to create a branch in a repo on Github without wanting (or being able) to access a local repo?

With the aid of [the Github API][1] and any online request app this is a piece of cake!

Just follow these steps:

  1. Open an online request app (like apirequest.io, hurl.it pipedream.com, reqbin.com, or webhook.site)
  2. Find the revision you want to branch from. Either on Github itself or by doing a GET request from Hurl: https://api.github.com/repos/<AUTHOR>/<REPO>/git/refs/heads
  3. Copy the revision hash
  4. Do a POST request from Hurl to https://api.github.com/repos/<AUTHOR>/<REPO>/git/refs with the following as the POST body :