Skip to content

Instantly share code, notes, and snippets.

Avatar

Алексей Олохтонов aolo2

View GitHub Profile
View 001_ok_cow_initial.c
// compile with
// gcc -O2 001_ok_cow_initial.c -o 001_ok_cow_initial -pthread -Wall -Wextra
#include <stdint.h> // uint8_t
#include <string.h> // memcmp
#include <pthread.h> // pthread_create, pthread_join, pthread_mutex_lock, pthread_mutex_unlock
#include <stdbool.h> // bool, true, false
#define xylen 1024
View bresenham.c
static void
render_line(struct v2 from, struct v2 to, u32 *pixels, int width, int height, u32 color)
{
if (from.x >= width) {
from.x = width - 1;
}
if (to.x >= width) {
to.x = width - 1;
}
@aolo2
aolo2 / whatevs.cpp
Created Aug 12, 2021
4coder code index usability patch: function prototypes as separate note kind & full function signature in lister
View whatevs.cpp
//////////////////////////////////////
// 4coder_code_index.h
//////////////////////////////////////
/* There are new fields in these two enums/structures */
typedef i64 Code_Index_Note_Kind;
enum{
CodeIndexNote_Type,
CodeIndexNote_Function,
CodeIndexNote_Macro,
View .gdbinit
python
# GDB dashboard - Modular visual interface for GDB in Python.
#
# https://github.com/cyrus-and/gdb-dashboard
import ast
import os
import re
import struct
View whatevs.cpp
CUSTOM_UI_COMMAND_SIG(jump_to_definition_at_cursor)
CUSTOM_DOC("Jump to the first definition in the code index matching an identifier at the cursor")
{
View_ID view = get_active_view(app, Access_Visible);
if (view != 0){
Scratch_Block scratch(app);
String_Const_u8 query = push_token_or_word_under_active_cursor(app, scratch);
View bdf.c
#define BDF_MAX_LINE_LENGTH 1024
#define BDF_GLYPH_SELF_OFFSET_X 0
#define BDF_GLYPH_SELF_OFFSET_Y 1
#define BDF_GLYPH_NEXT_OFFSET_X 2
#define BDF_GLYPH_NEXT_OFFSET_Y 3
struct bdf_header {
/* FONT */
u32 version_major;
u32 version_minor;
@aolo2
aolo2 / bfs.cpp
Created Sep 27, 2020
Ужасная (но рабочая!) попытка multiGPU
View bfs.cpp
int main(int argc, char **argv)
{
try
{
double t1 = omp_get_wtime();
// считываем параметры командной сторки
int scale = 12;
int avg_degree = 15;
string graph_type = "rmat";
bool check = true;
@aolo2
aolo2 / ttf.c
Created Jul 25, 2020
read ttf font_directory
View ttf.c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
#include <arpa/inet.h>
#define READ_BE32(buf) htonl(*(u32 *)(buf->data + buf->offset)); buf->offset += 4
#define READ_BE16(buf) htons(*(u16 *)(buf->data + buf->offset)); buf->offset += 2
View tracy_example
// main.cpp
#include "tracy/Tracy.hpp"
#include <unistd.h>
int main(void) {
ZoneScoped;
sleep(1);
}
View ds_bench.c
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <stdint.h>
#include <assert.h>
#include <omp.h>
#include <emmintrin.h>