Skip to content

Instantly share code, notes, and snippets.

View fabiogomezdiaz's full-sized avatar

Fabio Gomez Diaz fabiogomezdiaz

View GitHub Profile
@fabiogomezdiaz
fabiogomezdiaz / use_match_certificate_for_cicd.sh
Last active July 22, 2018 22:08
To be able to decrypt certificate
#!/bin/bash
# Based on GitHub Issue: https://github.com/fastlane/fastlane/issues/12260
set -o pipefail
if [[ -z "$1" ]] || [[ -z "$2" ]] || [[ -z "$3" ]] || [[ -z "$4" ]]; then
echo "usage: $0 <MATCH_P12_FILE> <MATCH_CER_FILE> <MATCH_PROVISIONING_PROFILE_FILE> <MATCH_PASSWORD>"
exit 1
fi
P12=$1
@fabiogomezdiaz
fabiogomezdiaz / kubernetes_set_service_account_context.sh
Created July 9, 2018 22:25
Kubernetes: Set kubectl context using existing service account
#!/bin/bash
#set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
#!/bin/bash
#set -e
#set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
@fabiogomezdiaz
fabiogomezdiaz / kubernetes_add_service_account_kubeconfig.sh
Created July 9, 2018 22:23
Kubernetes: Create Service Account, download certificate, and set context
#!/bin/bash
#set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
@fabiogomezdiaz
fabiogomezdiaz / ubuntu_enable_root_ssh.sh
Created July 6, 2018 19:13
Ubuntu: Enable ssh root login
#!/bin/bash
# Become root
sudo su
# Create root password
passwd
# Install java and ssh
apt-get update
apt-get install -y openssh-server
@fabiogomezdiaz
fabiogomezdiaz / ubuntu_assign_ip.sh
Last active July 6, 2018 19:06
Ubuntu: Assign IP
#!/bin/bash
# Become root
sudo su
# Update /etc/network/interfaces
NEW_IP=$(ip route get 8.8.8.8 | awk '{print $NF; exit}')
sed -i 's/dhcp/static/g' /etc/network/interfaces
echo " address ${NEW_IP}" >> /etc/network/interfaces
echo " netmask 255.255.0.0" >> /etc/network/interfaces
echo " broadcast 172.16.255.255" >> /etc/network/interfaces
@fabiogomezdiaz
fabiogomezdiaz / ubuntu_java_ssh_root.sh
Last active July 6, 2018 19:12
Ubuntu: Install Java and root-enabled openssh server
#!/bin/bash
# Install java and ssh
sudo apt-get update
# Java
sudo apt-get install -y default-jdk
sudo echo "JAVA_HOME=\"/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java\"" >> /etc/environment
touch ~/.bashrc
echo "source /etc/environment" >> ~/.bashrc
. ~/.bashrc
@fabiogomezdiaz
fabiogomezdiaz / glusterfs_ubuntu_install.sh
Last active July 2, 2018 01:46
Install GlusterFS on Ubuntu
#!/bin/bash
# Install software-properties-common
sudo apt-get install -y software-properties-common
# Then add the community GlusterFS PPA:
sudo add-apt-repository ppa:gluster/glusterfs-3.8
sudo apt-get update
# Finally, install the packages:
sudo apt-get install -y glusterfs-server
#!/bin/bash
set -x
# 1. Become sudo
sudo su
# 2. Install Docker
apt-get update
apt-get install -y docker.io
@fabiogomezdiaz
fabiogomezdiaz / kubeadm-create-weave-net-k8s-master.sh
Last active September 13, 2023 13:53
Create Weave-Net-Enabled Kubernetes Cluster with kubeadm
#!/bin/bash
set -x
# 1. Become sudo
sudo su
# 2. Install Docker
apt-get update
apt-get install -y docker.io