Skip to content

Instantly share code, notes, and snippets.

View hoetz's full-sized avatar

Florian Hötzinger hoetz

View GitHub Profile

Keybase proof

I hereby claim:

  • I am hoetz on github.
  • I am hoetz (https://keybase.io/hoetz) on keybase.
  • I have a public key whose fingerprint is 9554 A373 578A D037 C65A 6C76 904E 4E33 D948 ABD7

To claim this, I am signing this object:

@hoetz
hoetz / EditorServices.log
Created December 6, 2018 11:52
EditorServices.log
2018-12-06 11:44:32.283 [NORMAL] tid:13 in 'StartLogging' C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: line 181
PowerShell Editor Services Host v1.10.0.0 starting (PID 10624
Host application details:
Name: Visual Studio Code Host
Version: 1.10.0
ProfileId: Microsoft.VSCode
Arch: X64
@hoetz
hoetz / AzureAdAuth.fs
Created October 20, 2018 10:23
Secure ASP.NET Core F# Api with Azure AD
module AzureAdAuth
open System
open Microsoft.Extensions.DependencyInjection
open Microsoft.Extensions.Options
open Microsoft.AspNetCore.Authentication.JwtBearer
open Microsoft.IdentityModel.Tokens
open System.Text
open System.Threading.Tasks
@hoetz
hoetz / find-fsps-adgroup.ps1
Last active September 6, 2018 07:30
Find users from foreign domains in a Active Directory group and output them to CSV
#Find users from foreign domains in a Active Directory group and output them to CSV
$group=get-adgroup "mygroup" -Properties member
$domainController="mydc.company.loc"
$fsps = $group.member | where {$_ -like "*foreign*"}
$outputUsers = @()
foreach ($fsp in $fsps) {
$found = $fsp -match 'S-\d-\d-\d+-\d+-\d+-\d+-\w+'
if ($found) {
$usr = get-aduser $matches[0] -server $domainController -Properties displayname, useraccountcontrol, description, mail | select -Property samaccountname, displayname, useraccountcontrol, description, mail
$outputUsers += $usr
@hoetz
hoetz / aspnetcoreenvvars.md
Last active July 26, 2018 13:59
ASP.NET Core - overriding configuration values through environment variables

the appsettings json

  "Logging": {
    "LogLevel": {
      "Default": "Warning"
    }
  },
  "AllowedHosts": "*",
 "SQLServer":
@hoetz
hoetz / pipe-function-powershell.ps1
Created June 9, 2018 15:58
pipe_powershell_function
function PipeableFunction {
[cmdletbinding()]
Param (
[parameter(ValueFromPipeline)]
[string]$upn
)
@hoetz
hoetz / CachePersistence.fs
Created December 31, 2017 17:48
Naive MSAL TokenCache in F#
//based on https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/blob/90dca9e8a28102d7eb0d96d70e93350f5a0e095a/samples/desktop/SampleApp/CachePersistence.cs
module MicrosoftIdentityUtil
open Microsoft.Identity.Client
open System.IO
type CachePersistence() =
static let fileLock = new obj()
static let usertokenCache = new TokenCache()
static let cacheFilePath =
@hoetz
hoetz / authorize.cs
Last active October 10, 2017 06:27
mvc core 2 AuthorizationHandler problem, Stackoverflow when Fail()
//Setup Authentication & Authorization
services.AddMvc();
services.AddAuthentication(sharedOptions =>
{
sharedOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
sharedOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
}).AddCookie()
.AddOpenIdConnect(o =>
{
@hoetz
hoetz / crypto-cpp-csharp
Created November 11, 2016 16:53
Encrypt in c++ Qt / decrypt in C#
#include <QCoreApplication>
#include <QString>
#include <Poco/Foundation.h>
#include <Poco/Crypto/Cipher.h>
#include <Poco/Crypto/CipherKey.h>
#include <Poco/Crypto/CipherFactory.h>
#include <openssl/crypto.h>
#include <QDebug>

Keybase proof

I hereby claim:

  • I am hoetz on github.
  • I am hoetz (https://keybase.io/hoetz) on keybase.
  • I have a public key whose fingerprint is 6F85 B882 C028 94E2 159C 53E1 2F55 93C2 DA94 7499

To claim this, I am signing this object: