Skip to content

Instantly share code, notes, and snippets.

View mayrund's full-sized avatar

May run mayrund

View GitHub Profile
@mayrund
mayrund / Add-AppRolesToUserOrGroup.ps1
Created June 29, 2023 12:04
A script to assign application roles to a user or group in Azure AD.
# Parameters
$tenantId = "<tenant-id>"
$userOrGroupOId = "<user-or-group-id>"
$appRegistrationName = "<app-registration-name>"
# Connect to Azure AD using the specified tenant ID
Connect-AzureAD -TenantId $tenantId > Out-Null
# Retrieve the Azure AD application with the specified display name
$application = Get-AzureADApplication -All $true | Where-Object {$_.DisplayName -eq $appRegistrationName}
@mayrund
mayrund / DisableDeleteAppRegistrationRoles.ps1
Created June 26, 2023 13:45
Azure Disable & Delete App Registration Roles
# Disable and delete app registration roles
Connect-AzureAD
$registrationName = '<APP-REGISTRATION-NAME>'
$application = Get-AzureADApplication -Filter "DisplayName eq '$registrationName'"
$application.AppRoles.ForEach({ $_.IsEnabled = $false })
Set-AzureADApplication -ObjectId $application.ObjectId -AppRoles $application.AppRoles
Set-AzureADApplication -ObjectId $application.ObjectId -AppRoles @()
@mayrund
mayrund / gist:30bcb1b7feaeb6d4c85cdb0a423088ce
Created July 12, 2021 14:11
Golang windows - Access denied
If you're getting Access Denied or the following error:
Operation did not complete successfully because the file contains a virus or potentially unwanted software.
You need to disable Windows defender using (PS):
Set-MpPreference -DisableRealtimeMonitoring $true
@mayrund
mayrund / iis_export_import.bat
Created May 8, 2020 07:52
IIS Export & Import
# Export
%windir%\system32\inetsrv\appcmd list apppool /config /xml > app_pools.xml
%windir%\system32\inetsrv\appcmd list site /config /xml > sites.xml
# Import
%windir%\system32\inetsrv\appcmd add apppool /in < app_pools.xml
%windir%\system32\inetsrv\appcmd add site /in < sites.xml
@mayrund
mayrund / openvpn_config.txt
Last active August 1, 2019 08:43
extra OpenVPN configuration
# DNS
# add this to keep using the local DNS server
pull-filter ignore "dhcp-option DNS"
# or add this if you would like to use a specific DNS server when connecting with
dhcp-option DNS 10.11.12.13
@mayrund
mayrund / locale_fix.sh
Created July 29, 2017 15:39
Armbian fix locale problem
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
@mayrund
mayrund / Network Initialization Failed C:\PDOXUSERS.NET Permission Denied
Created November 21, 2016 10:57
Network Initialization Failed C:\PDOXUSERS.NET Permission Denied
EDBEngineError-Network Initialization Failed
Permission Denied
File C:\PDOXUSERS.NET
Directory: c:\
1. Create a new directory such as C:\BDEShare or use an existing folder (like My Documents).
2. Start the BDE Administration utility, located in: C:\Program Files (x86)\Common Files\Borland Shared\BDE\BDEADMIN.EXE
3. Click Configuration -> Drivers -> Native -> Paradox
4. Cick on the path next to NET DIR
5. Click the browse button to the right of the path
@mayrund
mayrund / C#_CaptureHTTP_request
Created November 9, 2016 13:47
Capture HTTP request
private string GetRequest()
{
var headers = String.Empty;
StringBuilder sb = new StringBuilder();
sb.AppendLine("URL: " + Context.Request.Url);
sb.AppendLine("IP address:" + Context.Request.UserHostAddress);
sb.AppendLine("HttpMethod " + Request.HttpMethod);
sb.AppendLine("Header:");
foreach (var key in Request.Headers.AllKeys)
sb.AppendLine(key + "=" + Request.Headers[key]);
RESTORE HEADERONLY FROM DISK = 'D:\dbbackup\iMISMain15_15.2.5.3815.bak'
@mayrund
mayrund / firebird_sql_add_user.txt
Created September 28, 2016 11:57
Firebird SQL Add User
1. gsec -user SYSDBA -password masterkey
2. add test -pw test -fname Test -lname Account
3. exit
4. login with user test & password test