Skip to content

Instantly share code, notes, and snippets.

View zbalkan's full-sized avatar
💻
back again

Zafer Balkan zbalkan

💻
back again
View GitHub Profile
$officeFolder = Get-ChildItem -Path 'C:\Program Files\Microsoft Office\' -Filter Office* | Select-Object -ExpandProperty Name
$currentPath = 'C:\Program Files\Microsoft Office\'+$officeFolder+'\OneNote'
$newPath = 'C:\Program Files\Microsoft Office\'+$officeFolder+'\OneNoteOLD'
Rename-Item $currentPath $newPath
$drivers = pnputil /enum-drivers
$drivers -split '\r?\n' | select-string -Pattern "prnms006.inf" -Context 1,0 | % {
$pubName = $_.Context.PreContext[0]
}
@zbalkan
zbalkan / Wazuh pain points.md
Last active September 20, 2024 13:53
After I started to use Wazuh, around June 2022, I came across many pain points. Here, I recorded and grouped some of them together. There is no specific order, neither alphabetical nor by importance.
# Personal .nanorc config
# Based on https://bash-prompt.net/guides/nanorc-settings/
# Non-default settings
set atblanks # wrap line at blanks.
set cutfromcursor # CTRL+K cuts from cursor position to end of line.
#set nohelp # Disable the help information (CTRL+G to view the help screen).
set softwrap # Enable softwrap of lines.
set suspend # Enables CTRL+Z to suspend nano.
#set tabsize 4 # Sets tab-to-spaces size to 4.
<#
.Synopsis
Script for creating WMI Filters for use with Group Policy Manager.
.DESCRIPTION
The Script will create several WMI Filters for filtering based on:
- Processor Architecture.
- If the Hosts is a Virtual Machine
- Operating System Version.
- Type of Operating System.
- If Java is installed
@zbalkan
zbalkan / TOTP.ps1
Last active February 5, 2024 12:41
TOTP (Time-based One-time Password) cmdlet
<#
.Synopsis
Time-based One-Time Password Algorithm (RFC 6238)
.DESCRIPTION
Based on the script of Jon Friesen - https://gist.github.com/jonfriesen/234c7471c3e3199f97d5
.EXAMPLE
Get-OTP -Secret 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567' # Default OTP length is 6 digits and period is 30 seconds
.EXAMPLE
totp -Secret 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567' # you can use totp or otp alias
.EXAMPLE

Keybase proof

I hereby claim:

  • I am zbalkan on github.
  • I am zbalkan (https://keybase.io/zbalkan) on keybase.
  • I have a public key ASBBqweJA8AtahYGZFH_5frCdso79FPav7P4qXIcoLlVMAo

To claim this, I am signing this object:

@zbalkan
zbalkan / Get-WinCredential.ps1
Last active February 21, 2025 05:11
Get-WinCredential
<#
.Synopsis
Shows Windows native credential dialog on PowerShell 7.x and VS Code.
.DESCRIPTION
The cmdlet utilizes Windows native code based on P/Invoke calls. The parameters and output are the same as Get-Credential cmdlet. Based on the example: https://www.developerfusion.com/code/4693/using-the-credential-management-api/
.SYNTAX
Get-WinCredential [[-UserName] <string>] -Message <string> [<CommonParameters>]
.EXAMPLE
Get-WinCredential
.EXAMPLE
# Reg2CI (c) 2021 by Roger Zander
if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\Applications\photoviewer.dll") -ne $true) { New-Item "HKLM:\SOFTWARE\Classes\Applications\photoviewer.dll" -Force -ErrorAction SilentlyContinue };
if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\Applications\photoviewer.dll\shell") -ne $true) { New-Item "HKLM:\SOFTWARE\Classes\Applications\photoviewer.dll\shell" -Force -ErrorAction SilentlyContinue };
if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\Applications\photoviewer.dll\shell\open") -ne $true) { New-Item "HKLM:\SOFTWARE\Classes\Applications\photoviewer.dll\shell\open" -Force -ErrorAction SilentlyContinue };
if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\Applications\photoviewer.dll\shell\open\command") -ne $true) { New-Item "HKLM:\SOFTWARE\Classes\Applications\photoviewer.dll\shell\open\command" -Force -ErrorAction SilentlyContinue };
if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\Applications\photoviewer.dll\shell\open\DropTarget") -ne $true) { New-
@zbalkan
zbalkan / .gitconfig
Last active February 29, 2024 17:33
My gitconfig
[user]
name = Zafer Balkan
email = [email protected]
username = zbalkan
signingkey = EECD6A2984E3EEE3
[init]
defaultbranch = master
[core]
pager = delta
autocrlf = true