Skip to content

Instantly share code, notes, and snippets.

@mjendza
mjendza / gist:102bf99a1721710faf9a7690b0cec8c2
Created December 8, 2023 09:28
ClientCredential-1PasswordCLI-sample.ps1
#LINK 1Password secrets to the environment variables
$ENV:FL_SP_CLIENT_ID = "op://Factorlabs/Factorlabs Service Principal for 1password demo/username"
$ENV:FL_SP_CLIENT_SECRET = "op://Factorlabs/Factorlabs Service Principal for 1password demo/password"
$client_id = $env:FL_SP_CLIENT_ID
$client_secret = $env:FL_SP_CLIENT_SECRET
$tenant_id = "6790fadf-1111-4f73-8f65-844675b9a99a"
$resource = [uri]::EscapeDataString("https://graph.microsoft.com/.default")
trigger:
branches:
include:
- '*'
pool:
vmImage: 'ubuntu-latest'
steps:
- task: AzureResourceManagerTemplateDeployment@3
@mjendza
mjendza / C# Version Cheat Sheet.md
Created May 26, 2020 20:13 — forked from Gutek/C# Version Cheat Sheet.md
Short cheat sheet of changes in C# language from version 6 to 9

CS 6

read-only auto properties

Small help with immutable types...

// private readonly int _age;
// public int Age { get { return _age; } }
public int Age { get; }
version: '2.1'
services:
grafana:
container_name: grafana
image: proxx/grafana-armv7
user: "1000"
ports:
- 3000:3000
volumes:
- /opt/grafana:/etc/grafana:rw
[InterceptLogger(1)]
public class TaskFakeService : ITaskService
{
public int GetById(int id)
{
return 1;
}
[InterceptExceptions(2)]
public IList<int> GetAll()
public class InterceptLoggerAttribute : InterceptAttribute
{
public InterceptLoggerAttribute(int order)
{
this.Order = order;
}
public override IInterceptor CreateInterceptor(IProxyRequest request)
{
public class LoggerInterceptor : IInterceptor
{
public void Intercept(IInvocation invocation)
{
var logger = invocation.Request.Context.Kernel.Get<Logger>();
logger.Trace(string.Format("Start method {0} with {1}", invocation.Request.Method.Name, ArgumentsToString(invocation.Request.Arguments)));
invocation.Proceed();
logger.Trace(string.Format("End method {0} with {1}", invocation.Request.Method.Name, invocation.ReturnValue.ToString()));
}
@mjendza
mjendza / binding
Last active January 5, 2017 22:32
kernel.Bind<ITaskService>().To<TaskService>().Intercept().With<ServiceInterceptor>();
function Read-Onet{
param (
[string] $path
)
asnp *sharepoint*
$file = "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\" + "TEMPLATE\" + $path+"\xml\onet.xml";
write-host $file
if (Test-Path $file) {
[xml]$onet = Get-Content $($file)