Skip to content

Instantly share code, notes, and snippets.

@nathanjackson
nathanjackson / fpe.c
Created April 25, 2022 16:04
floating point exception example
#define _GNU_SOURCE
#include <stdio.h>
#include <fenv.h>
int main()
{
feenableexcept(FE_DIVBYZERO);
double x = 12.34;
@nathanjackson
nathanjackson / istreambuf_ex.cpp
Created April 27, 2022 05:18
read file using istreambuf
#include <fstream>
#include <iterator>
#include <vector>
int main(int argc, char** argv)
{
std::ifstream ifs(argv[1], std::ios::binary);
std::istreambuf_iterator<char> begin(ifs), end;
std::vector<uint8_t> data(begin, end);
@nathanjackson
nathanjackson / boot.sh
Created September 20, 2022 13:23
Fedora 36 ARM in QEMU
#!/bin/bash
qemu-system-arm \
-M virt \
-m 3G \
-device virtio-gpu-pci \
-drive if=none,file=os.qcow2,id=hd0 \
-device virtio-blk-device,drive=hd0 \
-device virtio-net-device \
-kernel vmlinuz-5.17.5-300.fc36.armv7hl \