Skip to content

Instantly share code, notes, and snippets.

View lucamilan's full-sized avatar
:bowtie:
I may be slow to respond.

Luca Milan lucamilan

:bowtie:
I may be slow to respond.
View GitHub Profile
@lucamilan
lucamilan / Basic-WebRequest.ps1
Created October 24, 2023 13:56 — forked from rithala/Basic-WebRequest.ps1
PowerShell HTTP Request with Basic Auth
$user = 'user'
$pass = 'pass'
$uri = '<url>'
$pair = "$($user):$($pass)"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$basicAuthValue = "Basic $encodedCreds"
@lucamilan
lucamilan / MinimalAPIs.md
Created May 17, 2023 06:15 — forked from davidfowl/MinimalAPIs.md
Minimal APIs at a glance
@lucamilan
lucamilan / powershell-cert.md
Created January 22, 2023 18:11 — forked from nmoinvaz/powershell-cert.md
Powershell Commands for Certificates

Self-signed Code Signing Certificate

To create the code signing certificate using PowerShell (using Administrator prompt):

$cert = New-SelfSignedCertificate -Subject "My Certificate" -Type CodeSigning -CertStoreLocation Cert:\CurrentUser\My -NotAfter (Get-Date).AddYears(100)

To export the certificate from the certificate store:

$certPassword = ConvertTo-SecureString -String "passwordhere" -Force –AsPlainText
$cert | Export-PfxCertificate -FilePath "mycert.pfx" -Password $certPassword
@lucamilan
lucamilan / SelfSignedCert.md
Created January 22, 2023 18:02 — forked from mrcunninghamz/SelfSignedCert.md
Creating a self signed certificate in a pfx format on a mac.

Create Self Signed Certificate using OpenSSL on a Mac

Introduction

Every now and then I need to create a self signed certificate in azure for something. In my particular case its Azure B2C. I am using a mac so its not simply just running something like

New-SelfSignedCertificate `
    -KeyExportPolicy Exportable `
    -Subject "CN=yourappname.yourtenant.onmicrosoft.com" `
 -KeyAlgorithm RSA `
@lucamilan
lucamilan / beyondcompare.ps1
Created January 19, 2023 12:59 — forked from flcdrg/boxstarter-bare-v3.ps1
My BoxStarter Scripts
cinst beyondcompare
cinst beyondcompare-integration
// create CA key
openssl genrsa -out ca.key 2048
// create CA cert
openssl req -x509 -sha256 -new -nodes -key ca.key -days 365 -out ca.pem
// create client key
openssl genrsa -out client.key 2048
// create client csr
@lucamilan
lucamilan / java-webapp-az-pipeline.yaml
Created September 17, 2022 16:17 — forked from pretty25/java-webapp-az-pipeline.yaml
Automate Java container deployments with Azure Pipelines
az configure --defaults location=westus2
# resourceSuffix=$RANDOM
# webName="java-container-cicd-${resourceSuffix}"
# registryName="javacontainercicd${resourceSuffix}"
# dbServerName="java-container-cicd-${resourceSuffix}"
# rgName='java-containers-cicd-rg'
# planName='java-container-cicd-asp'
# az group create --name $rgName
@lucamilan
lucamilan / u2u_student_laptop_boxstarter.txt
Created September 1, 2022 20:59 — forked from SqlWaldorf/u2u_student_laptop_boxstarter.txt
BoxStarter list of packages to install on a new windows machine
choco feature enable -n allowGlobalConfirmation
cinst Chocolatey
cinst azcopy
cinst azure-cli
cinst azurepowershell
cinst sql-server-express
cinst sql-server-management-studio
cinst powerbi
cinst sqlsentryplanexplorer
cinst curl
@lucamilan
lucamilan / ml2021-boxstarter.ps1
Last active November 9, 2021 16:49 — forked from ZinkNotTheMetal/mam-boxstarter.ps1
MyLaptop2021-BoxStarter
# Invoke using following syntax into IE:
# http://boxstarter.org/package/url?https://gist.githubusercontent.com/lucamilan/7b3f1c53ea66f943c6899777fd7baf55/raw/b7167b7bc0a573944b3b4324538c9762babe0b1a/ml2021-boxstarter.ps1
try {
# Boxstarter options
$Boxstarter.RebootOk = $true
$Boxstarter.NoPassword = $false # Is this a machine with no logon password?
$Boxstarter.AutoLogin = $true
# --- TEMPORARILY DISABLE --- #
@lucamilan
lucamilan / LoopStep.cs
Created April 18, 2021 08:04 — forked from jermdavis/LoopStep.cs
A possible looped pipeline step for processing IEnumerable<> inputs
using System.Collections.Generic;
namespace StronglyTypedPipelines
{
public class LoopStep<INPUT,OUTPUT> : IPipelineStep<IEnumerable<INPUT>, IEnumerable<OUTPUT>>
{
private IPipelineStep<INPUT, OUTPUT> _internalStep;
public LoopStep(IPipelineStep<INPUT, OUTPUT> internalStep)