Skip to content

Instantly share code, notes, and snippets.

name = "solarized-dark";
Back = 0xFF002b36;
Margin = 0xFF073642;
Margin_Hover = 0xFF002b36;
Margin_Active = 0xFF002b36;
List_Item = Margin;
List_Item_Hover = 0xFF6c71c4;
List_Item_Active = 0xFFd33682;
Cursor = 0xFF93a1a1;
@croepha
croepha / misc.h
Last active March 15, 2018 17:42
template<class T> void inline system_alloc(T*&ptr, size_t count) {
ptr = (T*)realloc(ptr, count * sizeof(T));
assert(ptr || count == 0);
}
struct DefaultCtrNoCopy { // Thanks mmozeiko!
DefaultCtrNoCopy() = default;
DefaultCtrNoCopy(DefaultCtrNoCopy const&) = delete;
DefaultCtrNoCopy& operator=(DefaultCtrNoCopy const&) = delete;
};
@croepha
croepha / v1.cpp
Created March 16, 2018 02:10
cpp_template_stretchy_buffers
template<typename T> struct buf_Meta {
size_t len;
size_t cap;
T buf[0];
};
template <typename T> inline buf_Meta<T>& buf__meta(T*b) {
return *(buf_Meta<T>*)((size_t)(b) - __builtin_offsetof(buf_Meta<T>, buf));
}
#include <stdio.h>
#include "stb/stretchy_buffer.h"
struct StringStretchyBuffers {
char *string_space;
size_t*strings ;
};
void push_string(struct StringStretchyBuffers*ssb, char*str) {
bool thread2_is_waiting_for_sync = false;
auto mutex = PTHREAD_MUTEX_INITIALIZER;
auto cond_m = PTHREAD_MUTEX_INITIALIZER;
auto cond = PTHREAD_COND_INITIALIZER ;
void* thread1(void*) {
int main() {
SBDebugger::Initialize();
SBDebugger debugger(SBDebugger::Create());
assert(debugger.IsValid());
debugger.SetAsync(false);
SBStream out_stream;
using System;
using System.ServiceProcess;
using System.Net.Sockets;
using System.Net;
using System.Text;
public partial class MyService : ServiceBase
{
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <assert.h>
@croepha
croepha / merge_dir.cpp
Created August 24, 2018 23:13
filesystem filtering tools
// cro_build:release,noasan,raw, -static-libstdc++
#define _XOPEN_SOURCE 700
#define _POSIX_C_SOURCE 200809L
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/ioctl.h>