This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Harrison Turton 2018 | |
# -------------------------------------- | |
# This script will automatically detect your | |
# operating system, and build accordingly. | |
# | |
# A build mode flag can be included, wherein | |
# the script will supply the relevant build | |
# mode flags to gnatmake. Defaults to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"errors" | |
"github.com/streadway/amqp" | |
"log" | |
"os" | |
"time" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(generic_associated_types)] | |
use anyhow::Error; | |
use async_trait::async_trait; | |
use tokio_postgres::{row::Row, types::ToSql}; | |
/// This is an example of how to abstract Rust database libraries (e.g. tokio-postgres) | |
/// behind a trait. This is useful to swap out a concrete implementation with a fake, | |
/// or for changing the underlying database implementation (e.g. switching to sqlx) | |
/// without needing to update the consumers of this module. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use nix::errno::Errno; | |
use nix::fcntl::{open, OFlag}; | |
use nix::ioctl_write_int; | |
use nix::libc::{__c_anonymous_ifr_ifru, c_char, c_short, ifreq, IFNAMSIZ}; | |
use nix::sys::stat::Mode; | |
use nix::unistd::close; | |
use std::ffi::{CString, NulError}; | |
use std::os::fd::RawFd; | |
use std::ptr::copy_nonoverlapping; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This follows the LWN tutorial "Using the KVM API": | |
* | |
* https://lwn.net/Articles/658511/ | |
* | |
* Which runs a virtual machine that executes the following | |
* 16-bit x86 code (the assembled binary is hardcoded in): | |
* | |
* mov $0x3f8, %dx | |
* add %bl, %al |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Author: Harrison Turton <[email protected]> | |
* | |
* This follows the LWN article "Creating Linux virtual filesystems": | |
* | |
* https://lwn.net/Articles/57369/ | |
* | |
* However, this was published in 2003. The VFS has changed quite a | |
* bit since then, and so the code had to be tweaked to work. So | |
* isn't a byte-for-byte copy, I had to go digging through the kernel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COPTS=-std=c++17 -Wall | |
INCLUDE=-I/usr/local/include/jxl/ -L/usr/local/lib/ | |
LIBS=-ljxl -ljxl_threads | |
BIN=main | |
$(BIN): main.cc | |
clang++ $(COPTS) $(INCLUDE) $(LIBS) -o $@ $< | |
.PHONY: clean | |
clean: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <errno.h> | |
#include <fcntl.h> | |
#include <linux/io_uring.h> | |
#include <signal.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/mman.h> | |
#include <sys/syscall.h> |