Skip to content

Instantly share code, notes, and snippets.

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

Massimo Giambona m4ss1m0g

🏠
Working from home
View GitHub Profile
@m4ss1m0g
m4ss1m0g / ResetSqlServerSequence.sql
Created August 23, 2023 10:27
Restart SQL Server Sequence without impact DACPAC
-- Restart sequence to 1, this not impact dacpac
ALTER SEQUENCE MySequence RESTART WITH 1
-- Get all needed id to reach the desidered number, @range_first_value is mandatory
-- and returns the first (minimum or maximum) value of the sequence object used to calculate the requested range.
--
-- https://learn.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-sequence-get-range-transact-sql?view=sql-server-ver16
DECLARE @range_first_value SQL_VARIANT;
@m4ss1m0g
m4ss1m0g / add-remove.psm1
Last active May 18, 2023 18:23
Lists all installed software, including any that is not visible with PowerShell
function Get-Installed {
[CmdletBinding()]
param (
# The name of the software
[Parameter(Mandatory = $true)]
[string] $Name
)
begin {
$PATHS = @(
@m4ss1m0g
m4ss1m0g / nuget.config
Created August 2, 2022 14:43
nuget.config
<!-- https://docs.microsoft.com/it-it/nuget/reference/nuget-config-file -->
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Test Source" value="d:\packages" />
</packageSources>
</configuration>
@m4ss1m0g
m4ss1m0g / HyperV_And_VmWare.psm1
Last active February 27, 2019 11:17
HyperV and VmWare switching
function Switch-Virtualization
{
# Advanced parameters
# https://ss64.com/ps/syntax-function-advanced.html
[CmdletBinding()] # Add cmdlet features.
Param(
[Parameter(Mandatory=$true)]
[ValidateSet("vmware", "hyperv")]$Virtualization,
@m4ss1m0g
m4ss1m0g / FiscalCode.cs
Created January 30, 2019 20:47
Italian Fiscal Code - LastName and FirstName
class FiscalCode
{
private static readonly string[] VOC = new string[] { "a", "e", "i", "o", "u" };
public static string Name(string lastName, string firstName)
{
return $"{Lastname(lastName)}{FirstName(firstName)}";
}
private static string Lastname(string value)