Skip to content

Instantly share code, notes, and snippets.

View miticojo's full-sized avatar

Giorgio Crivellari miticojo

View GitHub Profile
@miticojo
miticojo / ocp-dump.sh
Created February 19, 2024 12:54
OKD/OCP dump
#!/bin/bash
# Function to redact sensitive fields within Secret objects
redact_secrets() {
secret_name=$1
namespace=$2
# Fields likely to contain sensitive information
sensitive_fields=("data.password" "data.token" "stringData")
@miticojo
miticojo / setup-pubsub-to-cb-cross-project.md
Last active January 11, 2023 11:19
GCP: setup Pub Sub Cloud Build Trigger across Project

Step by step procedure

If you need to setup a cross project trigger from Cloud Source Repository (aka CSR) to Cloud Build (aka CB), one way could be this one:

Setup env variables used

# this is the project containing the Cloud Source Repository
export PROJECT_CSR=my-csr-project
export CSR_REPO_NAME=my-repo
# this is the project running Cloud Build Job
@miticojo
miticojo / httpbin-istio.yaml
Last active November 21, 2022 11:26
quick istio httpbin test
apiVersion: v1
kind: ServiceAccount
metadata:
name: httpbin
---
apiVersion: v1
kind: Service
metadata:
name: httpbin
labels:
@miticojo
miticojo / cloudbuild.yaml
Last active October 27, 2021 06:39
Sync docker images from a remote registry with GCP Artifact service
steps:
- id: access remote docker registry
name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args: ['-c', 'docker login 10.1.0.5:5000 --username=$$USERNAME --password=$$PASSWORD']
secretEnv: ['USERNAME', 'PASSWORD']
- id: sync repo
name: quay.io/skopeo/stable
@miticojo
miticojo / http2pubsub.py
Last active May 23, 2020 18:59
Google Cloud Function push to Pub/Sub with Stackdriver Error Reporting integration
import os
import json
from flask import abort
from google.cloud import pubsub_v1, error_reporting
client = error_reporting.Client(project=os.getenv('GCP_PROJECT'))
publisher = pubsub_v1.PublisherClient()
topic_path = publisher.topic_path(os.getenv('GCP_PROJECT'), os.getenv('TOPIC_NAME'))
def http2pubsub(request):
@miticojo
miticojo / readme.md
Created March 5, 2020 08:02
Kernel and Network Tuning

Kernel and Network Tuning Consider tuning kernel and network and add this kind of following settings in /etc/sysctl.conf:

net.ipv4.tcp_max_syn_backlog = 40000
net.core.somaxconn = 40000
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
#!/bin/bash
APIURL=https://speech.googleapis.com
REMOTEIP=$(curl -s ipinfo.io/ip)
REMOTEASN=$(curl -s ipinfo.io/org | cut -d' ' -f1)
RESULTFILE="google-ping-api-results-$(date +%s).csv"
## Script start time
START=$(date +%s)
@miticojo
miticojo / k8s4rpi-installer.sh
Last active August 27, 2019 05:55
Setup K8S on raspberry 3 & 4 with raspian
#!/bin/bash
echo "disable swap"
swapoff -a
dphys-swapfile swapoff
dphys-swapfile uninstall
update-rc.d dphys-swapfile remove
apt purge -y dphys-swapfile
echo "update repo and install curl"
@miticojo
miticojo / ipsec.conf
Last active October 5, 2021 02:33
GCP VPN Site-2-Site using Strongswan (working)
# tested and working configuration
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
authby=psk
auto=start
dpdaction=hold
@miticojo
miticojo / barnabas-persistent.yml
Created September 14, 2018 14:28
Kafka with persistent storage - Template OCP
apiVersion: template.openshift.io/v1
kind: Template
metadata:
annotations:
description: This template installes Apache Zookeeper and Apache Kafka clusters.
For more information about using this template see https://github.com/EnMasseProject/barnabas
iconClass: fa pficon-topology
openshift.io/display-name: Apache Kafka (Persistent storage)
tags: messaging,datastore
template.openshift.io/documentation-url: https://github.com/EnMasseProject/barnabas