Skip to content

Instantly share code, notes, and snippets.

@nir9
nir9 / editor.c
Last active April 21, 2024 01:08
Minimalist Text Editor Written in C for Linux - Just for fun, not for production use :) -- Notice: This editor will truncate files that are bigger than 1024 bytes --
#include <stdio.h>
#include <string.h>
void edit_line(char* buffer, int current_line) {
for (int i = 0; i < current_line; i++) {
buffer = strchr(buffer, '\n') + 1;
}
char* line_end = strchr(buffer, '\n');
char saved[1024] = { 0 };
@lynn
lynn / uxn_animation.py
Created October 5, 2022 19:36
Makes an animated GIF explaining the uxn sprite format
from PIL import Image, ImageDraw
sprite_data = bytes.fromhex('''
00 00 3c 06 1c 06 3c 00 00 7f c3 f9 e3 f9 c3 ff
00 00 68 2c 78 2c 34 00 00 fe ff ff ff ff ff ff
00 01 19 07 0f 1f 07 0f ff ff e7 fb fd fe ff ff
00 80 f0 e0 c0 f0 f8 f8 ff ff ff ff ff ff 7f 7f
0f 0e 0c 00 80 ff ff 7f ff ff ff ff 7f 00 00 00
e8 e0 e0 60 01 ff ff fe 7f ff ff ff fe 00 00 00
''')
@iomonad
iomonad / pipex.c
Last active September 6, 2023 16:36
Multiple pipes in C (Not complete, only for concept purpose)
/*
** pipex.c - multipipes support
*/
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
/*
* loop over commands by sharing
@AlexEzzeddine
AlexEzzeddine / deque.c
Last active November 23, 2022 17:06
Deque implementation in C
#include "deque.h"
t_deque *dequeInit(void)
{
t_deque *deque;
deque = malloc(sizeof(t_deque));
deque->first = NULL;
deque->last = NULL;
return deque;