Skip to content

Instantly share code, notes, and snippets.

View praeclarum's full-sized avatar

Frank A. Krueger praeclarum

View GitHub Profile
@praeclarum
praeclarum / gist:70631f41b678cd4e380b
Created June 9, 2015 02:08
Mocast Crash on iOS 9
Mocast[650] <Notice>: WARNING: The runtime version supported by this application is unavailable.\^J
Mocast[650] <Notice>: Using default runtime: v4.0.30319\^J
Mocast[650] <Notice>: * Assertion at ../../../../../mono/mono/mini/aot-runtime.c:4607, condition `amodule->info.tramp_page_size == psize' not met\^J
Mocast[650] <Notice>: \^JNative stacktrace:\^J\^J
Mocast[650] <Notice>: 0 Mocast 0x022f41c7 mono_handle_native_sigsegv + 238\^J
Mocast[650] <Notice>: 1 Mocast 0x022f8095 sigabrt_signal_handler + 104\^J
Mocast[650] <Notice>: 2 libsystem_platform.dylib 0x37fce88b _sigtramp + 42\^J
Mocast[650] <Notice>: 3 libsystem_pthread.dylib 0x37fd394f pthread_kill + 62\^J
Mocast[650] <Notice>: 4 libsystem_c.dylib 0x37ed5fe9 abort + 108\^J
Mocast[650] <Notice>: 5 Mocast 0x0239bd4d monoeg_log_default_handler + 112\^J
@praeclarum
praeclarum / Parser.fs
Last active August 29, 2015 14:16
Parser for a little language in F#
module Parser =
type Position =
{
Code : string
Index : int
}
let ws p =
if p.Index >= p.Code.Length then p
@praeclarum
praeclarum / PinnedArray2.fs
Created March 4, 2015 15:15
PinnedArray2 for passing 2D arrays to native code
type PinnedArray2 (array : float[,]) =
let h = GCHandle.Alloc (array, GCHandleType.Pinned)
let ptr = Marshal.UnsafeAddrOfPinnedArrayElement(array, 0)
member this.Ptr = NativePtr.ofNativeInt<float>(ptr)
interface IDisposable with
member this.Dispose () = h.Free ()
@praeclarum
praeclarum / ListDiff.fs
Created February 19, 2015 20:26
Finds a diff between two sequences (that contain possibly different types). Include merge.
namespace Praeclarum
type ListDiffAction<'TSource, 'TDestination> =
| Add of Destination : 'TDestination
| Update of Source : 'TSource * Destination : 'TDestination
| Remove of Source : 'TSource
/// Finds a diff between two sequences (that contain possibly different types).
/// Actions are generated such that the order of items in the
@praeclarum
praeclarum / TableViewController.cs
Last active January 5, 2021 14:31
All the boilerplate code needed to get a custom iOS UITableViewController up and running in C#
public class TableViewController : UITableViewController
{
static readonly NSString CellId = new NSString ("C");
readonly TableViewSource source = new TableViewSource ();
readonly List<string> rows = new List<string> ();
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
muon:coreclr-osx fak$ ls -al
total 51792
drwxr-xr-x 11 fak staff 374 Feb 6 23:50 .
drwx------ 7 fak staff 238 Feb 6 22:36 ..
-rw-r--r--@ 1 fak staff 6148 Feb 6 23:13 .DS_Store
-rwxr-xr-x 1 fak staff 49820 Feb 6 22:31 corerun
-rw-r--r--@ 1 fak staff 110 Feb 6 23:49 h.cs
-rwxr-xr-x 1 fak staff 3072 Feb 6 23:50 h.exe
-rw-r--r-- 1 fak staff 194 Feb 6 22:50 helloworld.cs
-rwxr-xr-x 1 fak staff 3072 Feb 6 22:50 helloworld.exe
muon:coreclr-osx fak$ ./corerun h.exe
libc++abi.dylib: terminating with uncaught exception of type std::out_of_range: basic_string
Abort trap: 6
muon:coreclr-osx fak$ lldb ./corerun h.exe
(lldb) target create "./corerun"
Current executable set to './corerun' (x86_64).
(lldb) settings set -- target.run-args "h.exe"
(lldb) run
Process 37845 launched: './corerun' (x86_64)
libc++abi.dylib: terminating with uncaught exception of type std::out_of_range: basic_string
using System;
namespace TestApps
{
public class HelloWorldApp
{
public static int Main (string[] args)
{
Console.WriteLine ("Hello, world. It's " + DateTime.Now);
return 0;
@praeclarum
praeclarum / gist:8cc6e666a90944c59e7c
Created February 7, 2015 07:39
Backtrace of crash
muon:coreclr-osx fak$ ls -al
total 51776
drwxr-xr-x 9 fak staff 306 Feb 6 23:13 .
drwx------ 7 fak staff 238 Feb 6 22:36 ..
-rw-r--r--@ 1 fak staff 6148 Feb 6 23:13 .DS_Store
-rwxr-xr-x 1 fak staff 49820 Feb 6 22:31 corerun
-rw-r--r-- 1 fak staff 194 Feb 6 22:50 helloworld.cs
-rwxr-xr-x 1 fak staff 3072 Feb 6 22:50 helloworld.exe
-rwxr-xr-x 1 fak staff 23490408 Feb 6 23:05 libcoreclr.dylib
-rwxr-xr-x 1 fak staff 4176 Feb 6 23:05 libmscordaccore.dylib
@praeclarum
praeclarum / gist:c11200dc8c05edc1046f
Created February 7, 2015 07:08
My Second CoreCLR OS X Run
muon:coreclr-osx fak$ ls -al
total 51768
drwxr-xr-x 8 fak staff 272 Feb 6 23:06 .
drwx------ 7 fak staff 238 Feb 6 22:36 ..
-rwxr-xr-x 1 fak staff 49820 Feb 6 22:31 corerun
-rw-r--r-- 1 fak staff 194 Feb 6 22:50 helloworld.cs
-rwxr-xr-x 1 fak staff 3072 Feb 6 22:50 helloworld.exe
-rwxr-xr-x 1 fak staff 23490408 Feb 6 23:05 libcoreclr.dylib
-rwxr-xr-x 1 fak staff 4176 Feb 6 23:05 libmscordaccore.dylib
-rw-r--r--@ 1 fak staff 2941952 Feb 6 22:38 mscorlib.dll