Skip to content

Instantly share code, notes, and snippets.

View mreferre's full-sized avatar

Massimo Re Ferrè mreferre

View GitHub Profile
To add more user to the Windows bastion (Domain Controller), from a CMD:
for /l %i in (1, 1, 10) do (net user user%i <password> /ADD)
for /l %i in (11, 1, 11) do (net group "Domain Admins" user%i /ADD)
for /l %i in (11, 1, 11) do (net group "Enterprise Admins" user%i /ADD)
#!/bin/bash
# Massimo Re Ferre' massimo@it20.info
###########################################################
########### USER INPUTS ###########
###########################################################
# Variables AppServer component
RACK_ENV="${RACK_ENV:-'custom'}"
REDIS_SERVER_ENDPOINT="${REDIS_SERVER_ENDPOINT:-<here the IP or FQDN of the Redis endpoint>}"
@mreferre
mreferre / k8s-sa
Created April 26, 2018 12:34
Kubernetes Service Account
# Inspired by: https://stackoverflow.com/questions/42170380/how-to-add-users-to-kubernetes-kubectl
# this script creates a service account (user1) on a Kubernetes cluster (tested with AWS EKS 1.9)
# prereqs: a kubectl ver 1.10 installed and proper configuration of the heptio authenticator
# this has been tested on Linux in a Cloud9 environment (for MacOS the syntax may be slightly different)
**************************************************
******* Create an account *******
**************************************************
# Create service account for user user1
kubectl create sa user1
@mreferre
mreferre / Hyper-V-NAT.ps1
Last active June 8, 2023 10:08
PS commands to create a Hyper-V internal switch and NAT rules
# the following 3 lines of PowerShell creates an Internal Switch on Hyper-V (https://www.petenetlive.com/KB/Article/0001384)
New-VMSwitch -SwitchName "NAT-Switch" -SwitchType Internal
New-NetIPAddress -IPAddress 192.168.200.1 -PrefixLength 24 -InterfaceAlias "vEthernet (NAT-Switch)"
New-NetNAT -Name "NAT-Network" -InternalIPInterfaceAddressPrefix 192.168.200.0/24
# the following line of PowerShell creates a DNAT rule (80->80) from the outside into a VM (previously created an running on the Switch with IP .10) (https://www.petri.com/create-nat-rules-hyper-v-nat-virtual-switch)
Add-NetNatStaticMapping -ExternalIPAddress "0.0.0.0/24" -ExternalPort 80 -Protocol TCP -InternalIPAddress "192.168.200.10" -InternalPort 80 -NatName NAT-Network
@mreferre
mreferre / php
Created September 19, 2018 15:16
yum install -y php-cli php-gd php-mysqlnd php-curl php-json php-zip php-exif php-session php-mbstring
@mreferre
mreferre / Dockerfile
Last active December 7, 2018 11:02
Dockerfile for building a Greengrass 1.7 image for arm64
FROM amazonlinux:2
MAINTAINER massimo@it20.info
# This Dockerfile builds a GG image for the ARM64 platform
# curl this file: https://d1onfpft10uf5o.cloudfront.net/greengrass-core/downloads/1.7.0/aws-greengrass-docker-1.7.0.tar.gz
# untar it
# move into the directory
# curl this file: https://d1onfpft10uf5o.cloudfront.net/greengrass-core/downloads/1.7.0/greengrass-linux-aarch64-1.7.0.tar.gz
# replace the Dockerfile in the directory with this Dockerfile
# run this command: docker build -t gg-arm64:1.7 --build-arg "greengrass_release=greengrass-linux-aarch64-1.7.0.tar.gz" .
@mreferre
mreferre / Dockerfile
Last active August 20, 2019 00:16
Dockerfile (from alpine) for building a Greengrass 1.7 image for ARMv7
FROM alpine
MAINTAINER massimo@it20.info
# Set ENV_VAR for Greengrass RC to be untarred inside Docker Image
ARG greengrass_release
ENV GREENGRASS_RELEASE=${greengrass_release}
# This Dockerfile builds a GG image for the ARMv7 platform
# curl this file: https://d1onfpft10uf5o.cloudfront.net/greengrass-core/downloads/1.7.0/aws-greengrass-docker-1.7.0.tar.gz
# untar it
@mreferre
mreferre / Dockerfile
Last active December 8, 2018 21:12
Dockerfile (from centos) for building a Greengrass 1.7 image for ARMv7
FROM centos
MAINTAINER massimo@it20.info
# This Dockerfile builds a GG image for the ARM64 platform
# curl this file: https://d1onfpft10uf5o.cloudfront.net/greengrass-core/downloads/1.7.0/aws-greengrass-docker-1.7.0.tar.gz
# untar it
# move into the directory
# curl this file: https://d1onfpft10uf5o.cloudfront.net/greengrass-core/downloads/1.7.0/greengrass-linux-armv7l-1.7.0.tar.gz
# replace the Dockerfile in the directory with this Dockerfile
# run this command: docker build -t gg-armv7:1.7 --build-arg "greengrass_release=greengrass-linux-armv7l-1.7.0.tar.gz" .
@mreferre
mreferre / minikube-on-ubuntu-18.sh
Created July 16, 2019 11:46
Minikube-on-Ubuntu-18
# This script can be run on an i3.metal EC2 instance running Ubuntu 18 TLS and will setup minikube
#!/bin/bash
sudo apt update
sudo apt upgrade
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
sudo add-apt-repository "deb http://download.virtualbox.org/virtualbox/debian bionic contrib"
sudo apt update
sudo apt install virtualbox-6.0
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
# This should work on Kubernetes deployments on AWS that have an ALB ingress controller as well as App Mesh components deployed.
apiVersion: appmesh.k8s.aws/v1beta1
kind: Mesh
metadata:
name: MESH_NAME
---
apiVersion: appmesh.k8s.aws/v1beta1
kind: VirtualNode
metadata:
name: yelb-ui-node