Skip to content

Instantly share code, notes, and snippets.

View leoh0's full-sized avatar
🕶️
Working

Eohyung Lee leoh0

🕶️
Working
View GitHub Profile
#!/usr/env/bin/knife exec
#
# Based on:
# - https://gist.github.com/mpasternacki/1952431
#
abort("usage: knife exec #{ARGV[1]} from_id to_id") unless ARGV[3]
require 'net/ssh'
require 'net/scp'
#!/usr/bin/env bash
sudo apt-get install -qqy git make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev libxml2-dev libxslt1-dev libffi-dev
curl -sL https://raw.github.com/yyuu/pyenv-installer/master/bin/pyenv-installer | \
bash
export PATH="~/.pyenv/bin:$PATH"
#!/usr/bin/env bash
curl -sL https://raw.github.com/yyuu/pyenv-installer/master/bin/pyenv-installer | \
PYENV_ROOT=/opt/pyenv USE_HTTPS=true bash
PYENV_ROOT=/opt/pyenv PYTHON_CONFIGURE_OPTS="--enable-unicode=ucs4" \
/opt/pyenv/bin/pyenv install 2.7.9
/opt/pyenv/versions/2.7.9/bin/pip install virtualenv
/opt/pyenv/versions/2.7.9/bin/virtualenv /opt/openstack/
FROM tox-openstack-base:latest
WORKDIR /app
ARG BRANCH=kilo
ARG PROJECT
ENV UPPER_CONSTRAINTS_FILE=/upper-constraints.txt
#!/opt/openstack/venv/bin/python
import MySQLdb
import sys
import json
connection = MySQLdb.connect(
host=sys.argv[1], user="nova",
passwd=sys.argv[2], db="nova")
cursor = connection.cursor()
cursor.execute("select network_info, instance_uuid from instance_info_caches where deleted=0")
@leoh0
leoh0 / upgrade-ovs.sh
Created October 18, 2016 07:19
ubuntu 에서 ovs 를 package 에서 source 버전으로 변경 script
# 다운로드 및 빌드
cd /tmp
wget http://openvswitch.org/releases/openvswitch-2.3.1.tar.gz
tar zxvf openvswitch-2.3.1.tar.gz
mv openvswitch-2.3.1 /usr/src/
cd /usr/src/openvswitch-2.3.1
./boot.sh
./configure --with-linux=/lib/modules/`uname -r`/build --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make -j
@leoh0
leoh0 / k.sh
Last active July 19, 2017 10:35
# node에서 아래처럼 kube-proxy 떠있는지 보시고
# ps -ef | grep proxy
root 5217 5200 0 Jul14 ? 00:06:28 /usr/local/bin/kube-proxy --kubeconfig=/var/lib/kube-proxy/kubeconfig.conf
root 31473 31265 0 19:17 pts/1 00:00:00 grep --color=auto proxy
# 삭제하고
kubectl delete -f https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml
# 아래처럼 service 의 type을 nodeport 로 변경 해준 다음에 다시 적용하면
curl -s https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml | sed '/ targetPort: 9090/a\ \ type: NodePort' | kubectl create -f -
@leoh0
leoh0 / k8s_login.sh
Last active July 26, 2017 14:32
select multiple pods and log into it http://showterm.io/c58f9999d3ee6db03aa81
function kl() {
chkcommand() {
command -v $1 >/dev/null 2>&1 || { echo >&2 "Plz install $1 first. Aborting."; return 1; }
}
chkcommand fzf || return 1
chkcommand tmux || return 1
chkcommand kubectl || return 1
pods=$(kubectl get pods --all-namespaces | sed '1d' | fzf -x -m -e +s --reverse --bind=left:page-up,right:page-down --no-mouse | awk '{print $1","$2}');
if [[ $pods != "" ]]; then
@leoh0
leoh0 / result.txt
Created August 22, 2017 05:26
docker file viewer
$ vdoc 4c66d3b6d4fa
ADD file:9c48682ff75c756544d4491472081a078edf5dd0bb5038d1cb850a1f9c480e3e /
CMD ["bash"]
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates curl wget && \
rm -rf /var/lib/apt/lists/*
@leoh0
leoh0 / 18.04-linuxkit.sh
Last active July 13, 2018 05:09
gce 18.04 ubuntu image대상으로 linuxkit 설치 스크립트. https://github.com/leoh0/kubernetes 이용. 자세한 내용은 http://leoh0.github.io/ 블로그 참고
#!/bin/sh
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
set -ex
apt update