Skip to content

Instantly share code, notes, and snippets.

View SaberZA's full-sized avatar

Steven van der Merwe SaberZA

  • Durban, South Africa
View GitHub Profile
@SaberZA
SaberZA / SqlParameterHelper.cs
Created September 27, 2021 08:19 — forked from aliozgur/SqlParameterHelper.cs
Convert objects to SqlParameter array or list
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Collections;
using System.Data;
namespace SqlParameterHelper
{
/// <summary>
{
"meta": {
"theme": "stackoverflow"
},
"basics": {
"name": "STEVEN VAN DER MERWE",
"label": "Technical Lead",
"picture": "",
"email": "stevenvdmerwe@gmail.com",
"phone": "072 620 4435",
@SaberZA
SaberZA / parse-test.ps1
Created February 4, 2021 15:24
PowerShell NUnit TestResult.xml Parser Script for AWS EC2
#given the below params, takes a completed NUnit(/Selenium) test and parses the results to an HTML file for viewing.
# - Run after NUnit tests have completed
# - Recommend taking a screenshot in [TearDown] method as a base64, then adding it to the bottom of your comments or logging output as @IMAGE:
# - make sure to prefix your baes64 with "data:image/png;base64,
# - The @IMAGE: will then be parsed and added as a clickable <img> tag in your test results.
param(
[string]$testresultsdirectory
[string]$htmldestinationdirectory
[string]$filename
@SaberZA
SaberZA / logstash-grok-spring-boot.conf
Created July 6, 2020 10:40 — forked from daniellavoie/logstash-grok-spring-boot.conf
Logstash grok filter for Logback Logger used by Spring Boot applications
input {
file {
path => /tmp/application.log
codec => multiline {
pattern => "^(%{TIMESTAMP_ISO8601})"
negate => true
what => "previous"
}
}
}
@SaberZA
SaberZA / build.gradle
Created April 30, 2020 15:35
Aggregated Jacoco reports in a multi-project Gradle build
// ****************************************************************************
// The `org.kordamp.gradle.jacoco` plugin takes care of mane aspects shown here
// http://kordamp.org/kordamp-gradle-plugins/#_org_kordamp_gradle_jacoco
//
// The code shown here is obsolete. Use it at your own risk
// ****************************************************************************
allprojects {
apply plugin: 'java'
apply plugin: 'jacoco'
@SaberZA
SaberZA / AzureScaleUtil.cs
Last active November 6, 2018 08:53
Azure Web App & SQL Azure Fluent Scale Utility (Remember to correctly configure the IAM policies for each resource in the Azure CLI or web dashboard)
public static class AzureScaleUtil
{
public static void ScaleAzureWebApp(string appId, string appSecret, string tenantId, string subscriptionId, string resourceGroupName, string appServicePlanName,
string tier)
{
Trace.WriteLine("Beginning Azure Web App Scale Event");
var pricingTier = GetPricingTier(tier);
var authority = $"https://login.windows.net/{tenantId}";
var resource = "https://management.azure.com/";
@SaberZA
SaberZA / recursive-binary-search.cs
Last active September 30, 2016 08:22
Recursive Binary Search
private static void MovieSearch2()
{
string[] movies = new string[] { "Dumb and Dumber", "Final Destination", "Rocky", "Speed", "The Notebook" };
int recursivePosition = RecursiveBinarySearch("rocky", movies, 0, movies.Length - 1);
Console.WriteLine(recursivePosition);
}
private static int RecursiveBinarySearch(string searchString, string[] items, int low, int high)
{
if (low > high) return -1; // Base Case
@SaberZA
SaberZA / DistinctComparer.cs
Last active November 21, 2019 14:27
Distinct Comparer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DistinctComarer
{
class Program
{
@SaberZA
SaberZA / connectURL.java
Created October 20, 2015 13:50
Connecting to SQL Azure Database with JDBC 4.0 Driver
import java.sql.*;
public class connectURL {
public static void main(String[] args) {
// Create a variable for the connection string.
String connectionUrl = "jdbc:sqlserver://localhost:1433;" +
"databaseName=testDb;user=testUser;password=testPass";
@SaberZA
SaberZA / LinuxBoxSpecs
Created May 24, 2014 19:06
LinuxBoxSpecs
saber-desktop
description: Desktop Computer
product: To be filled by O.E.M. (To be filled by O.E.M.)
vendor: To be filled by O.E.M.
version: To be filled by O.E.M.
serial: To be filled by O.E.M.
width: 64 bits
capabilities: smbios-2.7 dmi-2.7 vsyscall32
configuration: chassis=desktop family=To be filled by O.E.M. sku=To be filled by O.E.M. uuid=C68EA121-1E3B-A051-C499-300ED517A814
*-core