Skip to content

Instantly share code, notes, and snippets.

View kelverarruda's full-sized avatar
🌴
On vacation

Kelver Arruda kelverarruda

🌴
On vacation
View GitHub Profile
@kelverarruda
kelverarruda / login-ad-test.ps1
Created April 28, 2024 16:50
How to test AD login using powershell
$cred = Get-Credential
$username = $cred.username
$password = $cred.GetNetworkCredential().password
$CurrentDomain = "LDAP://" + ([ADSI]"").distinguishedName
$domain = New-Object System.DirectoryServices.DirectoryEntry($CurrentDomain,$UserName,$Password)
write-host $CurrentDomain
if ($domain.name -eq $null)
@kelverarruda
kelverarruda / login-ad-test.py
Created April 28, 2024 16:13
How to test login in AD using python
from ldap3 import Server, Connection, SIMPLE, SYNC, ALL
def authenticate_user(username, password, domain_controller):
server = Server(domain_controller, get_info=ALL)
try:
conn = Connection(server, user=username, password=password, authentication=SIMPLE, auto_bind=True)
if conn.bound:
print(f"User '{username}' authenticated successfully.")
@kelverarruda
kelverarruda / reload-mount-fstab.md
Created April 15, 2024 13:07
How to force reload mount fstab?

I had to do:

sudo systemctl daemon-reload
sudo systemctl restart remote-fs.target

To reload an entry to mount a local filesystem, you should use:

@kelverarruda
kelverarruda / create-repo-azure-devops.md
Last active March 6, 2024 02:00
How to create repository using REST API Azure DevOps

How to create repository using REST API Azure DevOps

First obtain your Personal Access Token (PAT):

Go to your Azure DevOps organization. Navigate to User settings > Personal access tokens. Generate a new token with the required permissions (Code > Read & Write). Keep the generated token secure as it grants access to your Azure DevOps resources.

image

@kelverarruda
kelverarruda / application.yml
Created January 31, 2024 00:22
How to show sql params debug console on spring boot
# Add this your config. application file
spring:
jpa:
show-sql: true
properties:
hibernate:
format_sql: true
# this show binding params
logging:
@kelverarruda
kelverarruda / jetbrains-fix.md
Created September 9, 2023 01:19
Cannot connect to already running IDE instance. Exception: Process 2 is still running (info in comments)

Removing the .lock in

/home/your-user/.var/app/com.jetbrains.DataGrip/config/JetBrains/DataGrip2023.2/

Or remove paths

/home/your-user/.var/app/com.jetbrains.DataGrip/cache/JetBrains/ /home/your-user/.var/app/com.jetbrains.DataGrip/config/JetBrains/

@kelverarruda
kelverarruda / forticlient-fix.md
Last active September 5, 2023 18:10
Forticlient fix error config routing table failed on linux Fedora 38
#!/bin/bash
# version 2 thanks to @dhx-mike-palandra

echo "Creating /etc/NetworkManager/conf.d/99-forticlient.conf..."
sudo cat > /etc/NetworkManager/conf.d/99-forticlient.conf << 'EOF'
[keyfile]
unmanaged-devices=interface-name:~vpn*,type:tun
EOF
@kelverarruda
kelverarruda / dry-run-docker.md
Created May 22, 2023 16:35
Test docker compose file

Use Dry Run mode to test your command

Use --dry-run flag to test a command without changing your application stack state. Dry Run mode shows you all the steps Compose applies when executing a command, for example:

docker compose --dry-run up --build -d
[+] Pulling 1/1
 ✔ DRY-RUN MODE -  db Pulled                                                                                                                                                                                                               0.9s
[+] Running 10/8
 ✔ DRY-RUN MODE -    build service backend                                                                                                                                                                                                 0.0s
@kelverarruda
kelverarruda / export-powershell.ps
Created May 17, 2023 21:51
Export history commands PowerShell
(Get-PSReadlineOption).HistorySavePath
@kelverarruda
kelverarruda / .wslconfig
Created February 2, 2023 13:43
limit memory and cpu wslconfig
# Settings apply across all Linux distros running on WSL 2
[wsl2]
# Limits VM memory to use no more than 4 GB, this can be set as whole numbers using GB or MB
memory=4GB
# Sets the VM to use two virtual processors
processors=2