View SerializableTestCase.cs
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.IO; | |
using System.Xml.Serialization; | |
using Xunit.Abstractions; | |
public abstract class SerializableTestCase : IXunitSerializable | |
{ | |
/// <inheritdoc/> | |
public void Deserialize(IXunitSerializationInfo info) | |
{ |
View NaiveModelBinder.cake
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.ComponentModel; | |
// Uses cake Configuration to bind a model | |
// Configuration values should come from | |
// 1 - CAKE_ prefixed env vars | |
// 2 - cake.config files | |
// 3 - cmdline arguments | |
class NaiveModelBinder | |
{ | |
private readonly Func<string, string> getValue; |
View _vimrc
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
set clipboard=unnamed "Use System clipboard | |
set autoindent "New lines inherit the indentation of previous lines | |
set expandtab "Convert tabs to spaces. | |
set smarttab "Insert 'tabstop' number of spaces when the 'tab' key is pressed. | |
set tabstop=4 "Indent using four spaces. | |
set hlsearch "Enable search highlighting. | |
set incsearch "Incremental search that shows partial matches. | |
set smartcase "Automatically switch search to case-sensitive when search query contains an uppercase letter. |
View covid.linq
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
var data = Parse(@"https://raw.githubusercontent.com/dssg-pt/covid19pt-data/master/data.csv", | |
v => new | |
{ | |
data = DateTime.Parse(v["data"]), | |
novos_total = decimal.Parse(v["confirmados"]), | |
novos = decimal.Parse(v["confirmados_novos"]) | |
}); | |
var amostras = Parse(@"https://raw.githubusercontent.com/dssg-pt/covid19pt-data/master/amostras.csv", | |
v => new | |
{ |
View List of .net tools
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
# REPL-like | |
sharplab.io/ | |
dotnetfiddle.net/ | |
linqpad.net/ | |
gistlyn.com/ | |
# Perf tools | |
github.com/0xd4d/dnSpy/ | |
github.com/Microsoft/perfview/ | |
getcodetrack.com/ |
View Stuff
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
# Hyper-V Quick Create | |
# Increase disk size in Hyper-v manager | |
# install Gparted and resize | |
# Change screen resolution | |
# sudo nano /etc/default/grub | |
# GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1920x1080" | |
# sudo update-grub |
View Encryptor.cs
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
// .Net Symetric encryption | |
public class Encryptor<T> | |
where T : SymmetricAlgorithm, new() | |
{ | |
private const int KeySize = 256; | |
private readonly byte[] vectorBytes; | |
private readonly byte[] keyBytes; | |
public Encryptor( | |
string password, |
View profile.ps1
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
Import-Module 'C:\tools\poshgit\dahlbyk-posh-git-9bda399\src\posh-git.psd1' | |
$GitPromptSettings.EnablePromptStatus = $false | |
Set-PoshPrompt negligible | |
Import-Module -Name Terminal-Icons | |
Set-Alias vi 'C:\Program Files (x86)\vim\vim80\vim.exe' | |
Function prof { & vim.exe $profile; & $profile } | |
Function vimrc { vim.exe $home\_vimrc } |
View build.ps1
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
[CmdletBinding()] | |
Param( | |
[string]$Script = "build.cake", | |
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] | |
[string]$Verbosity = "Normal", | |
[Parameter(Position = 0, Mandatory = $false, ValueFromRemainingArguments = $true)] | |
[string[]]$ScriptArgs | |
) | |
dynamicparam { |
View closure-demo.ps1
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
$Foo = 1 | |
Write-Host "I expect Foo to be 1: " $Foo | |
function New-Closure { | |
param([Scriptblock] $Expression, $Foo = 2) | |
& $Expression | |
} | |
New-Closure -Expression { | |
Write-Host "I expected Foo to be 1, but was 2: " $Foo |
NewerOlder