Skip to content

Instantly share code, notes, and snippets.

@alkampfergit
alkampfergit / gist:f9fe4f38c85e04f899fe4e4c20f6979a
Last active October 18, 2019 22:03
Drop all mongo databases except the admin and local database
var dbs = db.getMongo().getDBNames()
for(var i in dbs){
db = db.getMongo().getDB( dbs[i] );
if (db.getName() !== 'admin' && db.getName() !== 'local')
{
print( "dropping db " + db.getName() );
db.dropDatabase();
}
}
@alkampfergit
alkampfergit / gist:53565f6dcb87eda80a86fbc108249f36
Created June 27, 2017 06:50
Enable mongo profiling, deleting old system.profile collection
db.setProfilingLevel(0, 100)
db.getCollection('system.profile').drop()
db.setProfilingLevel(1,100)
@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
[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: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();
}
}

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 / winget-upgrade.ps1
Last active December 8, 2024 12:57
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
@alkampfergit
alkampfergit / WingetUpgrade.ps1
Last active November 25, 2024 17:46
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 / 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 / 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