Skip to content

Instantly share code, notes, and snippets.

View rexim's full-sized avatar
📺
https://twitch.tv/tsoding

Alexey Kutepov rexim

📺
https://twitch.tv/tsoding
View GitHub Profile
#include <stdio.h>
#define ROWS 10
#define COLS 10
typedef enum {
DEAD = 0,
ALIVE = 1,
} Cell;
use std::ffi::{c_void, CStr, CString};
use std::os::raw::c_char;
const SDL_INIT_VIDEO: u32 = 0x00000020;
const SDL_WINDOW_RESIZABLE: u32 = 0x00000020;
const SDL_RENDERER_ACCELERATED: u32 = 0x00000002;
const SDL_QUIT: u32 = 0x100;
@rexim
rexim / if-label-paradox.md
Last active March 10, 2021 12:09
Quick Gist of the paradox we are trying to prevent in our assembly

The "If-Label" Paradox

In our assembly we are implementing the support for conditional translation:

%include "natives.hasm"
%const N 10
main:
    push 1
 push 2
@rexim
rexim / main.c
Created February 2, 2021 11:09
Stretching Buffer in C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
size_t size;
size_t capacity;
char *data;
} Buffer;
@rexim
rexim / main.c
Created January 30, 2021 14:16
Piping two commands together on POSIX
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <unistd.h>
@rexim
rexim / gol.adb
Last active January 24, 2021 09:32
Game of Life in Ada
-- $ gnatmake gol.adb
-- $ ./gol
with Ada.Text_IO;
procedure Gol is
use Ada.Text_IO;
Width : constant Integer := 10;
Height : constant Integer := 10;
@rexim
rexim / main.d
Created October 9, 2020 11:58
Game of Life in D
import std.stdio;
import std.traits;
import core.thread.osthread;
import core.time;
enum Cell {
Dead = 0,
Alive
}
module Main where
import Data.Maybe
import Data.List
-- Solution for https://www.geeksforgeeks.org/averages-levels-binary-tree/
data Tree a
= Node a (Tree a) (Tree a)
| Leaf
@rexim
rexim / Friday.org
Last active September 25, 2020 05:27

Friday Queue

Use !friday command to put a video here (only for trusted and subs). Any video can be skipped if the streamer finds it boring.

tsoding

Video Count: 2

DateSubmitterVideoThumbnail
@rexim
rexim / Main.hs
Created September 24, 2020 13:07
Somebody's Homework that I did for free
module Main where
-- https://i.imgur.com/mA5EEWI.png
import Control.Exception
import Data.List
import Data.Maybe
import Data.Foldable
data Tree a