Skip to content

Instantly share code, notes, and snippets.

@muddydixon
muddydixon / kubectx
Created January 17, 2018 02:09
複数の project で kube を利用しているときのツール(要 peco)
#!/bin/bash
function kubectx(){
CTX=$(kubectl config get-contexts | awk 'NR>1 {print $2}' | peco)
if [ x${CTX} != "x" ]; then
kubectl config set current-context $CTX;
fi
}
kubectx
# https://tools.ietf.org/html/rfc7231#section-6.1
alias "100"="echo 'Continue'"
alias "101"="echo 'Switching Protocols'"
alias "200"="echo 'OK'"
alias "201"="echo 'Created'"
alias "202"="echo 'Accepted'"
alias "203"="echo 'Non-Authoritative Information'"
alias "204"="echo 'No Content'"
alias "205"="echo 'Reset Content'"
alias "206"="echo 'Partial Content'"
@muddydixon
muddydixon / README.md
Created December 12, 2014 13:07
ネストされた子どもに状態を伝える方法ワカンネ

やりたいこと

  • 親側の変更を子のComponentに伝えたい
  • 子にどうやって渡したらいいのかわからな
  • イベント/ハンドラもどうやって渡せばいいのか
@muddydixon
muddydixon / all.js
Created November 26, 2014 09:42
インデントについて
"use strict";
(function(){
var express = require("express");
var mysql = require("mysql");
// some process
var hoge = 1;
var fugafuga = 2;

こんなんなる

% mocha -R spec test/test-basepath.js


  Stubcell server should set json basepath
    request
      1) should return test/base/test/record_get.json
      2) "after each" hook
@muddydixon
muddydixon / drone.build.md
Last active August 29, 2015 14:03
ubuntu14.04でのdroneのbuild
# mkdir -p /usr/local/lib/go
# export GOPATH=/usr/local/lib/go
# export GOBIN=$GOPATH/bin
# apt-get update
# apt-get install docker.io
# ln -sf /usr/bin/docker.io /usr/local/bin/docker
# sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io
# apt-get install git mercurial bzr gcc
# go get [email protected]:drone/drone.git
@muddydixon
muddydixon / README.md
Last active August 29, 2015 14:01
各dbのdeferred wrapper

deferred化しました

使い方は次のようになります

dLevel = require "dLevel"
db = dLevel("./mydb")
db.set("name", "dLevel")
.then(()->
 db.get("name")
@muddydixon
muddydixon / README.md
Last active August 29, 2015 13:56
iris.csvの棒グラフを作ってみよう

サーバの立ち上げ方

  • python: python -m SimpleHTTPServer 5000
  • perl: plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root => ".")->to_app
  • ruby: ruby -rwebrick -e 'WEBrick::HTTPServer.new(:Port => 5000, :DocumentRoot => ".").start'
  • php: php -S 0.0.0.0:5000
@muddydixon
muddydixon / nest.html
Created February 20, 2014 06:40
入れ子にして罫線を引きたい(画像メンドクサイ)
<html>
<body>
<style>
#content, #case {
margin: 20px 20px;
height: 100px;
width: 600px;
display: block;
background: cyan;
}
@muddydixon
muddydixon / serve.sh
Created February 20, 2014 04:14
Nodeでサーバ立てる
node -e 'var fs=require("fs"), path = require("path"); require("http").createServer(function(req, res){ url = path.join(__dirname, req.url); res.end(fs.readFileSync(url.replace(/\/$/, "/index.html"), "utf8"))}).listen(8000)'