Skip to content

Instantly share code, notes, and snippets.

View lioneltchami's full-sized avatar
🏠
Working from home

Lionel Tchami lioneltchami

🏠
Working from home
View GitHub Profile
@lioneltchami
lioneltchami / aws.json
Created September 24, 2021 17:43
CloudFormation Wordpress Template
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Enterprise Wordpress Setup",
"Parameters": {
"KeyName": {
"Description": "Key Pair name",
"Type": "AWS::EC2::KeyPair::KeyName",
"Default": "mykey"
}
},
@lioneltchami
lioneltchami / k8s_sh
Created October 30, 2021 00:03
Bash script to install k8s on linux bare metal
#######################
# === All Systems === #
#######################
# Ensure system is fully patched
sudo yum -y makecache fast
sudo yum -y update
# Disable swap
sudo swapoff -a
@lioneltchami
lioneltchami / bulkCloneMoreThan100Repos.md
Created November 10, 2021 04:51 — forked from leadegroot/bulkCloneMoreThan100Repos.md
bulk clone github repos from a user or organisation

IF there are 100 or fewer repos, simply run:

curl -u $YOURUSERNAME -s https://api.github.com/orgs/$ORGNAME/repos?per_page=100 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'

(per https://gist.github.com/caniszczyk/3856584 )

and wait.

(Note when prompted for password, they do not mean your github web password, they mean your oauth token - all command line requests for password are actually for oath token. See https://github.com/blog/1509-personal-api-tokens to generate a token.)

stages:
- analyze
analyze:sonar:
stage: analyze
image:
name: sonarsource/sonar-scanner-cli:4.5
entrypoint: [""]
variables:
# Defines the location of the analysis task cache
#!/usr/bin/env bash
set -euo pipefail
# Support aborting via SIGINT, without this bash will not exit the for loop until it's finished
trap 'exit 0' INT
# Usage example:
# bash migrate-state.sh '/home/myuser/terraform/destination-module' '/home/myuser/terraform/source-module' 'module.source' 'config/dev_backend.tfvars' 'config/dev_backend.tfvars'
# Arguments:
# $1 - destinationModuleDirectory: The directory in which the module resides where state should be moved to
stages:
- Test
kics-scan:
stage: Test
tags:
- docker
image: docker:latest
services:
- docker:dind
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "3.51.0"
}
}
}
provider "google" {
locals {
network_name = "kubernetes-cluster"
subnet_name = "${google_compute_network.vpc.name}--subnet"
cluster_master_ip_cidr_range = "10.100.100.0/28"
cluster_pods_ip_cidr_range = "10.101.0.0/16"
cluster_services_ip_cidr_range = "10.102.0.0/16"
}
resource "google_compute_network" "vpc" {
name = local.network_name
locals {
hostname = format("%s-bastion", var.bastion_name)
}
// Dedicated service account for the Bastion instance.
resource "google_service_account" "bastion" {
account_id = format("%s-bastion-sa", var.bastion_name)
display_name = "GKE Bastion Service Account"
}
output "ip" {
value = google_compute_instance.bastion.network_interface.0.network_ip
description = "The IP address of the Bastion instance."
}
output "ssh" {
description = "GCloud ssh command to connect to the Bastion instance."
value = "gcloud compute ssh ${google_compute_instance.bastion.name} --project ${var.project_id} --zone ${google_compute_instance.bastion.zone} -- -L8888:127.0.0.1:8888"
}