Skip to content

Instantly share code, notes, and snippets.

View jaohaohsuan's full-sized avatar

Henry jaohaohsuan

View GitHub Profile
@jaohaohsuan
jaohaohsuan / stored-query.mapping.json
Created April 19, 2016 15:55
post elasticsearch index mapping with ansible
---
- uri:
url: http://localhost:9200/stored-query
method: HEAD
status_code: 200,404
register: index_status
- debug: var=index_status
- debug: msg="{{ lookup('file','stored-query.mapping.json') }}"
- uri:
url: http://localhost:9200/stored-query
@jaohaohsuan
jaohaohsuan / no pass ssh
Last active June 24, 2016 07:08
add my ssh_pub to somewhere
#!/bin/bash
cat ~/.ssh/id_rsa.pub | ssh $1@$2 'mkdir -p .ssh ; cat >> .ssh/authorized_keys';
echo "inu ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/00-inu-ansible
@jaohaohsuan
jaohaohsuan / SearchLogsDirectives.scala
Created June 19, 2016 03:34
search directive sample
package com.inu.frontend.storedquery
import org.elasticsearch.action.search.{SearchRequestBuilder, SearchResponse}
import spray.routing._
import scala.concurrent.{ExecutionContext, Future}
import org.json4s._
import org.json4s.native.JsonMethods._
import shapeless.{::, HNil}
@jaohaohsuan
jaohaohsuan / kubectl-bash-completion-install
Created July 14, 2016 01:07
kubectl(1.2.3) bash-completion install on ubuntu 16.04
curl -sSL https://raw.githubusercontent.com/kubernetes/kubernetes/$(kubectl version --client | grep -o -P '(?<=GitCommit:").*(?=",)')/contrib/completions/bash/kubectl | sudo tee /etc/bash_completion.d/kubectl
@jaohaohsuan
jaohaohsuan / alpine-pod.yaml
Last active November 4, 2016 06:40
runnnig forever pod
---
apiVersion: v1
kind: Pod
metadata:
name: alpine
namespace: default
spec:
containers:
- image: alpine:latest
command:
@jaohaohsuan
jaohaohsuan / gist:5f88e9684acc70a84854afdda72e6968
Created August 14, 2016 23:34
alpine purge what you installed
RUN apk add --no-cache --virtual .fetch-deps curl \
&& apk del .fetch-deps
@jaohaohsuan
jaohaohsuan / .tmux.conf
Created August 30, 2016 00:38
tmux configuration sample
set -g prefix C-a
bind C-a send-prefix
bind r source-file ~/.tmux.conf \; display "Reloaded!"
set -s escape-time 1
set -g base-index 1
set -g pane-base-index 1
@jaohaohsuan
jaohaohsuan / kubelet.service
Last active September 7, 2016 09:28
kubelet on kube master
[Unit]
Description=Kubernetes Kubelet
Documentation=https://github.com/kubernetes/kubernetes
Requires=docker.service
After=docker.service
[Service]
ExecStart=/usr/bin/kubelet \
--register-node=false \
--allow-privileged=true \
@jaohaohsuan
jaohaohsuan / kubernetes-master.manifest
Created September 7, 2016 09:23
include etcd, kube-apiserver, kube-controller-manager, kube-scheduler and kube-proxy
apiVersion: v1
kind: Pod
metadata:
name: kube-controller
spec:
hostNetwork: true
volumes:
- name: "etc-kubernetes"
hostPath:
path: "/etc/kubernetes"
@jaohaohsuan
jaohaohsuan / kubelet.service
Created September 7, 2016 09:27
Kubelet on kube node
[Unit]
Description=Kubernetes Kubelet
Documentation=https://github.com/kubernetes/kubernetes
After=calico-node.service
Requires=calico-node.service
[Service]
EnvironmentFile=/etc/network-environment
ExecStart=/usr/bin/kubelet \
--address=0.0.0.0 \