Skip to content

Instantly share code, notes, and snippets.

View piotrwyrw's full-sized avatar

Piotr K. Wyrwas piotrwyrw

  • Austria
View GitHub Profile
@piotrwyrw
piotrwyrw / server.c
Created September 19, 2023 16:58
A (very) simple HTTP server written in C
#include <sys/socket.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <netinet/in.h>
#include <stdbool.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/ioctl.h>
@piotrwyrw
piotrwyrw / docker-compose.yml
Created September 18, 2023 06:35
Docker compose for PostgreSQL
services:
nitrogen-postgres-server:
image: postgres
container_name: postgres-nitrogen
restart: always
environment:
- POSTGRES_USER=nitrogen-postgres
- POSTGRES_PASSWORD=root
- POSTGRES_DB=dbi-postgres
ports:
@piotrwyrw
piotrwyrw / file_format.c
Created August 22, 2023 17:01
A simple, home-made image file format
#include <stdio.h>
#include <stdlib.h>
struct pixel {
double r;
double g;
double b;
};
struct iff {
@piotrwyrw
piotrwyrw / SerializationUtils.java
Created January 10, 2023 17:13
A relatively simple utility class for storing and loading java objects in text format.
import java.lang.invoke.MethodType;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class SerializationUtils {
public static String serializeField(Object obj, Field f) {
Object o;
try {