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 / sezen.sh
Created May 9, 2020 13:07
Get all ip addresses on file
#!/usr/bin/env bash
# Credits
# https://stackoverflow.com/questions/427979/how-do-you-extract-ip-addresses-from-files-using-a-regex-in-a-linux-shell
file=$1
seperator=${2:-'\n'}
result=$(grep -E -o '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)' $file)
for ip in $result; do
@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 / nginx.conf
Last active March 21, 2020 19:06
Nginx Reverse Proxy for Nexus Docker Registries
### Credits
# https://visibilityspots.org/nexus-oss-repository-manager.html
user nginx;
worker_processes auto;
events {
worker_connections 1024;
}
@f9n
f9n / inventory
Created January 9, 2020 10:16
Alertmanager Cluster Setup
[alertmanagers]
10.250.250.1
10.250.250.2
10.250.250.3
@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 / RabbitmqAllQueuesOnAllVhosts.sh
Created November 7, 2019 12:31
rabbitmq list queues on all vhosts
#!/bin/bash
# https://stackoverflow.com/questions/43799932/rabbitmq-list-queues-on-all-vhosts
for i in $(rabbitmqctl list_vhosts); do
echo "vhost: $i" && rabbitmqctl list_queues -p $i;
done
@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"
@f9n
f9n / erlang-cookie-generator.sh
Last active September 30, 2019 13:36
Erlang Cookie Generator for Rabbitmq
@f9n
f9n / Spacewalk2.9_Centos7.md
Created September 16, 2019 07:51
Install Spacewalk 2.9 on Centos 7

Installation

  • Add the environment variables to /etc/environment
$ vi /etc/environment
LC_ALL="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LANGUAGE="en_US.UTF-8"
@f9n
f9n / MacOsDockerLoginProblem.md
Last active September 4, 2019 13:55
MacOS docker login problem

Problem

Error saving credentials: error storing credentials - err: exit status 1, out: The user name or passphrase you entered is not correct.

Resolution

  • Remove the line "credsStore": "osxkeychain" from ~/.docker/config.json
  • Deleting the file /usr/local/bin/docker-credential-osxkeychain