Skip to content

Instantly share code, notes, and snippets.

View aolo2's full-sized avatar

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

View GitHub Profile
#ifndef VECTOR_C
#define VECTOR_C
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <assert.h>
import argparse
import sys
from enum import Enum
class Case(Enum):
SAME = 0
DIFFRENT = 1
GAP = 2,
import numpy as np
import scipy.linalg as sp
N = 6
A = np.zeros((N, N))
ERR = 1e-6
A[0] = [ 2, 1, 0, 0, 0, 0 ]
A[1] = [ 0, 2, 1, 0, 0, 0 ]
@aolo2
aolo2 / inspector.css
Last active May 10, 2019 13:10
readable internet
body {
background: #eee;
padding: 5em;
font-family: Roboto;
line-height: 1.6;
}
pre {
background: white;
padding: .5em;
@aolo2
aolo2 / t.c
Last active May 20, 2019 12:14
SDL2 pixmap fast drawing skeleton
#include "common.h"
#include <SDL.h>
static const u32 WINDOW_WIDTH = 800;
static const u32 WINDOW_HEIGHT = 600;
static const u32 TARGET_FRAMERATE = 60;
static const f32 TARGET_FRAMETIME = 1000.0f / (f32) TARGET_FRAMERATE;
// [INFO] Average time ~ 16.1 msec (10k triangles)
#include "../../common.h"
#if VIS
#include <GL/glew.h>
#include <GLFW/glfw3.h>
struct GL {
GLuint VAO;
static s32
orient_2d(s32 ax, s32 ay, s32 bx, s32 by, s32 x, s32 y)
{
return(bx - ax) * (y - ay) - (by - ay) * (x - ax);
}
static void
fill_triangle(struct framebuffer *fb,
s32 v0x, s32 v0y, s32 v1x, s32 v1y, s32 v2x, s32 v2y)
{
static void
m3_unity(f32 result[static 9])
{
memset(result, 0x00, 9 * sizeof(f32));
result[0] = result[4] = result[8] = 1.0f;
}
static void
m3_mul(f32 result[static 9], f32 A[static 9], f32 B[static 9])
# Git branch in prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1) /'
}
export PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;33m\]\$(parse_git_branch)\[\033[00m\]$ "
#define GLFW_INCLUDE_VULKAN
#define NUM_SAMPLES VK_SAMPLE_COUNT_1_BIT
#define NUM_DESCRIPTOR_SETS 1
#define NUM_SHADER_STAGES 2
#define NUM_VERT_ATTRIBUTES 2
#define NUM_VIEWPORTS 1
#define NUM_SCISSORS NUM_VIEWPORTS
#define FENCE_TIMEOUT 100000000
#include "common.h"