Skip to content

Instantly share code, notes, and snippets.

David Steiman xetys

View GitHub Profile
@xetys
xetys / Hard.java
Created Oct 9, 2018
Add Without Plus
View Hard.java
public class Hard {
public static void main(String[] args) {
for(int i = 0; i < 100; i++) {
for(int j = 0; j < 100; j++) {
assert addWithoutPlus(i,j) == i + j;
}
}
@xetys
xetys / cloud-init-ubuntu18.yaml
Last active Jun 25, 2018
cloud-config docker
View cloud-init-ubuntu18.yaml
#cloud-config
package_update: true
runcmd:
- snap install docker --channel=17.03/stable
@xetys
xetys / .tmux.conf
Last active Nov 26, 2018
tmux dotfile
View .tmux.conf
unbind C-b
set-option -g prefix C-x
bind-key C-x send-prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf
View hetzner-kube-demo.sh
#!/bin/bash
# install openebs
kubectl apply -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/openebs-operator.yaml
kubectl apply -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/openebs-storageclasses.yaml
# install helm
curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash
@xetys
xetys / ubuntu16-kubeadm
Last active Jan 25, 2018
ubuntu16-kubeadm
View ubuntu16-kubeadm
#!/bin/bash
apt-get update
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository \
@xetys
xetys / commands.sh
Last active Oct 30, 2017
rancher cluster
View commands.sh
# --volume-plugin-dir=/var/lib/rancher/etc/vol-plugins
apt update && apt install -y docker.io && docker pull rancher/server:stable && docker pull rancher/agent:v1.2.6
apt update && apt install -y docker.io && docker pull rancher/agent:v1.2.6
docker run -d --name=rancher-server --restart=unless-stopped -p 8080:8080 rancher/server:stable
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod a+x kubectl
mv kubectl /usr/local/bin
mkdir ~/.kube
touch ~/.kube/config
View gist:25efa2ec9bc83cadad2fe95d7534e147
# --volume-plugin-dir=/var/lib/rancher/etc/vol-plugins
apt update && apt install -y docker.io && docker pull rancher/server:stable && docker pull rancher/agent:v1.2.6
apt update && apt install -y docker.io && docker pull rancher/agent:v1.2.6
docker run -d --name=rancher-server --restart=unless-stopped -p 8080:8080 rancher/server:stable
@xetys
xetys / storage-provisioner.sh
Last active Jun 2, 2017
The most ugliest dynamic storage provider for kubernetes (installed by kismatic enterprise toolkit)
View storage-provisioner.sh
#!/bin/bash
while true; do
kubectl get pvc --all-namespaces -o json | jq '.items[] | select(.metadata.annotations["volume.beta.kubernetes.io/storage-class"]=="auto-provision" and .status.phase=="Pending")' | jq -r '[.metadata.name, .spec.resources.requests.storage] | @csv' | sed s/\"//g | sed s/Gi//g | sed s/-pvc/-pv/ | awk -F ',' '{ print "./kismatic volume add " $2 " " $1 " -r 1 -d 2 -c=\"auto-provision\" -a 10.10.*.*"}' | sh
sleep 10
done;
@xetys
xetys / rancher-agent-ubuntu.sh
Created Mar 2, 2017
Install Rancher Agent on a fresh ubuntu 16.04
View rancher-agent-ubuntu.sh
apt-get install -y apt-transport-https ca-certificates && \
apt-key adv \
--keyserver hkp://ha.pool.sks-keyservers.net:80 \
--recv-keys 58118E89F3A912897C070ADBF76221572C52609D && \
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list && \
apt-get update && \
apt-get install -y docker-engine=1.12.6-0~ubuntu-xenial && \
docker run -d --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.0 <server-url>
@xetys
xetys / k8s-reset.sh
Last active Jan 28, 2017
coroes-k8s-reset
View k8s-reset.sh
#!/bin/bash
sudo systemctl stop kubelet docker flanneld etcd2 && sudo rm -rf /etc/kubernetes/manifests/* && sudo rm -rf /etc/kubernetes/cni/ && sudo rm -rf /etc/systemd/system/kubelet.service && sudo rm -rf /etc/systemd/system/flanneld.service.d && sudo rm -rf /etc/systemd/system/docker.service.d/ && sudo rm -rf /var/lib/etcd2/* && sudo systemctl start etcd2
sudo iptables --flush
sudo iptables -tnat --flush
sudo systemctl start kubeinstall.service
sudo systemctl start flanneld docker kubelet
You can’t perform that action at this time.