Skip to content

Instantly share code, notes, and snippets.

View GregTrevellick's full-sized avatar
💭
Nerding

Greg Trevellick GregTrevellick

💭
Nerding
View GitHub Profile
@GregTrevellick
GregTrevellick / Email address regex
Created July 22, 2020 14:36
Email address regex
(([!#-'*+/-9=?A-Z^-~-]+(\.[!#-'*+/-9=?A-Z^-~-]+)*)@([!#-'*+/-9=?A-Z^-~-]+(\.[!#-'*+/-9=?A-Z^-~-]+)*|\[[\t -Z^-~]*]))
@GregTrevellick
GregTrevellick / Table names & row counts
Last active August 25, 2021 08:32
TSQL get table names and table row counts
SELECT SCHEMA_NAME(A.schema_id) + '.' + A.Name, AVG(B.rows) AS 'RowCount'
FROM sys.objects A
INNER JOIN sys.partitions B ON A.object_id = B.object_id
WHERE A.type = 'U'
GROUP BY A.schema_id, A.Name
--ORDER BY AVG(B.rows) DESC
@GregTrevellick
GregTrevellick / InternalsVisibleTo.cs
Last active January 12, 2020 07:00
InternalsVisibleTo
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("UnitTests")]
using System;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
Console.WriteLine("Hello World");
var mixed = new List<bool> {true, false, true, false};
@GregTrevellick
GregTrevellick / markdown-details-collapsible.md
Last active May 23, 2019 09:47 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

Your markdown heading here

Show details closed by default Your markdown content here
C:\Windows\System32\runas.exe /user:DOMAIN\First.Last /savecred "cmd /c \"start foobar.exe\""
C:\Windows\System32\runas.exe /user:DOMAIN\First.Last /savecred "C:\Program Files (x86)\foobar.exe"
C:\Windows\System32\runas.exe /user:DOMAIN\First.Last /savecred "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\devenv.exe"
//Debug code (pause for 3 secs)
await new Promise(resolve => setTimeout(resolve, 3000));
//GET:
var client = new RestClient("192.168.0.1");
var request = new RestRequest("api/item/", Method.GET);
var queryResult = client.Execute<List<Items>>(request).Data;
//POST:
var client = new RestClient("http://192.168.0.1");
var request = new RestRequest("api/item/", Method.POST);
request.RequestFormat = DataFormat.Json;
request.AddBody(new Item