Skip to content

Instantly share code, notes, and snippets.

View leppie's full-sized avatar
🤡

Llewellyn Pritchard leppie

🤡
  • Cape Town, South Africa
View GitHub Profile
@leppie
leppie / gist:5371877
Created April 12, 2013 13:09
Uncompiled, untested, just written blindly :)
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Mono.Cecil;
namespace NamespaceRenamer
{
class Program
{
class Transform
{
@leppie
leppie / gist:5660605
Created May 28, 2013 05:00
COBOL might be an option given this crap...
public static string GetStateString(JobState state)
{
string strState = null;
switch (state)
{
case JobState.Started: strState = "Started"; break;
case JobState.Edited: strState = "Edited"; break;
case JobState.Running: strState = "Running"; break;
case JobState.Suspended: strState = "Suspended"; break;
case JobState.Signed: strState = "Signed"; break;
@leppie
leppie / gist:5853161
Created June 24, 2013 20:09
Nuget PRIFIT
1. Create C# app
2. Install-Package IronScheme.Code
3. Add code:
using System;
using IronScheme;
public class Program
{
static void Main()
@leppie
leppie / gist:5853177
Created June 24, 2013 20:11
Nuget, PROFIT!
// 1. Create C# app
// 2. Install-Package IronScheme.Core
// 3. Add code:
using System;
using IronScheme;
public class Program
{
static void Main()
[SecuritySafeCritical]
public virtual void Flush(bool flushToDisk)
{
if (this._handle.IsClosed)
{
__Error.FileNotOpen();
}
this.FlushInternalBuffer();
if (flushToDisk && this.CanWrite)
{
@leppie
leppie / gist:6229691
Created August 14, 2013 10:10
Bad math
using MathNet.Numerics;
using System;
using System.Numerics;
namespace ConsoleApplication21
{
class Program
{
static void Main(string[] args)
{
@leppie
leppie / gist:6439246
Created September 4, 2013 16:13
JIT assembly
fxdiv0
int d = 0;
00000000 push ebp
00000001 mov ebp,esp
00000003 push edi
00000004 push esi
00000005 mov esi,ecx
00000007 mov ecx,edx
00000009 xor edx,edx
@leppie
leppie / gist:6535483
Created September 12, 2013 10:26
Putting this on my CV
Other affiliations:
United Federation of Planets (46379.1 - 46831.5)
Responsibilities:
- Cleaning plasma warp coils
- Assist in dylithium crystal alignment
- Replacement of bio-neural gel packs in the Jefferies tubes
No inlining
===========
.NET 3.5 (32-bit):
3369
4823
4363
.NET 3.5 (64-bit):
3362
3842
6734
static unsafe CharUnicodeInfo()
{
m_pDataTable = GlobalizationAssembly.GetGlobalizationResourceBytePtr(typeof(CharUnicodeInfo).Assembly, "charinfo.nlp");
UnicodeDataHeader* pDataTable = (UnicodeDataHeader*) m_pDataTable;
m_pCategoryLevel1Index = (ushort*) (m_pDataTable + pDataTable->OffsetToCategoriesIndex);
m_pCategoriesValue = m_pDataTable + ((byte*) pDataTable->OffsetToCategoriesValue);
m_pNumericLevel1Index = (ushort*) (m_pDataTable + pDataTable->OffsetToNumbericIndex);
m_pNumericValues = m_pDataTable + ((byte*) pDataTable->OffsetToNumbericValue);
m_pDigitValues = (DigitValues*) (m_pDataTable + pDataTable->OffsetToDigitValue);
nativeInitTable(m_pDataTable);