Skip to content

Instantly share code, notes, and snippets.

View sandrinodimattia's full-sized avatar
🏠
Working from home

Sandrino Di Mattia sandrinodimattia

🏠
Working from home
View GitHub Profile
public class NetFwMgr : DynamicComBase
{
/// <summary>
/// Default constructor.
/// </summary>
public NetFwMgr()
{
// Initialize the COM object.
Type fwMgrType = Type.GetTypeFromProgID("HNetCfg.FwMgr");
base.comObj = Activator.CreateInstance(fwMgrType);
@sandrinodimattia
sandrinodimattia / connection.js
Last active July 24, 2023 15:43
Create SAML connection
const { AuthenticationClient, ManagementClient } = require("auth0");
const publicKey = `-----BEGIN CERTIFICATE-----
MIIC/zCCAeegAwIBAgIJHqZ8xG7fkm2bMA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
BAMTEnNhbWwtaWRwLmF1dGgwLmNvbTAeFw0xNzA4MDMxNDE0MTBaFw0zMTA0MTIx
NDE0MTBaMB0xGzAZBgNVBAMTEnNhbWwtaWRwLmF1dGgwLmNvbTCCASIwDQYJKoZI
hvcNAQEBBQADggEPADCCAQoCggEBAOzFui1uCqya7hcEW6TwLQn4kfw0gXDoZ018
VYVA9U45GQGuJPOVjXlNYDxwysjZXP9mOn322wL7AQGejavdrwsGFgiLZ23/X9DP
TsyGTcNuQtFCbW16xQcBB7PuLy3iluFXi50c+dvU/iSdBG9xEhndQ9mVtwbFMMFf
q8WNY4arU3PmnxFAhZIXgTmJih9a8hknGL82pgpcmK4iQof6Uw35x2Gg9X4zbbyt
@sandrinodimattia
sandrinodimattia / index.js
Last active February 5, 2022 02:29
Export Google Chrome History to a CSV file
import fs from 'fs';
import path from 'path';
import { v4 } from 'uuid';
import each from 'p-each-series';
import Database from 'sqlite-async';
/**
* Find all of the Chrome History files.
*/
function getHistoryFiles(startPath, targetFile) {
@sandrinodimattia
sandrinodimattia / gist:4115110
Created November 20, 2012 00:21
IIS8 - Install FTP Server
REM Variables.
SETLOCAL EnableDelayedExpansion
SET FtpSiteName=%1%
SET FtpDirectory=%2%
SET PublicPort=%3%
SET DynamicPortFirst=%4%
SET DynamicPortLast=%5%
SET DynamicPortRange=%DynamicPortFirst%-%DynamicPortLast%
SET PublicIP=%6%
@sandrinodimattia
sandrinodimattia / lock-switch-to-signup.html
Created May 31, 2016 17:34
Auth0 Lock example that shows how to switch to the Login page when a certain condition is met
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Sign In with Auth0</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
html, body { padding: 0; margin: 0; }
@sandrinodimattia
sandrinodimattia / README.md
Last active May 2, 2019 16:36
Upload custom signing certificate in Auth0 Generic SAML-P Connection

Upload custom signing certificate in Auth0 Generic SAML-P Connection

Get or generate a new signing certificate:

openssl req -x509 -nodes -sha256 -days 3650 -newkey rsa:2048 -keyout saml.key -out saml.crt

Update the script and update the following settings:

@sandrinodimattia
sandrinodimattia / automate-login-page-email-templates.md
Last active April 8, 2019 18:26
Automatic configuration of the Auth0 Login Page and Email Templates

Customzing the Password Reset Page

Go to the API v2 explorer and generate a token with update:tenant_settings. Then call the tenants endpoint with the new HTML:

PATCH https://{YOUR_DOMAIN}/api/v2/tenants/settings

{
  "change_password": {
    "enabled": true,
@sandrinodimattia
sandrinodimattia / auth0-with-azure-b2c.md
Last active May 19, 2018 06:09
Connect Auth0 with Azure B2C

Connect Auth0 with Azure AD B2C

Configuration

  1. Create an Azure AD B2C Directory
  2. Create a Regular Web Application (set the url here to https://YOUR_AUTH0_ACCOUNT/login/callback)
  3. Create a key
  4. Take note of the Application ID and the Key
  5. Create a sign in policy (you will have a name like B2C_1_signing)
@sandrinodimattia
sandrinodimattia / authorization-api.md
Created May 5, 2016 09:42
Auth0 Authorization Extension API

Create a group

POST https://sandbox.it.auth0.com/api/run/YOUR_ACCCOUNT/YOUR_EXTENSION/api/groups

{
  "name": "My group",
  "description": "My group description"
}
@sandrinodimattia
sandrinodimattia / generate-certs.js
Created January 29, 2018 08:52
Generate self signed certificates with the selfsigned library and validate those with OpenSSL 1.1
const fs = require('fs');
const ursa = require('ursa');
const async = require('async');
const faker = require('faker');
const util = require('util');
const spawn = require('child_process').spawn;
const selfsigned = require('selfsigned');
const total = Array.from(Array(10000).keys());