Skip to content

Instantly share code, notes, and snippets.

View DamianSuess's full-sized avatar
👍
Enjoying every day

Damian DamianSuess

👍
Enjoying every day
View GitHub Profile
@DamianSuess
DamianSuess / DictionaryJsonConverter.cs
Created September 7, 2020 21:38
System.Text.Json - Converters because the current one can't
/* Copyright Xeno Innovations, Inc. 2020
* Date: 2020-8-30
* File: DictionaryJsonConverter.cs
* Description:
* Dictionary JSON Converter
*
* Reference:
* - https://github.com/dotnet/runtime/blob/master/src/libraries/System.Text.Json/tests/Serialization/CustomConverterTests/CustomConverterTests.DictionaryGuidConverter.cs
* - https://github.com/dotnet/runtime/issues/30524
*/
@DamianSuess
DamianSuess / SecuredHashSignature.cs
Last active March 28, 2020 13:52
C# Example of how to create a secured hash signature from requested text and key
using System;
using System.Text;
using System.Linq;
using System.Security.Cryptography;
public class Program
{
public static void Main()
{
var request = "322424946172;69760;24051943;000001;69760;000182B0CC538B1C5F1EFB31CDA1FB01A15D62AC380F38A6EDB6";
@DamianSuess
DamianSuess / AvalonEdit-CommentLines.md
Last active August 28, 2019 03:50
C# AvalonEdit Comment Lines
TextDocument document = textEditor.Document;
DocumentLine start = document.GetLineByOffset(textEditor.SelectionStart);
DocumentLine end = document.GetLineByOffset(textEditor.SelectionStart + textEditor.SelectionLength);
using (document.RunUpdate()) {
  for (DocumentLine line = start; line != end; line = line.NextLine)
  {
    document.Insert(line.Offset, "// ");
  }
}
public static class ListExtension
{
public static void Add<T>(this List<T> list, T value, out List<T> newInstance)
{
if (list == null) list = new List<T>();
list?.Add(value);
newInstance = list;
}
}
@DamianSuess
DamianSuess / DroidSmsActivation.md
Created January 30, 2019 23:16
Xamarin Android SMS Activation

Borrowed from very nice work on StackOverflow by, Vahid.

<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />

Here is SmsReceiver class in Android project:

Note iOS doesnt allow reading SMS so here's android only.

@DamianSuess
DamianSuess / GitTools.ps1
Created January 14, 2019 17:44
PowerShell Git Helpers
<#
Git Helpers for PowerShell
Author: Damian Suess
Revision: 2.b - 2018-07-30 (2018-10-03)
TODO:
- GitCheckIn $message (check-in/push)
- GitPush - Set branch tracking or no tracking
Change Log:
@DamianSuess
DamianSuess / Gist-Table-Of-Contents.md
Last active June 24, 2022 16:43
Gist Table of Contents
@DamianSuess
DamianSuess / TSQL-SearchJobsForText.md
Created January 3, 2019 16:13
TSQL Search Jobs for text

The following is an example of how to search SQL Jobs for text using TSQL

SQL 2005-2017

-- SQL 2005-2008 - Search all Jobs
SELECT j.job_id, s.srvname, j.name, js.step_id, js.command, j.enabled
FROM msdb.dbo.sysjobs j
JOIN msdb.dbo.sysjobsteps js ON js.job_id = j.job_id 
JOIN master.dbo.sysservers s ON s.srvid = j.originating_server_id
WHERE js.command LIKE N'%...%'
@DamianSuess
DamianSuess / TSQL-SearchForeignKeys.md
Last active January 3, 2019 16:11
TSQL Search foreign keys

The following is an example on how to search Foreign Keys using TSQL

Tested using MS SQL Server 2000-2017

List Foreign Key Constraints

-- List Foreign Key Constraints on table. Ex: D_TRANS_ACCOUNT_ENTRY
DECLARE @tableName sysname
SET @tableName = '...' -- Your table name goes here
SELECT
@DamianSuess
DamianSuess / TSQL-SearchTables.md
Last active January 3, 2019 16:05
TSQL Search tables for string

The following is an example of how to search tables for a value. It may not be the most efficient but it works

Tested against MS SQL Server 2000-2017

Example

DECLARE @SearchStr nvarchar(100);
SET @SearchStr = 'SEARCH TEXT HERE';

CREATE TABLE #Results (ColumnName nvarchar(370), ColumnValue nvarchar(3630));