Skip to content

Instantly share code, notes, and snippets.

View rawc0der's full-sized avatar
🎯

Alin Spinu rawc0der

🎯
View GitHub Profile
@rawc0der
rawc0der / annotations.rego
Last active December 14, 2020 13:06
Rego Annotations -- Package for extracting Parameters and creating Exceptions from resource annotations (using Konstraint as core library)
package lib.annotations
# Annotations helper library used to extract policy metadata information from annotation fields
# Usage:
#
# import data.lib.annotations
# annotations = annotations.policy_annotations()
#
import data.lib.core
import data.lib.pods
@rawc0der
rawc0der / conftest.sh
Created November 3, 2020 11:39
Common rego definitions for Conftest and Gatekeeper policies
#!/bin/bash
conftest test -d ./lib/parameters.yaml -p ./lib/helpers.rego -p ./policies /k8s/resources
@rawc0der
rawc0der / crd2jsonschema.sh
Last active April 18, 2024 14:43
Extract openapi JSON schema from Kubernetes CRD manifest
#!/bin/bash
# Small utility function based on yq to extract openAPIV3Schema from CRD
# example: crd2jsonschema.sh ./crd-alertmanager.yaml
set -e
function crd2jsonschema() {
set -e
local xkgroup="x-kubernetes-group-version-kind"
local document="$1"
local openAPIV3Schema=$(mktemp -u)
@rawc0der
rawc0der / lets-encrypt-wildcard-certs-using-azure-dns-on-aks.md
Created June 21, 2020 21:25 — forked from marcopaga/lets-encrypt-wildcard-certs-using-azure-dns-on-aks.md
Let's encrypt wildcard TLS certificates for Azure DNS using cert-manager on AKS (Azure Kubernetes Service)

This gist will guide you through the setup of a wildcard Let's encrypt TLS certificate.

Let's encrypt

Let’s encrypt is one of a new kind of Certificate Authority. You can get a TLS certificate from them for your website free of charge and without any manual overhead. These certificates are trusted in most browsers that are out there and will show up as valid. Instead of sending Mails or even paper around you can call an API and prove your domain ownership with simple challenges. Basically you call the API with a hostname or domain name you need a TLS certificate for and you get back a challenge string that you need to put in a well known location on your http host or as a txt record in your dns system.

The little helper for Kubernetes: Cert-Manager

You can find many clients that manage the proces

@rawc0der
rawc0der / base.go
Created October 25, 2019 00:37 — forked from adigunhammedolalekan/base.go
Connect to a postgresql database using GORM
package models
import (
_ "github.com/jinzhu/gorm/dialects/postgres"
"github.com/jinzhu/gorm"
"os"
"github.com/joho/godotenv"
"fmt"
)
@rawc0der
rawc0der / package.json
Created September 19, 2019 20:58 — forked from jthomas/package.json
Using TensorFlow.js with MobileNet models for image classification on Node.js
{
"name": "tf-js",
"version": "1.0.0",
"main": "script.js",
"license": "MIT",
"dependencies": {
"@tensorflow-models/mobilenet": "^0.2.2",
"@tensorflow/tfjs": "^0.12.3",
"@tensorflow/tfjs-node": "^0.1.9",
"jpeg-js": "^0.3.4"
@rawc0der
rawc0der / dummy-web-server.py
Created November 15, 2018 14:00 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost
[INFO] ------------------------------------------------------------------------
[INFO] Building Kylin:Storage-HBase 1.5.2.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-remote-resources-plugin:1.5:process (default) @ kylin-storage-hbase ---
[INFO]
[INFO] --- maven-resources-plugin:2.4:resources (default-resources) @ kylin-storage-hbase ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /kylin/storage-hbase/src/main/resources
[INFO] Copying 3 resources
@rawc0der
rawc0der / cloud-config-local1.yaml
Last active April 9, 2016 16:22
CoreOS + Kubernetes 3 machine cluster deployment
#cloud-config
hostname: "coreos.local.1"
ssh_authorized_keys:
- ...
coreos:
etcd2:
# generate a new token for each unique cluster from https://discovery.etcd.io/new?size=3
# specify the initial size of your cluster with ?size=X
# discovery: https://discovery.etcd.io/64cdc949e85e49cbabe1f019b6c95408
# multi-region and multi-cloud deployments need to use $public_ipv4