Skip to content

Instantly share code, notes, and snippets.

View kekekeks's full-sized avatar

Nikita Tsukanov kekekeks

  • Kazakhstan, Astana
View GitHub Profile
@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
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 / ru_en_analyzer
Last active April 12, 2023 15:16
russian + english analyzer for elasticsearch русский + английский
{
"settings": {
"analysis": {
"filter": {
"english_stop": {
"type": "stop",
"stopwords": "_english_"
},
"english_stemmer": {
"type": "stemmer",
@kekekeks
kekekeks / gist:c32b11f1996d3314116c
Created April 25, 2015 09:13
Akka.Net ActorAwait
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 / 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 / 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()