Skip to content

Instantly share code, notes, and snippets.

View ivanstepanovftw's full-sized avatar

ivanstepanovftw

View GitHub Profile
#include <iostream>
#include <fstream>
#include <vector>
#include <iomanip>
#include <boost/iostreams/device/mapped_file.hpp>
#include <boost/iostreams/device/array.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/serialization/vector.hpp>
@ivanstepanovftw
ivanstepanovftw / main.cc
Last active February 16, 2019 14:09
g++ main.cc -o main -lboost_serialization -lboost_iostreams
#include <iostream>
#include <fstream>
#include <vector>
#include <iomanip>
#include <boost/iostreams/device/mapped_file.hpp>
#include <boost/iostreams/device/array.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/serialization/vector.hpp>
#!/usr/bin/env bash
#set -x
EXE=$(readlink -f ${BASH_SOURCE})
WD=$(dirname ${EXE})
cd ${WD}
rm -rf ${EXE}.*
cat > ${EXE}.cc <<'EOF'
#include <zconf.h>
/** @arg what: any number
* @return: string number represented as hex */
template <typename T, std::endian endianess = std::endian::native>
std::string HEX__1(const T& value, size_t value_size = sizeof(T))
{
using namespace std;
uint8_t *buffer = (uint8_t*)(&value);
char converted[value_size * 2 + 1];
if (endianess == std::endian::big)
@ivanstepanovftw
ivanstepanovftw / memory_layout.md
Created March 27, 2019 23:35 — forked from CMCDragonkai/memory_layout.md
Linux: Understanding the Memory Layout of Linux Executables

Understanding the Memory Layout of Linux Executables

Required tools for playing around with memory:

  • hexdump
  • objdump
  • readelf
  • xxd
  • gcore
@ivanstepanovftw
ivanstepanovftw / GVT_install.md
Last active April 6, 2019 19:06
Installing Intel/GVT on Manjaro/Arch Linux

Edit /etc/mkinitcpio.conf as root

MODULES=(kvmgt vfio vfio-iommu-type1 vfio-mdev)
sudo mkinitcpio --allpresets

Edit /etc/default/grub as root

@ivanstepanovftw
ivanstepanovftw / vtune-amplifier-install.md
Last active March 1, 2023 12:11
Patch if Intel's shitty installer cant find libraries, but they are presents

If you cannot install Intel VTune Amplifier on Manjaro/Arch Linux (or other non-supported OS), because this shit cannot find installed libraries via ldconfig -p, you can use this script.
Unpack vtune_amplifier_2019_update3.tar.gz, then go to vtune_amplifier_2019_update3, then copy and paste following:

shopt -s globstar

for i in **/sysreq.cab; do
    echo "processing ${i}"
    perl -pi -e 's/(\W*)RESULT=255(.*)/\1RESULT=1  \2/' "${i}"  # COMPARE_VERSIONS() never returns 255
    perl -pi -e 's/(\W*)LI_(.+)=unsupp(.*)/\1LI_\2=ok    \3/' "${i}"
@ivanstepanovftw
ivanstepanovftw / autoswap.service
Last active April 8, 2020 15:57
swap daemon for Arch Linux
[Unit]
Description=autoswap
After=local-fs.target
RequiresMountsFor=/
RequiresMountsFor=/run
RequiresMountsFor=/sys
RequiresMountsFor=/var
[Service]
Type=oneshot
@ivanstepanovftw
ivanstepanovftw / x11vnc_over_hardened_ssh.md
Last active September 6, 2019 21:43
x11vnc over passwordless SSH with Google Authenticator on Arch Linux

x11vnc over passwordless SSH with Google Authenticator on Arch Linux

How auth will look after configuration:

Enter your private key password: 
User: user
< client sends his public key to server, signed by client's private key (correct me if I am wrong) >
2FA code: 123123
user's password: 
@ivanstepanovftw
ivanstepanovftw / readme.md
Created September 6, 2019 21:54
Boot Windows 10 installed on your drive with UEFI over QEMU/KVM/virt-manager virtualization on Arch Linux