Skip to content

Instantly share code, notes, and snippets.

View bruceherve's full-sized avatar
💭
Architecting and building distributed systems

Bruce Hervé bruceherve

💭
Architecting and building distributed systems
View GitHub Profile
#!/usr/bin/env python
import boto3
s3 = boto3.resource('s3')
bucket = s3.Bucket('teracar-bucket')
bucket.object_versions.all().delete()
bucket.delete()
kubectl patch ingress $Ingressname -n $namespace -p '{"metadata":{"finalizers":[]}}' --type=merge
for app in $(kubectl get applications --output=jsonpath={.items..metadata.name}); do \
echo $app &&\
kubectl patch app $app --type json -p='[{"op": "remove", "path": "/metadata/finalizers"}]'; \
kubectl delete $app; \
done
@bruceherve
bruceherve / nginx.conf
Created February 20, 2023 07:58 — forked from alexishida/nginx.conf
NGINX config for SSL with Let's Encrypt certs
# Advanced config for NGINX
server_tokens off;
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options nosniff;
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
func SendPushNotification(deviceTokens []string) error {
decodedKey, err := getDecodedFireBaseKey()
if err != nil {
return err
}
opts := []option.ClientOption{option.WithCredentialsJSON(decodedKey)}
app, err := firebase.NewApp(context.Background(), nil, opts...)
@bruceherve
bruceherve / Dockerfile
Last active November 22, 2022 15:48
My multi stage Dockerfile for Go Lang Applications
# syntax=docker/dockerfile:1
# specify base image
FROM golang:1.19.3-alpine as build
# enable Go Modules
ENV GO111MODULE=on
# create working directory inside the image
WORKDIR /app
@bruceherve
bruceherve / ec2-apache.sh
Created October 26, 2022 14:28 — forked from herrera-ignacio/ec2-apache.sh
EC2 User data: install Apache web server for Amazon Linux 2 Image
#!/bin/bash
########################################
##### USE THIS WITH AMAZON LINUX 2 #####
########################################
# get admin privileges
sudo su
# install httpd (Linux 2 version)

Keybase proof

I hereby claim:

  • I am bruceherve on github.
  • I am bruceherve (https://keybase.io/bruceherve) on keybase.
  • I have a public key ASBBrIuovhK8JrMEcBkO4oE5PwYdyu9a29GEV_vSZnSnNQo

To claim this, I am signing this object:

@bruceherve
bruceherve / Nginx_Minio_SSL_Term.md
Created June 8, 2022 14:27 — forked from nitisht/Nginx_Minio_SSL_Term.md
Self-signed certificate setup with Nginx proxying requests to Minio Server

Nginx SSL termination for Minio server load balanced setup

This document explains the steps required to set up Nginx proxy and SSL termination for Minio servers running in the backgronud.

Generate self signed certificate

Create a directory /etc/nginx/ssl/domain.abc, here domain.abc is the name of your website domain. Then use the below commands

sudo openssl genrsa -out private.key 2048
sudo openssl req -new -x509 -days 3650 -key private.key -out public.crt -subj "/C=US/ST=state/L=location/O=organization/CN=domain.abc"
@bruceherve
bruceherve / minio-nginx-selfsigned.sh
Created June 7, 2022 12:44 — forked from superseb/minio-nginx-selfsigned.sh
Minio + NGINX in Docker using self signed certificates
#!/bin/bash
if [ "$#" -lt 0 ]; then
echo "Usage: $0"
exit 1
fi
echo "Generating nip.io based on found external IP"
FOUNDIP=$(docker run --rm --net=host appropriate/curl https://api.ipify.org)
APIFQDN="minio-api.${FOUNDIP}.nip.io"
FQDN="minio.${FOUNDIP}.nip.io"