Skip to content

Instantly share code, notes, and snippets.

View SPGC's full-sized avatar
🎯
Focusing

Ilia Nechaev SPGC

🎯
Focusing
View GitHub Profile
@SPGC
SPGC / minimal_tcp_client.c
Created September 9, 2025 13:14
Minimal tcp client
#include <signal.h>
#include <stdio.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>
volatile int running = 1;
void serve_sigint(int sig)
@SPGC
SPGC / minimal_tcp_server.c
Created September 9, 2025 13:11
Minimal TCP server
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>
#include <sys/wait.h>
volatile int running = 1;
@SPGC
SPGC / select.c
Created August 7, 2025 10:11
Linux select syscall example
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/select.h>
#include <sys/wait.h>
#define MAX(a, b) ((a) > (b) ? (a) : (b))
@SPGC
SPGC / epoll.c
Created August 7, 2025 10:06
Linux epoll syscall example
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/epoll.h>
#include <sys/wait.h>
void print_to_pipe(const int fd, const int process_id, const int sleep_time)
{