Skip to content

Instantly share code, notes, and snippets.

@oktal
oktal / rolling_ofstream.h
Last active February 23, 2021 08:44
A basic_ofstream will rolling capabilities
#pragma once
#include <chrono>
#include <filesystem>
#include <fstream>
#include <memory>
#include <optional>
@oktal
oktal / logpp.cc
Last active July 29, 2020 19:38
Low Latency Logging
#include <algorithm>
#include <array>
#include <atomic>
#include <condition_variable>
#include <cstring>
#include <deque>
#include <functional>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <unistd.h>
#include <time.h>
#include <errno.h>
#include <fcntl.h>
# coding=utf-8
import discord
import logging
import aiohttp
CO2_API = 'http://www.hqcasanova.com/co2/'
IPCC_REPORTS = {
'ar5': {
'wg1': {
@oktal
oktal / nanomsg_multipart.cc
Last active August 29, 2015 14:15
Multipart messaging protocol with nanomsg
#include <nanomsg/nn.h>
#include <nanomsg/reqrep.h>
#include <string>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <vector>
#include <memory>
#include <limits>
@oktal
oktal / limbes.cc
Last active August 29, 2015 14:15
Devils never cry
#include <iostream>
#include <vector>
#include <stdexcept>
#include <cassert>
#include <limits>
#include <algorithm>
class Cell {
public:
friend class Angel;
@oktal
oktal / list.c
Created June 16, 2014 20:46
Linked list implementation in C
#include "list.h"
#include <stdlib.h>
static bool list_empty(struct list *this)
{
return this == NULL ? TRUE :
this->m_size == 0 ? TRUE : FALSE;
}
@oktal
oktal / optional.h
Last active August 29, 2015 14:00
Option type in C++11
#ifndef OPTION_H
#define OPTION_H
#include <cstdlib>
#include <cstring>
#include <utility>
#include <iostream>
#include <tuple>
#include <functional>
@oktal
oktal / string.c
Last active December 23, 2015 15:39
String manipulation in C
#include "string.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h> /* DEBUG */
static string_err string_enlarge(String *this, size_t add)
{
string_err err = STRING_ERR_OK;