Skip to content

Instantly share code, notes, and snippets.

@antopor
antopor / lz4test.cpp
Created April 21, 2016 02:00
lz4frame test program
#include <cstdlib>
#include <string>
#include <cassert>
#include "lz4frame.h"
const int data_size = 550 * 1024;
const int chunk_size = 256 * 1024;
void main()
{
// genearate some data
@antopor
antopor / service.md
Created November 18, 2015 20:33
Windows service operations

https://support.microsoft.com/en-us/kb/251192

###Service list sc query type= service net start

###Register a service sc create MyServiceName start=[boot|system|auto|demand|disabled] binPath="path/to/MyService.exe" DisplayName="My Service Display Name" obj="UserName"

@antopor
antopor / TcpClientExtensions.cs
Last active August 29, 2015 14:16
SetKeepAlive - activates keep-alive mechanism for TcpClient.
public static class TcpClientExtensions
{
/// <summary>
/// Activate Keep-Alive for TcpClient. Support only for Windows 2k and later
/// </summary>
/// <param name="client"></param>
/// <param name="keepAliveTime">Time (in milliseconds) with no activity on a socket</param>
/// <param name="keepAliveInterval">Interval (in milliseconds) between keep-alive packets. The number of packets depends on OS version.</param>
public static void SetKeepAlive(this TcpClient client, uint keepAliveTime, uint keepAliveInterval)
{
@antopor
antopor / makecert.txt
Created March 9, 2015 15:10
Some useful commands to make certificates
Self signed root certificate
makecert -r -pe -n "CN=RootCA" -a sha1 -sky signature -cy authority -sv rootca.pvk rootca.cer
Make certificate signed by CA
makecert -cy end -n "CN=example.com" -ic rootca.cer -iv rootca.pvk -a sha1 -sky exchange -pe -sv example.com.pvk example.com.cer
Export private and public keys into pxf certificate
pvk2pfx -pvk example.com.pvk -spc example.com.cer -pfx example.com.pfx
@antopor
antopor / StreamPipe.cs
Created March 7, 2015 04:14
How to redirect Process' standart input/output (C#, .net 4.5, async code)
using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace Test
{
class Program
{