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 / 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 / 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 / collect-sysinfo.py
Last active March 4, 2025 13:35
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 / 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 / README.md
Created October 16, 2020 10:34 — forked from hofmannsven/README.md
Git Cheatsheet
@emrekgn
emrekgn / a-spring-cloud-config-server-application.yml
Last active July 19, 2024 18:32
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-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})