Skip to content

Instantly share code, notes, and snippets.

View gtechsltn's full-sized avatar
🍊

Nguyen Viet Manh gtechsltn

🍊
View GitHub Profile
@gtechsltn
gtechsltn / gist:7f808229e0b0250fbbcb772534338cb3
Created October 27, 2025 01:48
Create-IIS-Site-App-Advanced-SSL.ps1
<#
.SYNOPSIS
Advanced: Create IIS Website + Application + App Pool + SSL binding (IIS Express style cert for localhost).
.DESCRIPTION
- Creates AppPool, Website, Application and sample index.html.
- Checks ports (HTTP and HTTPS) and warns/prompts.
- Uses an existing LocalMachine\My cert with CN=localhost or FriendlyName containing "IIS Express".
- If not found, creates a self-signed certificate (New-SelfSignedCertificate) with FriendlyName "IIS Express Development Certificate".
- Adds HTTPS host-header binding (hostname = localhost) on port 44384 and assigns certificate.
- Logging, colored output, Try/Catch, recap.
@gtechsltn
gtechsltn / iis_streamlit.md
Created September 12, 2025 07:18 — forked from stanorama/iis_streamlit.md
IIS Reverse Proxy and Windows Authentication for Streamlit

IIS Reverse Proxy and Windows Authentication for Streamlit

Introduction

Setting up a reverse proxy on IIS (Internet Information Services) allows us to take advantage of windows authentication.

This means we can limit access to a streamlit app to a specific Active Directory group, Local group or list of Active Directory users.

(I haven't tested https support yet).

@gtechsltn
gtechsltn / nvmCommands.js
Created June 19, 2025 02:35 — forked from chranderson/nvmCommands.js
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
@gtechsltn
gtechsltn / LinkExtensions.cs
Created April 2, 2025 08:58 — forked from auzick/LinkExtensions.cs
Sitecore SXA Scriban extension to expose the innards of a link field
using Scriban.Runtime;
using Sitecore.Data.Fields;
using Sitecore.Data.Items;
using Sitecore.XA.Foundation.Abstractions;
using Sitecore.XA.Foundation.Scriban.Pipelines.GenerateScribanContext;
using System;
using Example.ScribanExtensions.Model;
namespace Example.ScribanExtensions.Pipelines
{
@gtechsltn
gtechsltn / UpdateIISExpressCertificate.ps1
Created March 29, 2025 04:03 — forked from camieleggermont/UpdateIISExpressCertificate.ps1
This powershell script generates a new certificate, removes the old certificate assignments from the IISExpress ssl ports and adds the newly generated one. The certificate is also copied over to the Trusted Root Certificate Authorities.
$cert = New-SelfSignedCertificate -DnsName "localhost", "localhost" -CertStoreLocation "cert:\LocalMachine\My" -NotAfter (Get-Date).AddYears(5)
$thumb = $cert.GetCertHashString()
For ($i=44300; $i -le 44399; $i++) {
netsh http delete sslcert ipport=0.0.0.0:$i
}
For ($i=44300; $i -le 44399; $i++) {
netsh http add sslcert ipport=0.0.0.0:$i certhash=$thumb appid=`{214124cd-d05b-4309-9af9-9caa44b2b74a`}
}
@gtechsltn
gtechsltn / DataReaderExtensions.cs
Created March 26, 2025 03:02 — forked from darrenkopp/DataReaderExtensions.cs
Some handy utilities for dealing with ado.net
public static class DataReaderExtensions
{
public static IEnumerable<T> Stream<T>(this IDbCommand command, Func<IDataRecord, T> converter)
{
using (var reader = command.ExecuteReader(CommandBehavior.SingleResult))
{
while (reader.Read())
yield return converter(reader);
}
}
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Simple.Data.Ado;
namespace Simple.Data.Sql
{
public static class DataReaderExtensions
{
public static IEnumerable<IEnumerable<dynamic>> ToResultSets(this IDataReader reader)
@gtechsltn
gtechsltn / DataReaderExtensions.cs
Created March 26, 2025 02:58 — forked from brentworden/DataReaderExtensions.cs
System.Data.IDataReader extension method to fully read the bytes from a large binary column
using System.Data;
using System.IO;
namespace Extensions.Data {
public static class DataReaderExtensions {
/*
* Extension method on IDataReader that reads the entire contents of a large binary column using a single method call.
* Sample usage:
@gtechsltn
gtechsltn / Service.cs
Created March 21, 2025 07:35 — forked from rebelweb/Service.cs
SMB File Share Access Service in C#
using System;
using System.Linq;
using System.Text;
using SMBLibrary;
namespace FileShare.Access
{
public interface IClientDTO
{
string IPAddress { get; set; }
@gtechsltn
gtechsltn / SqlDbType2DbType.cs
Created March 12, 2025 02:31 — forked from tecmaverick/SqlDbType2DbType.cs
Convert .Net Type to SqlDbType or DbType and vise versa
//Convert .Net Type to SqlDbType or DbType and vise versa
//This class can be useful when you make conversion between types .The class supports conversion between .Net Type , SqlDbType and DbType .
using System;
using System.Collections;
using System.Data;
namespace Devintelligence.Common.Data
{
/// <summary>