Skip to content

Instantly share code, notes, and snippets.

View emrekgn's full-sized avatar

Emre Kağan Akkaya emrekgn

View GitHub Profile
@emrekgn
emrekgn / README-fail2ban-keycloak.md
Created December 16, 2021 19:16 — forked from drmalex07/README-fail2ban-keycloak.md
Use fail2ban to block brute-force attacks to keycloak server. #keycloak #fail2ban #brute-force-attack

Add regular-expression filter under /etc/fail2ban/filter.d/keycloak.conf:

[INCLUDES]

before = common.conf

[Definition]

_threadName = [a-z][-_0-9a-z]*(\s[a-z][-_0-9a-z]*)*
_userId = (null|[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})
@emrekgn
emrekgn / a-spring-cloud-config-server-application.yml
Last active June 25, 2023 23:55
Spring Cloud Config Server and Client example configuration
# application.yml file of the config server (Spring Cloud Config Server)
server:
port: 9999 # or whatever
spring:
application:
name: config-service
cloud:
config:
server:
git:
@emrekgn
emrekgn / README.md
Created October 16, 2020 10:34 — forked from hofmannsven/README.md
Git Cheatsheet
@emrekgn
emrekgn / latex-tr.md
Created November 30, 2018 08:28
LATEX Türkçe karakterler
  • \u{g} – ğ
  • \u{G} – Ğ
  • \c{c} – ç
  • \c{C} – Ç
  • \c{s} – ş
  • \c{S} – Ş
  • \”{u} – ü
  • \”{U} – Ü
  • \”{o} – ö
  • \”{O} – Ö
@emrekgn
emrekgn / collect-sysinfo.py
Last active February 19, 2024 18:45
Collect system information (BIOS, CPU, GPU, installed packages, motherboard and more) in a cross-platform manner!
#!/usr/bin/env python
"""
Print (and write to JSON file) system information in a cross-platform manner.
Output contains information about platform, BIOS, CPU, memory, disk, GPU, network, peripheral devices, installed
packages, motherboard and users.
This script heavily relies on psutil and some other bash/powershell commands. See requirements.txt for dependency list.
@emrekgn
emrekgn / DummyController.java
Created February 14, 2018 20:47
DataTables - Spring Boot pagination example
package com.dummy.datatables.example;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
@emrekgn
emrekgn / list-users.ps1
Last active October 9, 2017 11:06
Powershell Tricks - List Users with groups, home directory and disabled status
#
# Prints user name, groups, home directory and disabled status
#
$adsi = [ADSI]"WinNT://$env:COMPUTERNAME"
$adsi.Children | where { $_.SchemaClassName -eq 'user' } | Foreach-Object {
$groups = $_.Groups() | Foreach-Object {
$_.GetType().InvokeMember('Name', 'GetProperty', $null, $_, $null)
}
$user = Get-WmiObject Win32_UserAccount -filter "LocalAccount=True AND Name='$($_.Name)'"
@emrekgn
emrekgn / when-to-use-jta-xa.md
Created September 21, 2017 12:31
When to use JTA / XA

When to use?

JTA/XA is a kind of system insurance against data corruption (and the resulting business losses). The most common use cases are: Processing JMS messages from a queue and inserting the results in a database: you don't want a crash to lose messages whose results are not yet stored in the database. Updating two or more legacy back-end systems in the same transaction In general, whenever you access more than one back-end system in the same transaction the use of JTA/XA is highly recommended. Otherwise, the risk of data loss or corruption is too high (and not necessarily visible!). Many programmers try to avoid the "overhead" of JTA/XA by programming application-specific recovery code (such as trying to handle duplicate requests, storing extra state in the database, etc). However, all these approaches are brittle (not reusable, application-specific, and hard to test). In the end, the perceived overhead of JTA/XA is often replaced by equivalent but buggy overhead at the application level.

A sample

@emrekgn
emrekgn / ELK-kurulumu.md
Created August 25, 2017 13:56
Debian tabanlı sistemlerde Elasticsearch, Logstash, Kibana kurulumu

ELK (Elasticsearch, Logstash, Kibana) Kurulumu

Bu kılavuz Debian tabanlı Linux sistemlerde (Debian, Ubuntu, Mint, Pardus gibi) Filebeat ile birlikte ELK (Elasticsearch, Logstash, Kibana) kurulumunu anlatır.

  1. Kurulum yapılacak sistemde Java sürümü 8 veya üstü olmalıdır. java -version komutu ile sürüm kontrol edilebilir.
  2. wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - komutuylaa Elastic APT deposunun anahtarını sisteme tanımlamak için çalıştırılır.
  3. echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list komutu ile Elastic APT deposu sisteme eklenir.
  4. sudo apt-get update && sudo apt-get install -y elasticsearch logstash kibana filebeat komutu ile Elasticsearch, Logstach, Kibana bileşenleri ve Filebeat ajan yazılımı kurulur.
  5. /etc/filebeat/filebeat.yml dosyası dilediğiniz bir metin editörü yardımıyla (sudo olarak!) açılarak Elasticsearch'e ait olan alanlar silinmeli ya d
@emrekgn
emrekgn / jdk8-kurulum.md
Created August 24, 2017 10:47
Java 8 Kurulumu

Java 8 kurulumu

Debian tabanlı (Debian, Ubuntu, Mint, Pardus gibi) Linux sistemlerde (paket deposunda bulunmadığı taktirde) JDK8 aşağıdaki adımlar izlenerek kurulabilir:

  1. sudo apt-get install software-properties-common komutu ile (eğer yoksa) add-apt-repository komutuna ilişkin kurulum yapılır.
  2. sudo add-apt-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" komutuyla Java 8'in bulunduğu paket deposu sisteme eklenir.
  3. sudo apt-get update && sudo apt-get install oracle-java8-installer komutuyla Oracle JDK 8 kurulumu tamamlanır.
  4. Kurulumu sınamak adına java -version komutu çalıştırılarak sürümün doğruluğu kontrol edilebilir.

Java kurulumlarının yönetimi