Skip to content

Instantly share code, notes, and snippets.

View qrealka's full-sized avatar

Dmitry Loginov qrealka

View GitHub Profile
@qrealka
qrealka / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Keybase proof

I hereby claim:

  • I am qrealka on github.
  • I am qrealka (https://keybase.io/qrealka) on keybase.
  • I have a public key whose fingerprint is A6C9 2268 B494 4480 D835 8795 17F5 8BDA EFD8 7467

To claim this, I am signing this object:

@qrealka
qrealka / gist:448bf12d0984611ab939eb7f8b27c8dc
Last active May 4, 2016 14:23
simple test for move result from async
#include "stdafx.h"
#include <future>
#include <iostream>
class NonCopyable
{
std::unique_ptr<int> payload;
NonCopyable(const NonCopyable&) = delete;
NonCopyable& operator=(const NonCopyable&) = delete;
@qrealka
qrealka / virtual_test.cpp
Last active January 24, 2017 15:24
test virtual
#include <iostream>
using namespace std;
struct A1
{
virtual void Test() = 0;
virtual ~A1()
{
std::cout << "~A1\n";
@qrealka
qrealka / static_if.cc
Created May 10, 2017 07:39 — forked from lichray/static_if.cc
Implement static_if using C11 generic selection
#include <type_traits>
#include <tuple>
#include <iostream>
// Link: https://github.com/aeyakovenko/notes
//count arguments
//COUNT_ARGS :: ... -> Int
#define COUNT_ARGS(...) COUNT_ARGS_(,##__VA_ARGS__,6,5,4,3,2,1,0)
#define COUNT_ARGS_(z,a,b,c,d,e,f,cnt,...) cnt
@qrealka
qrealka / rich.py
Created May 28, 2017 08:39 — forked from skochinsky/rich.py
MSVC PE Rich header parser with compiler version display
# based on code from http://trendystephen.blogspot.be/2008/01/rich-header.html
import sys
import struct
# I'm trying not to bury the magic number...
CHECKSUM_MASK = 0x536e6144 # DanS (actuall SnaD)
RICH_TEXT = 'Rich'
RICH_TEXT_LENGTH = len(RICH_TEXT)
PE_START = 0x3c
PE_FIELD_LENGTH = 4
/ebook
<<
/UCRandBGInfo /Remove
/DoThumbnails false
/ColorImageDownsampleType /Average
/PreserveEPSInfo false
/ColorConversionStrategy /sRGB
/GrayImageDownsampleType /Average
/EmbedAllFonts true
/CannotEmbedFontPolicy /Warning

C++ source code snippets

Represent one byte

using Byte = std::uint8_t;

Represent a dynamic number of bytes

#include <vector>
@qrealka
qrealka / smbloris.c
Created August 3, 2017 09:27 — forked from marcan/smbloris.c
SMBLoris attack proof of concept
/* SMBLoris attack proof-of-concept
*
* Copyright 2017 Hector Martin "marcan" <[email protected]>
*
* Licensed under the terms of the 2-clause BSD license.
*
* This is a proof of concept of a publicly disclosed vulnerability.
* Please do not go around randomly DoSing people with it.
*
* Tips: do not use your local IP as source, or if you do, use iptables to block