Skip to content

Instantly share code, notes, and snippets.

View kekekeks's full-sized avatar

Nikita Tsukanov kekekeks

  • Kazakhstan, Astana
View GitHub Profile
using System;
namespace Kebrum.Widgets
{
public class CairoBridge:IDisposable
{
private Cairo.ImageSurface m_Surface;
private System.Drawing.Graphics m_Graphics;
private System.Drawing.Bitmap m_Bitmap;
@kekekeks
kekekeks / gist:e0b0504dc8bac75697e7
Created April 25, 2015 09:34
actorawait exceptions
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Diagnostics.Tracing;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Runtime.CompilerServices;
@kekekeks
kekekeks / test
Created May 12, 2013 10:07
Test for MonoLib demo
Hello world!
@kekekeks
kekekeks / interlockedCompareExchange.lua
Last active January 3, 2016 08:39
Interlocked compare exchange for Redis EVAL "<script>" 1 <key> <sequenceId> <keyCount> <key1> <value1> <key2> <value2>
local oldSeq; local oldData;
oldSeq = redis.call('hget',KEYS[1], 'sequence')
oldData = redis.call('hgetall',KEYS[1])
if oldSeq and tonumber(oldSeq) >= tonumber(ARGV[1]) then
return -1
else
redis.call('hset', KEYS[1], 'sequence', ARGV[1]);
local maxi = tonumber(ARGV[2])*2 + 3;
for idx = 3, maxi, 2 do
@kekekeks
kekekeks / x11.cs
Created November 29, 2016 09:08
XPutImage example for GTK#
public static class X11
{
[DllImport ("libX11.so.6")]
static extern IntPtr XOpenDisplay(IntPtr display);
static IntPtr Disp;
[DllImport ("libX11.so.6")]
static extern int XGetGeometry(IntPtr disp, IntPtr hwnd, out IntPtr root, out int x, out int y,
out int width, out int height, out int border, out int depth);
[DllImport ("libX11.so.6")]
static extern IntPtr XInitImage(ref XImage image);
@kekekeks
kekekeks / OemEncoding.cs
Created May 31, 2018 13:41
OEM encoding C#
using System.Linq;
using System.Text;
class OemEncoding : Encoding
{
private static readonly char[] Oem =
new[]
{
127, 199, 252, 233, 226, 228, 224, 229, 231, 234, 235, 232, 239, 238, 236, 196, 197, 201, 230, 198, 244,
@kekekeks
kekekeks / skiasharp.md
Last active January 24, 2019 14:38
SkiaSharp cross-building
debootstrap trusty /build-armhf

# Will need to do it after every reboot
mount --rbind /proc /build-armhf/proc
mount --rbind /home /build/armhf/home

chroot /build-armhf
adduser YOUR_USER_NAME_HERE
public class Result<T> : Result
{
public T Value { get; }
public Result(T result)
{
Success = true;
Value = result;
}
public Result()

This is a proposal to fund Avalonia development

A dual-licensed (AGPL3 + commercial) components pack

  • OS-specific auto-selected control themes: Windows, macOS, Ubuntu, Android, iOS
  • Ported WPF or Xceed's data grid(s)
  • WPF-on-Avalonia: binary-compatible WPF classes compiled from original sources with HwndSource and other classes implemented on top of Avalonia
  • UWP-on-Avalonia: Uno's approach basically. We might even reuse their sources since they are MIT licensed
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;