Skip to content

Instantly share code, notes, and snippets.

@arq5x
arq5x / test.sh
Last active April 22, 2025 18:31
Compress and then Decompress a string with zlib.
# compile
$ g++ zlib-example.cpp -lz -o zlib-example
# run
$ ./zlib-example
Uncompressed size is: 36
Uncompressed string is: Hello Hello Hello Hello Hello Hello!
----------
@Alexey-N-Chernyshov
Alexey-N-Chernyshov / client.c
Last active June 16, 2026 08:48
Example of client/server with select().
// Simple example of client.
// Client prints received messages to stdout and sends from stdin.
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/select.h>
#include <netinet/in.h>
@aspyct
aspyct / signal.c
Last active August 10, 2026 12:58
Unix signal handling example in C, SIGINT, SIGALRM, SIGHUP...
/**
* More info?
* a.dotreppe@aspyct.org
* http://aspyct.org
*
* Hope it helps :)
*/
#include <stdio.h>
#include <stdlib.h>
@kimson
kimson / displaySdt.c
Created February 20, 2012 09:40
mpeg2-ts : display a SDT(Service Description Table)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define PID_SDT 0x0011
typedef struct ServiceDescriptorStructure {
unsigned char descriptor_tag;
unsigned char descriptor_length;
@dpiponi
dpiponi / example.cu
Created December 20, 2011 17:36
Minimal CUDA example (with helpful comments).
#include <stdio.h>
//
// Nearly minimal CUDA example.
// Compile with:
//
// nvcc -o example example.cu
//
#define N 1000