Skip to content

Instantly share code, notes, and snippets.

Marek Safar marek-safar

Block or report user

Report or block marek-safar

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 gist:f83cd1ef848b7b304de4ae494bc74fa6
using System;
class X
{
private static ReadOnlySpan<byte> ROS => new byte[10800] {
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x03, 0x02, 0x04, 0x03, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x02,
0x05, 0x06, 0x06, 0x07, 0x08, 0x07, 0x06, 0x06, 0x09, 0x0a, 0x06, 0x0b, 0x0c, 0x0d, 0x0c, 0x0c,
0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0c, 0x06, 0x0f, 0x0f, 0x0f, 0x06,
0x06, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
View gist:670c40f810cfd09b1498c52f1f8b6978
public class Benchmarks
{
static byte[] array = new byte[32];
static int res;
[Params(ulong.MaxValue)]
public ulong Input { get; set; }
[Benchmark]
public bool StringVersion()
View gist:b26e2bfc9a60a2bd348b3f36d3cb8288
[Benchmark]
public char Test_Condition ()
{
return Convert_Condition (14);
}
[Benchmark]
public char Test_String ()
{
View gist:397c82718e896140e30049fb7d76e773
--- test-good-managed/mscorlib.il 2019-12-15 12:45:36.000000000 +0100
+++ test-bad-managed/mscorlib.il 2019-12-15 12:45:44.000000000 +0100
@@ -159,7 +159,7 @@
// WARNING: managed resource file charinfo.nlp created
}
.module mscorlib.dll
-// MVID: {65EC3698-9650-4F32-80BC-59D8F76B607B}
+// MVID: {EA925DED-B757-435C-A54C-375D3440FEB6}
.imagebase 0x00400000
.file alignment 0x00000200
View gist:482d13a21daebfc73393a73253f0ac8a
./Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ZeroInitialize.cs: public override object Object => Activator.CreateInstance(Type.AssociatedSystemType);
./Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExprFactory.cs: return CreateConstant(type, ConstVal.Get(Activator.CreateInstance(type.AssociatedSystemType)));
./System.Data.OleDb/src/OleDbEnumerator.cs: object value = Activator.CreateInstance(type, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance, null, null, CultureInfo.InvariantCulture, null);
./System.Data.OleDb/src/OleDbWrapper.cs: // DataLinks (the unknown parameter) is created via Activator.CreateInstance outside of the SafeHandle
./System.Data.OleDb/src/OleDbConnectionInternal.cs: return Activator.CreateInstance(datalink, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance, null, null, CultureInfo.InvariantCulture, null);
./System.Linq.Queryable/src/System/
View gist:19e0af908a30404a91b551ce7c182290
[Serializable]
[DebuggerDisplay ("{v,nq}")]
public unsafe struct nfloat : IFormattable, IConvertible, IComparable, IComparable<nfloat>, IEquatable <nfloat>
{
internal nfloat (nfloat v) { this.v = v.v; }
public nfloat (Single v) { this.v = v; }
#if ARCH_32
public static readonly int Size = 4;
View gist:c8757098a0269f83ee10e431f6ebc494
using System;
class Sample
{
protected static int origRow;
protected static int origCol;
protected static void WriteAt(string s, int x, int y)
{
Console.Write(" " + s);
View gist:8df9195911ba3c92c8c57b8a0d2b50da
{
"payload" :
{
"protocol_version" : "0.0.4",
"configuration" : {
"version" : "(6.4.0.179) (2019-06/3608a495413)",
"tlc" : "normal",
"sigsgev" : "altstack",
"notifications" : "kqueue",
"architecture" : "amd64",
View gist:ba4c1a7a7087d77a9341d8ff36515493
IEnumerator<ConstructorInfo> e = typeInfo.DeclaredConstructors.GetEnumerator();
do {
ConstructorInfo constructorInfo = e.Current();
if (!constructorInfo.IsStatic && constructorInfo.GetParameters.Length() == 0) {
inst = constructorInfo.Invoke(null);
break;
}
} while (e.MoveNext())
View gist:7ab38b550cdb71dba987c00480f7bfa0
IEnumerator<ConstructorInfo> e = typeInfo.DeclaredConstructors.GetEnumerator();
do {
ConstructorInfo constructorInfo = e.Current();
if (!constructorInfo.IsStatic && constructorInfo.GetParameters.Length() == 0) {
inst = constructorInfo.Invoke(null);
break;
}
} while (e.MoveNext())
You can’t perform that action at this time.