Skip to content

Instantly share code, notes, and snippets.

View S1r-Lanzelot's full-sized avatar
⛷️

John Lanz S1r-Lanzelot

⛷️
  • International Ski and Snowboard Federation
  • Hünibach, Switzerland
  • 20:21 (UTC +02:00)
View GitHub Profile
@S1r-Lanzelot
S1r-Lanzelot / DeploySSISProjectWithEnv.cs
Last active April 21, 2022 18:04
Methods for SSIS Project C# Deployment with environment references
private const string SSIS_AUTO_GENERATED_PARAM_PREFIX = "CM.";
private static void DeployIspac(string targetConnectionString, string folderName, string ispacSourcePath)
{
using (var targetConn = new SqlConnection(targetConnectionString))
{
IntegrationServices targetIntegrationSvcs = new IntegrationServices(targetConn);
Catalog targetCatalog = targetIntegrationSvcs.Catalogs["SSISDB"];
CatalogFolder targetFolder = targetCatalog.Folders.FirstOrDefault(f => f.Name == folderName);
@S1r-Lanzelot
S1r-Lanzelot / ExcelTrend.cs
Last active November 15, 2022 19:09
Excel TREND Function in C#
public static class StatisticalCalculation
{
public static double Trend(IEnumerable<double> knownYValues, IEnumerable<double> knownXValues, double newX)
{
var line = LineByLeastSquares(knownYValues, knownXValues);
return line.slope * newX + line.intercept;
}
private static (double slope, double intercept) LineByLeastSquares(IEnumerable<double> knownYValues, IEnumerable<double> knownXValues)
{