Skip to content

Instantly share code, notes, and snippets.

@aensidhe
aensidhe / gist:e8069dd159cdd86c97fa
Created May 27, 2015 08:52
IIS full log grok pattern
IISDATE %{YEAR}-%{MONTHNUM}-%{MONTHDAY}
IISURIPARAM [A-Za-z0-9$.+!*'|(){},~@#%&/=:;_?\-\[\]]*
IISHOST %{IPORHOST}(:%{POSINT})?
IISURL (%{URIPROTO}://%{IISHOST}?%{URIPATHPARAM}?)|\-
IISTIMESTAMP %{IISDATE} %{TIME}
IISLOG %{IISTIMESTAMP:datetime} %{NOTSPACE:site} %{HOSTNAME:server} %{IP:server_ip} %{WORD:http_method} %{URIPATHPARAM:url_path} %{IISURIPARAM:url_query} %{POSINT:port:int} %{NOTSPACE:user} %{IP:client_ip} %{NOTSPACE:http_version} %{NOTSPACE:user_agent} %{NOTSPACE:cookies} %{IISURL:referer} %{IISHOST:host_name} %{INT:http_status:int} %{INT:http_sub_status:int} %{INT:win32_status:int} %{INT:response_size:int} %{INT:request_size:int} %{INT:duration_ms:int}
@aensidhe
aensidhe / 1.msil
Created July 28, 2016 20:12
valid il can contain several rets
.assembly test.msil {
.hash algorithm 0x00008004
.ver 2:0:0:0
}
.method static void main()
{
.entrypoint
.maxstack 1
ldstr "Hello world!"
@aensidhe
aensidhe / sample.cs
Last active August 3, 2016 10:32
Tarantool box info
using System;
using System.Net;
using System.Threading.Tasks;
using MsgPack.Light;
using Tarantool.Client;
using Tarantool.Client.Model;
using Tuple = Tarantool.Client.Model.Tuple;
namespace Tarantool.BoxInfo
{
@aensidhe
aensidhe / log.txt
Last active November 11, 2016 21:07
tarantool.error
2016-11-11 19:42:20.080 [1] main/105/applier/10.31.200.12:3301 I> authenticated
2016-11-11 19:42:20.081 [1] main/105/applier/10.31.200.12:3301 I> can't read row
2016-11-11 19:42:20.081 [1] main/105/applier/10.31.200.12:3301 xrow.cc:265 E> ER_CLUSTER_ID_MISMATCH: Cluster id of the replica fa84c44b-176f-40dc-a63c-40b1346f173f doesn't match cluster id of the master b43b1197-f087-4945-8e4b-fb83aff5cb74
2016-11-11 19:53:21.933 [1] wal/102/wal I> creating `/var/lib/tarantool/00000000000000031719.xlog.inprogress'
2016-11-11 20:10:47.001 [1] main/108/snapshot_daemon I> making snapshot...
@aensidhe
aensidhe / 1.lua
Last active July 1, 2018 18:23
reload
function reload ()
log.info(' module reloading started ...')
if my_module ~= nil then
-- hot code reload using tarantoolctl or dofile()
-- unload old application
my_module.stop()
-- clear cache for loaded modules and dependencies
package.loaded['my_module'] = nil
end
@aensidhe
aensidhe / imagemagick.cs
Created December 21, 2017 22:09
Trying to write a wrapper to ImageMagick
var histogram = GetImageHistogram(this.wand, out var lenPtr);
var len = lenPtr.ToUInt32();
var result = new Dictionary<MagickColor, int>();
try
{
for (var i = 0; i < len; i++)
{
var ptr = histogram + i * IntPtr.Size;
Console.WriteLine($"{i} iteration, ptr: {histogram}, cur: {ptr}");
@aensidhe
aensidhe / msgpack.cs
Created July 17, 2018 20:38
Nice code
public static bool TryReadExtension(ReadOnlySpan<byte> buffer, out byte type, out IMemoryOwner<byte> extension, out int readSize)
{
extension = null;
return TryReadExtensionHeader(buffer, out type, out var length, out readSize)
&& length <= int.MaxValue
&& TryReadExtension(buffer, (int) length, ref extension, ref readSize);
}
@aensidhe
aensidhe / keybase.md
Created December 29, 2018 11:50
keybase.md

Keybase proof

I hereby claim:

  • I am aensidhe on github.
  • I am aensidhe (https://keybase.io/aensidhe) on keybase.
  • I have a public key ASDtJML5IofQ_pGIhkVynRAROmoQ5gZc7JNVRNGl3cFd4go

To claim this, I am signing this object:

@aensidhe
aensidhe / 01. Program.cs
Last active May 29, 2019 15:08
Logging into relative path
using System;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Serilog;
namespace WebApplication1
{
public class Program
{
@aensidhe
aensidhe / 01. Program.cs
Created May 30, 2019 13:34
NLog example
using System;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using NLog.Web;
using Serilog;
namespace WebApplication1
{
public class Program