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; | |
} | |
} |
View cloud-init-ubuntu18.yaml
#cloud-config | |
package_update: true | |
runcmd: | |
- snap install docker --channel=17.03/stable | |
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 |
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 \ |
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 |
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; |
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> |
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 |
NewerOlder