Skip to content

Instantly share code, notes, and snippets.

View f9n's full-sized avatar
💭
I may be slow to respond.

Fatih Sarhan f9n

💭
I may be slow to respond.
View GitHub Profile
@f9n
f9n / aws_cloudwatch_generic_alarms.py
Last active August 15, 2022 08:38
Generic alarms for Aws Cloudwatch
# In 2019
import os
import json
import sys
import time
import copy
# Import requirement python packages
file_path = os.path.dirname(__file__)
module_path = os.path.join(file_path, "env")
@f9n
f9n / undefined_ec2_instance_name.py
Last active August 15, 2022 08:37
Undefined ec2 instance name alert
# In 2019
import os
import json
import time
import boto3
TOPIC_NAME = os.getenv("TOPIC_NAME", "FatihMail")
SLEEP_TIME = os.getenv("SLEEP_TIME", 300)
@f9n
f9n / pytesseract-rest-api.py
Created June 8, 2022 12:16
Pytesseract Rest Api
import json
from flask import Flask, request
from werkzeug.utils import secure_filename
import pytesseract
app = Flask(__name__)
@f9n
f9n / app.py
Created March 13, 2022 19:26
Python-Flask: Save the uploaded image to multiple storages
# Fork: https://pythonbasics.org/flask-upload-file/
# Issues
# - Empty request file object
from flask import Flask, render_template, request
from werkzeug import secure_filename
app = Flask(__name__)
@app.route('/upload')
def upload_file():
@f9n
f9n / keybase.md
Created April 23, 2021 12:01
Keybase

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@f9n
f9n / gatekeeper-config.yml
Last active April 1, 2021 00:49
Opa/Gatekeeper Config Example
apiVersion: config.gatekeeper.sh/v1alpha1
kind: Config
metadata:
name: config
namespace: "gatekeeper-system"
spec:
match:
- excludedNamespaces: ["kube-system", "gatekeeper-system"]
processes: ["*"]
@f9n
f9n / privileged-container.yml
Last active March 29, 2021 11:23
Opa/Gatekeeper-Library Constraints - Examples
apiVersion: constraints.gatekeeper.sh/v1beta1
kind: K8sPSPPrivilegedContainer
metadata:
name: psp-privileged-container
spec:
match:
kinds:
- apiGroups: [""]
kinds: ["Pod"]
@f9n
f9n / monitor-external-etcd-cluster-with-p8s-operator.md
Created June 15, 2020 17:09
Monitoring External Etcd Cluster With Prometheus Operator
@f9n
f9n / unbound-cheat-sheet.md
Last active April 16, 2024 01:38
Unbound Cheat Sheet

Unbound Cheat Sheet

Installation

$ yum install -y unbound

Setup SSL keys for unbound-control

@f9n
f9n / consul-service-filter.sh
Last active November 10, 2021 20:54
Get consul services with filter
#!/usr/bin/env bash
# export CONSUL_HTTP_ADDR=http://127.0.0.1:8500
# export CONSUL_HTTP_TOKEN=...
service=$1
filter_expression=$2
mode=${3:-'health'}
if [ -z $CONSUL_HTTP_ADDR ]; then