Skip to content

Instantly share code, notes, and snippets.

@fredhsu
fredhsu / showver.json
Created July 13, 2020 22:14
show version example eapi
{
"jsonrpc": "2.0",
"id": "EapiExplorer-1",
"result": [
{
"uptime": 26892007.46,
"modelName": "DCS-7050SX-64-R",
"internalVersion": "4.21.0F-9441269.4210F",
"systemMacAddress": "00:1c:73:7d:2d:fd",
"serialNumber": "JPE14140280",
@fredhsu
fredhsu / install-docker-deb-stretch.sh
Last active May 16, 2019 07:33
Install docker runtime for debian stretch
# Install Docker from Ubuntu's repositories:
sudo apt-get update
sudo apt-get install -y docker.io
# or install Docker CE 18.06 from Docker's repositories for Ubuntu or Debian:
## Install prerequisites.
sudo apt-get update && apt-get install apt-transport-https ca-certificates curl software-properties-common -y
## Download GPG key.
@fredhsu
fredhsu / install-kubeadm-deb-stretch.sh
Created March 28, 2019 23:47
Install kube services on debian stretch
apt-get update && apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-stretch main
EOF
apt-get update
apt-get install -y kubelet kubeadm kubectl
apt-mark hold kubelet kubeadm kubectl
@fredhsu
fredhsu / openshift-install.sh
Created November 14, 2018 22:44
Install OpenShift container platform package
# Assumes that subscription manager has been registered and repos added
sudo yum -y install wget git net-tools bind-utils iptables-services bridge-utils bash-completion kexec-tools sos psacct
sudo yum -y update
sudo yum -y install atomic-openshift-utils
sudo yum -y install docker
@fredhsu
fredhsu / install-kubeadm.sh
Last active May 16, 2019 07:33
Install kubeadm after CRI is installed
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
@fredhsu
fredhsu / kubeadm-docker-ubuntu.sh
Last active May 16, 2019 07:33
Install docker for kubeadm on Ubuntu
# Install Docker from Ubuntu's repositories:
sudo apt-get update
sudo apt-get install -y docker.io
# or install Docker CE 18.06 from Docker's repositories for Ubuntu or Debian:
## Install prerequisites.
sudo apt-get update && sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y
@fredhsu
fredhsu / start-ec2-tag.sh
Created May 18, 2018 20:05
Start all ec2 instances with a specific usage tag
aws ec2 start-instances --instance-ids $(aws ec2 describe-instances --filters "Name=tag:Usage,Values=kube" --query 'Reservations[*].Instances[*].[InstanceId]' --output text)
@fredhsu
fredhsu / install-docker.sh
Last active April 19, 2023 18:07
Install docker engine 1.12 on Ubuntu 16.04
#!/bin/bash
sudo apt-get update
sudo apt-get install \
linux-image-extra-$(uname -r) \
linux-image-extra-virtual -y
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
@fredhsu
fredhsu / ubuntudocker.sh
Last active September 6, 2024 10:15
Shell script to install Docker CE on ubuntu and post-install user configuration
#!/bin/bash
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
@fredhsu
fredhsu / addquotes.sh
Created April 6, 2017 17:35
One liner to add quotes, a carriage return, and a trailing comma with sed
sed 's/.*/"&\\n",/'