Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <cstdlib>
#include <cxxabi.h>
#include <backtrace.h>
static void error_callback(void* data, const char* message, int error_number) {
if (error_number == -1) {
fprintf(stderr, "If you want backtraces, you have to compile with -g\n\n");
@xTachyon
xTachyon / fast_varint_write.rs
Last active January 13, 2024 04:59
fast_varint_write.rs
use std::io::Result;
use std::io::Write;
use std::time::Instant;
fn write_varint<W: Write>(mut writer: W, mut value: u32) -> Result<u32> {
let mut count = 0;
loop {
let mut temp = (value & 0b01111111) as u8;
value >>= 7;
if value != 0 {
@xTachyon
xTachyon / coroutines.c
Last active November 24, 2020 09:45
c coroutines with stack change
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
#include <stdint.h>
#pragma warning(disable : 4731)
enum { false, true };
typedef _Bool bool;
#include <cstring>
#include "MyString.hpp"
MyString::MyString() {
Sir = nullptr;
Size = 0;
Capacity = 0;
Reserve(16);
}
using System;
using System.IO;
namespace fsc
{
class Program
{
const int sectorSize = 4096;
static int getEmptySectors(string path)