Skip to content

Instantly share code, notes, and snippets.

View adventurist's full-sized avatar

Emmanuel Buckshi adventurist

View GitHub Profile
@adventurist
adventurist / decoder.asm
Created July 7, 2020 18:55
Decoder shared_ptr (asm)
Link::~Link() [base object destructor]:
push r12
mov r12, rdi
push rbp
push rbx
mov rbx, QWORD PTR [rdi+24]
test rbx, rbx
je .L3
mov ebp, OFFSET FLAT:_ZL28__gthrw___pthread_key_createPjPFvPvE
lea rax, [rbx+8]
@adventurist
adventurist / decoder.cpp
Created July 7, 2020 19:03
Decoder getter (cpp)
#include <memory>
#include <vector>
class Decoder {
public:
Decoder() { buffer.reserve(4990);}
bool decode(unsigned char* data, uint32_t size) {
if (size == 10) {
buffer.insert(buffer.end(), data, data + size);
@adventurist
adventurist / decoder.asm
Created July 7, 2020 19:05
Decoder getter (asm)
Decoder::Decoder() [base object constructor]:
push rbp
push rbx
mov rbx, rdi
sub rsp, 24
mov QWORD PTR [rdi], 0
mov QWORD PTR [rdi+8], 0
mov QWORD PTR [rdi+16], 0
mov edi, 4990
call operator new(unsigned long)
#include <sys/wait.h>
#include <unistd.h>
#include <sys/epoll.h>
#include <string>
#include <vector>
struct ProcessResult {
std::string output;
bool error = false;
};
@adventurist
adventurist / poll_test.cpp
Created August 18, 2020 01:14
poll forked process
struct ProcessResult {
std::string output;
bool error = false;
};
ProcessResult run(std::vector<std::string> args) {
int stdout_fds[2], stderr_fds[2];
pipe(stdout_fds);
pipe(stderr_fds);
@adventurist
adventurist / window_debug.hpp
Created January 27, 2021 03:52
print window messages
#pragma once
#include <string>
inline std::string get_window_message(uint32_t code)
{
switch (code)
{
@adventurist
adventurist / window_msg_seq.txt
Created January 27, 2021 04:32
Healthy window message sequence
WM_GETMINMAXINFO
WM_NCCREATE
WM_NCCALCSIZE
WM_CREATE
WM_SHOWWINDOW
WM_WINDOWPOSCHANGING
WM_NCPAINT
WM_ERASEBKGND
WM_WINDOWPOSCHANGED
WM_SIZE
@adventurist
adventurist / running_lists.cpp
Last active November 22, 2021 04:27
Running lists
bool ShouldSwap(std::vector<int> list, int i)
{
bool more_than_one_val = (list.size() > 1);
bool last_value_bigger = (list.back() > i);
bool second_last_smaller = (list[list.size() - 2] < i);
return (more_than_one_val && last_value_bigger && second_last_smaller);
}
void TestLists()
@adventurist
adventurist / simple_app.h
Created December 9, 2021 15:23
cef simple app header
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_TESTS_CEFSIMPLE_SIMPLE_APP_H_
#define CEF_TESTS_CEFSIMPLE_SIMPLE_APP_H_
#include "include/cef_app.h"
// Implement application-level callbacks for the browser process.
class SimpleApp : public CefApp, public CefBrowserProcessHandler {
public:
SimpleApp(uint64_t parent);
@adventurist
adventurist / simple_app.cc
Created December 9, 2021 15:24
cef simple app source
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "tests/cefsimple/simple_app.h"
#include <string>
#include "include/cef_browser.h"
#include "include/cef_command_line.h"
#include "include/views/cef_browser_view.h"
#include "include/views/cef_window.h"
#include "include/wrapper/cef_helpers.h"