Skip to content

Instantly share code, notes, and snippets.

Mark Ingalls marking

Block or report user

Report or block marking

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am marking on github.
  • I am mark_ingalls (https://keybase.io/mark_ingalls) on keybase.
  • I have a public key ASAuVdU6QtF03i1koCSvsF59q3CQZHVZUsiE0dcy5GBZrAo

To claim this, I am signing this object:

@marking
marking / Invoke-KMSEncrypt-Example.ps1
Created Jul 12, 2016 — forked from Sam-Martin/Invoke-KMSEncrypt-Example.ps1
PowerShell Example for using Invoke-KMSEncrypt and Invoke-KMSDecrypt
View Invoke-KMSEncrypt-Example.ps1
# Stolen from http://ctrlf5.net/?p=263 and http://www.dailycoding.com/posts/convert_image_to_base64_string_and_base64_string_to_image.aspx
function ConvertFrom-StringToMemoryStream{
param(
[parameter(Mandatory)]
[string]$InputString
)
$stream = New-Object System.IO.MemoryStream;
$writer = New-Object System.IO.StreamWriter($stream);
$writer.Write($InputString);
@marking
marking / invokeWithCookie.ps1
Created Mar 14, 2016 — forked from lawrencegripper/invokeWithCookie.ps1
Invoke-webrequest With Cookie
View invokeWithCookie.ps1
$downloadToPath = "c:\somewhere\on\disk\file.zip"
$remoteFileLocation = "http://somewhere/on/the/internet"
$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$cookie = New-Object System.Net.Cookie
$cookie.Name = "cookieName"
$cookie.Value = "valueOfCookie"
View AppServiceUtilities.cs
public static IList<T> Get<T, I>()
where T : class
where I : IRepository<T>
{
using (var assembleContainer = BuildAssembleContainer())
{
return assembleContainer.Resolve<I>().List();
}
}
View AppServiceUtilities.cs
public static void SaveUser(User userToSave)
{
using (var assembleContainer = BuildAssembleContainer())
{
var userRepository = assembleContainer.Resolve<IUserRepository>();
var user = userRepository.GetById(userToSave.Id);
if (user == null)
{
throw new ArgumentException(string.Format("A User with id={0} does not exist in the database", userToSave.Id));
You can’t perform that action at this time.