Skip to content

Instantly share code, notes, and snippets.

version: '3'
services:
redis-cluster:
image: grokzen/redis-cluster
environment:
IP: 127.0.0.1 # docker for macだとこれ必要
ports:
# デフォルト設定でclusterとして扱えるポートは下記
- '6379:6379'
@tokutoku3
tokutoku3 / get_params_sample.py
Created October 4, 2017 09:25
pythonでコマンドライン引数受け取り
import argparse
parser = argparse.ArgumentParser(description='Help message Zzzzzz.')
parser.add_argument(
'--param1',
choices=['foo', 'bar', 'baz'],
required=True,
help='Description param1'
)
parser.add_argument(
@tokutoku3
tokutoku3 / SendSlack.js
Created January 20, 2017 08:12
Lambda(Node.js v4.3)でSlackに通知を送る
console.log('Loading function');
const https = require('https');
const url = require('url');
const slack_url = process.env.slack_url;
const slack_req_opts = url.parse(slack_url);
slack_req_opts.method = 'POST';
slack_req_opts.headers = {'Content-Type': 'application/json'};
exports.handler = function (event, context) {
<?php
/**
* 例外をスタックするためのクラス
*/
class ExceptionHolder
{
/**
* 既存の例外に新規の例外をスタックさせて返す
*
@tokutoku3
tokutoku3 / excel_diff.rb
Last active August 29, 2015 14:19
Excelの差分を生成する
#!/usr/bin/env ruby
#
# Excelの差分抽出スクリプト
# Excelは.xls形式じゃないと読み込めない
# Spreadsheetが必要なので、無い場合はインストールする
#
# $ sudo gem install spreadsheet
#
# usage: ruby excel_diff.rb <xls filename1> <xls filename2>
@tokutoku3
tokutoku3 / difflist.sh
Last active August 29, 2015 14:03
gitから差分ファイルリスト作成。引数1つでHEADからの差分(整数orコミットID)、引数二つでコミット間の差分(コミットIDのみ対応)
#!/bin/bash
diff=""
name=""
if [ $# -eq 1 ]; then
if expr "$1" : '.*[^0-9].*' > /dev/null ; then
diff=" HEAD ${1}"
name="HEAD ~ ${1}"
else
diff=" HEAD HEAD~${1}"
name="HEAD ~ HEAD~${1} "
@tokutoku3
tokutoku3 / fizzbuzz.pl
Created May 15, 2014 11:49
[練習] perlでワンライナーfizzbuzz
print(($_%3?$_%5?"$_":buzz:$_%5?fizz:fizzbuzz)."\n")for 1..100
@tokutoku3
tokutoku3 / lifegame.html
Last active August 29, 2015 13:59
canvasでライフゲーム
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Lifegame</title>
<style>
body { background-color: black; }
.contents { width: 100%; text-align: center; }
</style>
</head>
@tokutoku3
tokutoku3 / oxgame.rb
Created July 1, 2012 13:39
Rubyで簡易oxゲーム
$ary = (1...10).to_a
$player = -1
$cnt = 1
def showDisp
puts "Select number between 1...9"
(0...9).each do |i|
if (i + 1) % 3 == 0 then
puts getStone($ary[i])
else