Skip to content

Instantly share code, notes, and snippets.

View jonpryor's full-sized avatar

Jonathan Pryor jonpryor

View GitHub Profile
// SafeHandle.Close()...
using System;
using System.Runtime.InteropServices;
class MySafeHandle : SafeHandle {
public MySafeHandle ()
: base (IntPtr.Zero, ownsHandle:false)
{
#include <vector>
#include <string>
#include <iostream>
using namespace std;
class BigNumber
{
private:
vector<int> v;
#!/usr/bin/env csharp
var args = Environment.GetCommandLineArgs ();
for (int i = 0; i < args.Length; ++i) {
Console.WriteLine ("{0}: {1}", i, args [i]);
}
@jonpryor
jonpryor / App.cs
Last active August 29, 2015 14:02 — forked from anaisbetts/App.cs
namespace MobileSample_Android
{
[Application(Label = "AndroidPlayground")]
public class App : Application
{
readonly AutoSuspendHelper suspendHelper;
public App(IntPtr handle, JniHandleOwnership transfer)
: base (handle, transfer)
{
class Test {
public static void Main ()
{
}
static void A ()
{
int[] value = {1};
}
$ mono lesshaste.exe
Prepping Test
data50000000.txt
Starting Test
Started: Total Time
Started: Reading Data
Started: Read From Disk
Finished: Read From Disk in 18871ms
@jonpryor
jonpryor / output.txt
Created May 8, 2014 19:48
Demonstrate bash dynamic scoping
start: str=begin
inner: str=outer
end: str=begin
#/usr/bin/env perl -w
use strict;
use Mail::SPF;
my $spf_server = Mail::SPF::Server->new(
# Optional custom default for authority explanation:
default_authority_explanation => 'See http://www.%{d}/why/id=%{S};ip=%{I};r=%{R}',
max_dns_interactive_terms => 18
);
enum Test
{
Hello,
Heya
}
var test = Test.Hello;
Console.WriteLine(test.GetType().IsEnum);
Console.WriteLine("Property Count: {0}", test.GetType().GetProperties().Length);
$ csharp -r:System.Numerics.dll
Mono C# Shell, type "help;" for help
Enter statements below.
csharp> using System.Numerics;
csharp> var b = new BigInteger(3);
csharp> var r = BigInteger.Pow(b, 1000);
csharp> r;
1322070819480806636890455259752144365965422032752148167664920368226828597346704899540778313850608061963909777696872582355950954582100618911865342725257953674027620225198320803878014774228964841274390400117588618041128947815623094438061566173054086674490506178125480344405547054397038895817465368254916136220830268563778582290228416398307887896918556404084898937609373242171846359938695516765018940588109060426089671438864102814350385648747165832010614366132173102768902855220001