Skip to content

Instantly share code, notes, and snippets.

Jonathan Dickinson jcdickinson

Block or report user

Report or block jcdickinson

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 Parse.cpp
// Does not reject invalid data. define NO_OVERFLOW to avoid values
// larger than 15, but it will still accept invalid characters.
// MSN(x) = Most-significant nibble
// LSN(x) = Least-significant nibble
// SHL(x, y) = Shift left
// SHR(x, y) = Shift right
// MSN(Digits) = 0011
// MSN(Upper) = 0100
@jcdickinson
jcdickinson / Add.asm
Last active Nov 4, 2017
The Curious Case of the 1814 Byte Method
View Add.asm
; Assembly listing for method System.HashCode:Test_1():int
; Emitting BLENDED_CODE for X64 CPU with AVX
; optimized code
; rsp based frame
; partially interruptible
; Final local variable assignments
;
; V00 loc0 [V00 ] ( 29, 11 ) struct (32) [rsp+0x30] do-not-enreg[XSFB] must-init addr-exposed ld-addr-op
; V01 tmp0 [V01,T00] ( 3, 6 ) int -> rcx
; V02 tmp1 [V02,T08] ( 5, 2 ) int -> rcx
View razerngen.ps1
$InstallDir = 'C:\Program Files (x86)\Razer'
Get-ChildItem -Path $InstallDir -Filter '*.dll' -Recurse | ForEach-Object {
$Assembly = $_.FullName
Write-Host "Queueing up $Assembly for NGEN installation."
C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe install $Assembly /queue:2 /nologo
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe install $Assembly /queue:2 /nologo
}
Get-ChildItem -Path $InstallDir -Filter '*.exe' -Recurse | ForEach-Object {
@jcdickinson
jcdickinson / forward.bat
Created Jan 25, 2017
Forward Azure Storage Emulator
View forward.bat
netsh interface portproxy add v4tov4 listenport=20000 connectaddress=127.0.0.1 connectport=10000 protocol=tcp
netsh interface portproxy add v4tov4 listenport=20001 connectaddress=127.0.0.1 connectport=10001 protocol=tcp
netsh interface portproxy add v4tov4 listenport=20002 connectaddress=127.0.0.1 connectport=10002 protocol=tcp
REM Your connection string will be similar to:
REM DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;
REM AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;
REM BlobEndpoint=http://192.168.0.2:20000/devstoreaccount1;
REM TableEndpoint=http://192.168.0.2:20002/devstoreaccount1;
REM QueueEndpoint=http://192.168.0.2:20001/devstoreaccount1;
@jcdickinson
jcdickinson / readme.md
Created Oct 10, 2016
Git History Transplant
View readme.md

Git History Transplant

If you've copied a repository instead of forking it, and need to merge changes across.

Source Repository

  1. Merge into your current branch if you have to.

  2. Identify the commit where the divergence occurred. Create a branch off of it for easy reference:

View FastBufferManager.cs
/// <summary>
/// Represents a buffer manager.
/// </summary>
sealed class FastBufferManager
{
private const int Decongest = 16;
/// <summary>
/// Represents a portion of the buffers, designed to reduce congestion.
/// </summary>
View Select-Regex.ps1
Function Select-Regex {
Param(
[Parameter(ValueFromPipeline=$True)] $Input,
[Parameter(Mandatory=$True, Position=0)] [String] $Pattern
)
Begin {
$Regex = New-Object Regex $Pattern, 'ExplicitCapture'
}
Process {
@jcdickinson
jcdickinson / Program.cs
Created Aug 17, 2015
Find All Roots For Type
View Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Diagnostics.Runtime;
using System.IO;
using System.Collections;
using System.Diagnostics;
namespace EEHeap
View Murmur3.cs
using System.Security.Cryptography;
/// <summary>
/// Represents the Murmur 3 Hash Algorithm.
/// </summary>
/// <remarks>
/// Murmur 3 is not cryptographically secure, instead it is used
/// for content identification.
/// </remarks>
public sealed class Murmur3 : HashAlgorithm
@jcdickinson
jcdickinson / Demo.cs
Created Jul 8, 2015
Return To SynchronizationContext
View Demo.cs
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
async void button1_Click(object sender, EventArgs e)
{
var context = SynchronizationContext.Current;
You can’t perform that action at this time.