Skip to content

Instantly share code, notes, and snippets.

@pawelpabich
pawelpabich / LogModule.cs
Created July 7, 2012 13:32
Log4Net and NLog modules for Autofac
using System;
using System.Linq;
using Autofac;
using Autofac.Core;
using NLog;
using log4net;
using LogManager = NLog.LogManager;
namespace AutofacIdea
{
@pawelpabich
pawelpabich / Private Setter
Created March 25, 2014 05:33
Trying to serialize and deserialize a class with private setter in the base class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace ConsoleApplication12
{
class Program
@pawelpabich
pawelpabich / Function.cs
Last active October 16, 2019 04:21
Stateless function
#Defintion
public static class SetServerUrl
{
public static Task Run(paramters)
{
//Body
}
}
param([string] $Version, [string] $StorageAccount, [string] $StorageUser, [string] $StoragePassword)
$ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest;
New-Item -ItemType Directory -Force -Path C:\Temp
function Log($Message)
{
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss,fff"
param([string] $VirtualMachineFullDNSName, [string] $ConnectionString, [string] $AdministratorPassword, [string] $EncodedLicense, [string] $StoragePath, [string] $InstanceName, [Int] $ServerCommPort)
$ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest;
function Log($Message)
{
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss,fff"
$newLine = [System.Environment]::NewLine
$logEntry = "$timestamp $Message $newLine"
param([string] $IpAddress, [string] $ConnectionString, [string] $AdministratorPassword, [string] $EncodedLicense, [string] $StoragePath, [string] $StorageAccount, [string] $StorageUser, [string] $StoragePassword)
$ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest;
function Log($Message, $IncludeTimestamp)
{
$logEntry = $Message
if ($IncludeTimestamp)
@pawelpabich
pawelpabich / InputData.txt
Created January 1, 2013 09:37
Word count using Hive
Hello
World
Bye
World
=====================
18/05/2018 9:44:40 AM
LimitedFunctionality
System.AggregateException: Project system data flow 'OutputGroupsService Outer 84518' closed because of an exception: System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.VisualStudio.ProjectServices.DesignTimeBuilder.<BuildAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
function FindProxyForURL(url, host)
{
return "PROXY localhost:8888";
}
@pawelpabich
pawelpabich / Get-Events.ps1
Last active March 23, 2017 11:33
Gets events related to variable sets
param($OctopusServerUrl, $OctopusServerApiKey, $OutputFile, $DateFrom, $DateTo)
$ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest;
$Server = @{ OctopusServerUrl = $OctopusServerUrl; OctopusServerApiKey = $OctopusServerApiKey}
function Get-Data($Path)
{
$Path = $Path.Replace("api/", "")