Skip to content

Instantly share code, notes, and snippets.

@alkampfergit
alkampfergit / program.cs
Last active August 31, 2023 14:35
Bug in hangfire Mongodb
using Hangfire;
using Hangfire.MemoryStorage;
using Hangfire.Mongo;
using Hangfire.Mongo.Migration.Strategies;
using Hangfire.Mongo.Migration.Strategies.Backup;
namespace ConsoleApp4
{
internal class Program
{
@alkampfergit
alkampfergit / Mongodb: Enable tracking for all queries on all databases
Last active April 12, 2023 08:00
Complete profile of mongodb databases
var mongo = db.getMongo()
var dbs = db.getMongo().getDBNames()
//Step 1 drop all existing profile and recreate profile with bigger collections.
for(var i in dbs){
db = db.getMongo().getDB( dbs[i] );
var name = db.getName();
if (name.startsWith("jarvis"))
{
db.setProfilingLevel(0)
@alkampfergit
alkampfergit / gist:535e19f1298f68a97855b905548a7088
Created February 13, 2023 13:28
Example in Get Get-ManagementRole -Cmdlet New-ServicePrincipal
Get-ManagementRole -Cmdlet New-ServicePrincipal  pwsh 
RoleEntries : {(Microsoft.Exchange.Management.PowerShell.E2010) Get-BookingMailbox
-RecipientTypeDetails, (Microsoft.Exchange.Management.PowerShell.E2010)
Test-MailboxAssistant -AssistantName -Process,
(Microsoft.Exchange.Management.PowerShell.E2010) Test-ServicePrincipalAuthorization
-Debug -ErrorAction -ErrorVariable -Identity -Organization -OutBuffer -OutVariable
-Resource -Verbose -WarningAction -WarningVariable,
(Microsoft.Exchange.Management.PowerShell.E2010) Get-ServicePrincipal -Debug
-ErrorAction -ErrorVariable -Identity -Organization -OutBuffer -OutVariable -Verbose
@alkampfergit
alkampfergit / single-keycloak-tls.yml
Created December 8, 2022 16:54
Keycloak on docker with TLS
version: '3.7'
services:
keycloak:
image: jboss/keycloak:latest
container_name: keycloak_tls
restart: always
ports:
# - 8080:8080
- 127.1.0.1:443:8443
@alkampfergit
alkampfergit / WingetUpgrade.ps1
Last active April 2, 2024 19:02
Upgrade with Winget being able to select list of software to skip
class Software {
[string]$Name
[string]$Id
[string]$Version
[string]$AvailableVersion
}
$upgradeResult = winget upgrade | Out-String
$lines = $upgradeResult.Split([Environment]::NewLine)
@alkampfergit
alkampfergit / winget-upgrade.ps1
Last active January 14, 2024 19:38
Winget upgrade output parsed into a real Powershell Object
class Software {
[string]$Name
[string]$Id
[string]$Version
[string]$AvailableVersion
}
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$upgradeResult = winget upgrade | Out-String

Keybase proof

I hereby claim:

  • I am alkampfergit on github.
  • I am alkampfer (https://keybase.io/alkampfer) on keybase.
  • I have a public key ASCoowbVuh_QzbqpCkVkS8rjtDZPLRNaLKMNiBZ9uZzb8wo

To claim this, I am signing this object:

@alkampfergit
alkampfergit / gist:4f09ae6bc31429876fc2e2f7a488d27f
Created January 15, 2018 10:05
Mongodb: Delete db starts with
var dbs = db.getMongo().getDBNames()
for(var i in dbs){
db = db.getMongo().getDB( dbs[i] );
if (db.getName().startsWith('jarvis-support-test') )
{
print( "dropping db " + db.getName() );
db.dropDatabase();
}
}
[diff]
tool = vsdiffmerge
[difftool]
prompt = true
[difftool "vsdiffmerge"]
cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe\" \"$LOCAL\" \"$REMOTE\" //t
keepbackup = false
trustexistcode = true
[merge]
tool = vsdiffmerge
@alkampfergit
alkampfergit / gist:fca40445f118095e37f549f7058e71cd
Created January 9, 2018 08:47
Configure Visual Studio 2013 as Git Diff and Merge tool
[diff]
tool = vsdiffmerge
[difftool]
prompt = true
[difftool "vsdiffmerge"]
cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\vsdiffmerge.exe\" \"$LOCAL\" \"$REMOTE\" //t
keepbackup = false
trustexistcode = true
[merge]
tool = vsdiffmerge