Skip to content

Instantly share code, notes, and snippets.

@fredhsu
fredhsu / ubuntudocker.sh
Last active December 17, 2023 17:24
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 / 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 / packstack-answers.txt
Created September 16, 2014 17:13
Packstack answers file for building OpenStack with VLAN type driver
[general]
# Path to a Public key to install on servers. If a usable key has not
# been installed on the remote servers the user will be prompted for a
# password and this key will be installed so the password will not be
# required again
CONFIG_SSH_KEY=/root/.ssh/id_rsa.pub
# Set to 'y' if you would like Packstack to install MySQL
CONFIG_MYSQL_INSTALL=y
@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 / eAPI-example-vlans.py
Created February 13, 2014 06:36
Quick example of JSON-RPC for Arista eAPI
import json
from jsonrpclib import Server
switches = ["172.22.28.156", "172.22.28.157", "172.22.28.158"]
username = "admin"
password = "admin"
# Going through all the switch IP addresses listed above
for switch in switches:
urlString = "https://{}:{}@{}/command-api".format(username, password, switch)
@fredhsu
fredhsu / eapi.rs
Created June 23, 2015 21:24
Using Rust/Hyper to do a HTTP Post with JSON
extern crate hyper;
extern crate core;
use std::io::Read;
use hyper::Client;
use hyper::header::Connection;
use hyper::header::Basic;
use hyper::header::Headers;
use core::str::FromStr;
@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 / 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