Skip to content

Instantly share code, notes, and snippets.

View qookei's full-sized avatar
🤔
hmm

Kacper Słomiński qookei

🤔
hmm
  • Poland
  • 00:48 (UTC +01:00)
View GitHub Profile
#\
i\
n\
c\
l\
u\
d\
e\
<\
s\
#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 *);
@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 <iostream>
#include <cassert>
#include <ctime>
#include <vector>
#include <termios.h>
#include <cstdio>
#include <utility>
#include <algorithm>
// helpers
#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>
@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:
@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>
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 / translate_key_name.cc
Last active December 10, 2019 15:37
Key name to SFML constant
sf::Keyboard::Key translate_key_name(const std::string &name) {
if (name == "a") return sf::Keyboard::A;
if (name == "b") return sf::Keyboard::B;
if (name == "c") return sf::Keyboard::C;
if (name == "d") return sf::Keyboard::D;
if (name == "e") return sf::Keyboard::E;
if (name == "f") return sf::Keyboard::F;
if (name == "g") return sf::Keyboard::G;
if (name == "h") return sf::Keyboard::H;
if (name == "i") return sf::Keyboard::I;
#include <stdio.h>
#include <epoxy/gl.h> // replace with proper include
void gl_debug_callback(GLenum source, GLenum type, GLuint id,
GLenum severity, GLsizei length,
const char *message, const void *) {
const char *sev = "";
switch (severity) {
case GL_DEBUG_SEVERITY_HIGH: sev = "\e[91m"; break;
case GL_DEBUG_SEVERITY_MEDIUM: sev = "\e[93m"; break;