This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Query Kind="Program"> | |
<Reference><RuntimeDirectory>\System.Net.Http.dll</Reference> | |
<Reference><RuntimeDirectory>\System.Windows.Forms.dll</Reference> | |
<NuGetReference>Microsoft.AspNet.WebApi.OwinSelfHost</NuGetReference> | |
<Namespace>Microsoft.Owin.Hosting</Namespace> | |
<Namespace>Owin</Namespace> | |
<Namespace>System.Net</Namespace> | |
<Namespace>System.Net.Http</Namespace> | |
<Namespace>System.Threading.Tasks</Namespace> | |
<Namespace>System.Web.Http</Namespace> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a 10-year self-signed certificate for www.abc.cde domain and store it in Personal store of Computer (LocalMachine) | |
# The command needs to run from an elevated powershell window | |
New-SelfSignedCertificate -DnsName www.abc.cde -NotAfter (Get-Date).AddYears(10) -CertStoreLocation cert:\LocalMachine\My |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MachineKeyProtector : IDataProtector | |
{ | |
private readonly string[] _purpose = | |
{ | |
typeof(OAuthAuthorizationServerMiddleware).Namespace, | |
"Access_Token", | |
"v1" | |
}; | |
public byte[] Protect(byte[] userData) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ChildItem -Recurse .|where {$_.PSISContainer -and @($_ | Get-ChildItem).Count -eq 0 }|Remove-Item |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text.RegularExpressions; | |
public class StringUtils | |
{ | |
public static string SafeFormat(string format, params object[] parameters) | |
{ | |
const int MAX_NUMBER_OF_UNPASSED_PARAMETERS = 50; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include "Animal.h" | |
void Animal_Ctor(Animal* pa) | |
{ | |
pa->pfspeak=Animal_Speaking; | |
} | |
void Animal_Speaking(Animal* pa) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <cstring> | |
#include <sstream> | |
#include <vector> | |
#include <algorithm> | |
#include <unistd.h> | |
#include <sys/wait.h> | |
#include <signal.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <sys/wait.h> | |
#include <unistd.h> | |
int main() | |
{ | |
int pid; | |
int status; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @cnt INT = 0; | |
WHILE @cnt < 10 | |
BEGIN | |
PRINT 'Doing Something in loop #' + Convert(VARCHAR(10),@cnt); | |
--Use RAISEERROR to flush PRINT buffer | |
RAISERROR(N'', --message | |
0, --severity | |
1) --state | |
WITH NOWAIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Ensure | |
{ | |
public static void ArgumentNotNull<T>(T argument, string argumentName) where T : class | |
{ | |
if (argument == null) | |
throw new ArgumentNullException(argumentName); | |
} | |
public static void ArgumentNotNull<T>(Nullable<T> argument, string argumentName) where T : struct | |
{ |
NewerOlder