Skip to content

Instantly share code, notes, and snippets.

View qookei's full-sized avatar
🤔
hmm

Kacper Słomiński qookei

🤔
hmm
  • Poland
  • 12:30 (UTC +02:00)
View GitHub Profile
template <typename Cont>
struct enumeration {
enumeration(Cont &c)
:_c{c}, _begin{c.begin(), 0}, _end{c.end(), c.size()}
{}
private:
struct enumeration_iterator {
typename Cont::iterator it;
typename Cont::size_type n;
@qookei
qookei / async.hpp
Last active December 5, 2019 22:58
#pragma once
#include <queue>
#include <utility>
#include <tuple>
#include <algorithm>
#include <type_traits>
namespace async {
template <typename AwaitFn, typename... AwaitArgs>
@qookei
qookei / elf_ldr.asm
Last active November 15, 2019 17:00
Bootsector ELF loader
; to use, compile your elf binary to run, and update BINARY_SIZE accordingly,
; then compile this file with `nasm -fbin elf_ldr.asm -o elf_ldr.bin`
; and concatenate the elf_ldr.bin and your elf file with `cat elf_ldr.bin <your.elf> >image`
bits 16
org 0x7C00
BINARY_SIZE equ 20 ; in sectors
entry:
#include <iostream>
#include <fstream>
#include <vector>
#include <sstream>
#include <iterator>
constexpr const char *text_color_reset = "\e[0m";
constexpr const char *text_color_red = "\e[31m";
template<typename T>
#include <iostream>
#include <cassert>
#include <ctime>
#include <vector>
#include <termios.h>
#include <cstdio>
#include <utility>
#include <algorithm>
// helpers
@qookei
qookei / meme.asm
Last active August 12, 2019 11:24
bits 16
org 0x7C00
font_seg equ 0x1000 ; font at 0x1000:0x0000
jmp 0x0:.start
.start:
cli
cld
xor ax,ax
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/fs.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("qookie");
static int device_open(struct inode *, struct file *);
#\
i\
n\
c\
l\
u\
d\
e\
<\
s\