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 / 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 / uninstall-trend-micro.sh
Created April 13, 2020 19:11
Uninstall Trend Micro Security script
#!/bin/sh
# Credits:
# https://www.jamf.com/jamf-nation/discussions/28033/uninstall-trend-micro-security-script
# Copyright: EVRY
# Filename: UninstallTrend.sh
# Requires: -
# Purpose: Removes Trend Micro Security
# Contact: Anders Holmdahl <anders.holmdahl@evry.com>
# Mod history: 2018-01-31
@f9n
f9n / redis_delete_keys_without_ttl.sh
Last active February 3, 2023 09:05 — forked from patrickhulce/findkeys.sh
Delete all keys without a TTL in Redis
#!/bin/sh
LIMIT=$1
redis-cli keys "*" | head -n $LIMIT > keys.txt
cat keys.txt | xargs -n 1 -L 1 redis-cli ttl > ttl.txt
paste -d " " keys.txt ttl.txt | grep .*-1$ | cut -d " " -f 1 | xargs redis-cli del
@f9n
f9n / windows10qemu.md
Last active November 12, 2022 09:41
Running Windows 10 in a UEFI enabled QEMU environment with KVM.
@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 / 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
@f9n
f9n / kube-cluster-merger.sh
Last active August 10, 2021 20:24
Kube Cluster Merger
#!/usr/bin/env bash
DIRPATH=$1
OUTFILE=$2
if [ -z "$1" ]; then
DIRPATH="$HOME/.kube/clusters"
fi
if [ -z "$2" ]; then
OUTFILE="$HOME/.kube/config"