Skip to content

Instantly share code, notes, and snippets.

View kg's full-sized avatar

Katelyn Gadd kg

View GitHub Profile
@kg
kg / ws.cs
Created August 21, 2017 02:30
public async Task MainLoop () {
var readBuffer = new ArraySegment<byte>(new byte[102400]);
WebSocketReceiveResult wsrr;
if (!await Start()) {
WebSocket.Dispose();
return;
}
@kg
kg / dpi.cs
Created August 12, 2017 03:25
unsafe static Program () {
var dpiSetOk = false;
try {
var hr = Win32.SetProcessDpiAwareness(Win32.ProcessDpiAwareness.PROCESS_PER_MONITOR_DPI_AWARE);
if (hr != 0)
Console.WriteLine("SetProcessDpiAwareness={0}, LastError={1}", hr, Marshal.GetLastWin32Error());
else
dpiSetOk = true;
} catch {
Updating goal targets....
/home/kate/Projects/mono/mcs/class/System/../../build/rules.make:205 File `install-local' does not exist.
/home/kate/Projects/mono/mcs/class/System/../../build/rules.make:205 File `all-local' does not exist.
Prerequisite `../../class/lib/net_4_x-linux/System.Xml.dll' is newer than target `../../class/lib/net_4_x-linux/System.dll'.
Prerequisite `../../class/lib/net_4_x-linux/System.Configuration.dll' is newer than target `../../class/lib/net_4_x-linux/System.dll'.
/home/kate/Projects/mono/mcs/class/System/../../build/deps/linux_net_4_x__System.dll.makefrag:1 Must remake target `../../class/lib/net_4_x-linux/System.dll'.
Invoking recipe from ../../build/library.make:311 to update target `../../class/lib/net_4_x-linux/System.dll'.
##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
echo "CSC [net_4_x-linux] System.dll"; MONO_PATH="./../../class/lib/build:$MONO_PATH" CSC_SDK_PATH_DISABLED= /home/kate/Projects/mono/runtime/mono-wrapper --aot-path=/home/
Considering target file `../../build/rules.make'.
Looking for an implicit rule for `../../build/rules.make'.
Trying pattern rule with stem `rules.make'.
Trying implicit prerequisite `../../build/rules.make.o'.
Trying pattern rule with stem `rules.make'.
Trying implicit prerequisite `../../build/rules.make.c'.
Trying pattern rule with stem `rules.make'.
Trying implicit prerequisite `../../build/rules.make.cc'.
Trying pattern rule with stem `rules.make'.
Trying implicit prerequisite `../../build/rules.make.C'.
class Program {
static void Main (string[] args) {
dynamic x = new ExpandoDictionary();
// This initial cast on assignment sucks, but if it's an existing method, you're set
x.d = (Func<int, int>)Double;
x.a = 1;
Console.WriteLine(x.d(x.a));
Console.WriteLine(x["d"](x["a"]));
Console.ReadLine();
}
static void Main (string[] args) {
dynamic x = new ExpandoObject();
// This initial cast on assignment sucks, but if it's an existing method, you're set
x.d = (Func<int, int>)Double;
x.a = 1;
Console.WriteLine(x.d(x.a));
}
public static int Double (int x) {
return x * 2;
kate@reeir-ubuntu:~/Projects/bundle/TestApp/bin/Debug$ mkbundle -v -o testapp TestApp.exe --deps --i18n none
OS is: Linux
Sources: 1 Auto-dependencies: True
Log:
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at MakeBundle.QueueAssembly (System.Collections.Generic.List`1[T] files, System.String codebase) [0x000bc] in <99cae4441c31455d9c15e98b8e544767>:0
at MakeBundle.Main (System.String[] args) [0x00d32] in <99cae4441c31455d9c15e98b8e544767>:0
// Cached text the easy way
Prompt = new DynamicStringLayout(
Game.Font, "Select a tile (right click to cancel)"
);
// Shadows the awkward way
renderer.DrawMultiple(layout, position.Floor() + Vector2.One, multiplyColor: Color.Black, sortKey: 0f);
renderer.DrawMultiple(layout, position.Floor(), multiplyColor: Color.White, sortKey: 1f);
(function () {
this.stampInfo = {
1: "vii here goes ikuze",
2: "lyria hurray hooray",
3: "io awesome gujjobu good job",
4: "rackam much obliged thanks yoroshikuna",
5: "katalina reporting in", // todo
6: "lyria come forth", // todo
7: "jita pots potions please pls plz heals healing hirupurizu",
8: "gran give up", // todo
@kg
kg / x.c
Created April 13, 2017 18:42
MonoInst *iargs [2];
MonoMethodSignature *fsig;
MonoInst this_ins;
MonoInst *alloc;
MonoInst *vtable_arg = NULL;
MonoMethod *cil_method;
CHECK_OPSIZE (5);
token = read32 (ip + 1);
cmethod = mini_get_method (cfg, method, token, NULL, generic_context);