Skip to content

Instantly share code, notes, and snippets.

View pizycki's full-sized avatar

Paweł Iżycki pizycki

View GitHub Profile
@pizycki
pizycki / AutofacRegistration_Tests.cs
Created January 12, 2017 18:13
Autofac registration xUnit tests
public class AutofacRegistration_Tests
{
[Fact]
public void any_type_in_service_layer_should_NOT_be_registered_as_InstancePerRequest()
{
var containerRegistrations = GetContainer().ComponentRegistry.Registrations;
var results = containerRegistrations.ToDictionary(reg => reg, IsRegistrationScopeInstancePerRequest);
/* When test fails, debug this test and run following command in `Immediate console`:
* var invalid = results.Where(r=>r.Value);
@pizycki
pizycki / Start-DockerToolbox.ps1
Created January 12, 2017 18:16
Scripts for Docker Toolbox
# You should have: installed Docker Toolbox along with VirtualBox.
# This was tested on Win8.1.
docker-machine rm default;
docker-machine create default --driver virtualbox;
# docker-machine env default;
& "C:\Program Files\Docker Toolbox\docker-machine.exe" env default | Invoke-Expression;
# From now on should be able to use Docker API; f.e. type `docker ps` to see running containers.
@pizycki
pizycki / Dockerfile
Last active April 14, 2017 14:33
Jekyll and 'My Stack Problems'
FROM ubuntu:xenial
MAINTAINER pizycki
EXPOSE 4000 35729
RUN mkdir ~/izzydev
WORKDIR ~/izzydev
RUN \
apt-get update && \
@pizycki
pizycki / Concat-Files.ps1
Last active April 6, 2017 10:16
Concating files into single file
param(
[String] $Location,
[String] $Pattern=".*",
[String] $Seperator=""
)
# Create file
$tempFile = "temp.txt"
New-Item -Name $tempFile -ItemType "file" -Force
@pizycki
pizycki / SetupWSL.sh
Last active May 24, 2018 21:38
IzzyDev
# Get&Run:
# curl https://gist.githubusercontent.com/pizycki/e7a941ef99d9dc6d5c05ed444254dd6d/raw/7c36f0e913acdb6a81c7d9c1a48ccff2ee8468c8/SetupWSL.sh -o ~/install-jekyll.sh && bash ~/install-jekyll.sh
# Print Ubuntu version
lsb_release -a
# Upgrade Ubuntu to latest
sudo do-release-upgrade
# Install software
@pizycki
pizycki / EitherExample.cs
Created June 13, 2018 15:08
C# Either example FP
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Monacs.Core;
namespace EitherExampleExceptions
{
class Program
{
@pizycki
pizycki / Program.cs
Created October 15, 2018 20:21
Payments Free
using System;
using LanguageExt;
using static LanguageExt.Prelude;
// Based on https://github.com/louthy/language-ext/tree/master/Samples/BankingAppSample
namespace FreeIzzy
{
public class StartPaymentRequest : Record<StartPaymentRequest>
@pizycki
pizycki / github-to-bitbucket
Created October 19, 2018 13:32 — forked from sangeeths/github-to-bitbucket
Forking a Github repo to Bitbucket
Go to Bitbucket and create a new repository (its better to have an empty repo)
git clone git@bitbucket.org:abc/myforkedrepo.git
cd myforkedrepo
Now add Github repo as a new remote in Bitbucket called "sync"
git remote add sync git@github.com:def/originalrepo.git
Verify what are the remotes currently being setup for "myforkedrepo". This following command should show "fetch" and "push" for two remotes i.e. "origin" and "sync"
git remote -v
@pizycki
pizycki / gist:4357720b9787f7b939845406e72b876c
Created October 24, 2018 14:58
Port is already in use
netstat -a -b -o | sls <port>
Stop-process PID
@pizycki
pizycki / Process-Module.ps1
Last active December 9, 2019 09:13
Windows Processes PS Module
Get-Process | where {$_.Name -eq 'process name'} | Format-Table id, name