This is a very simple HTTP server for Unix, using fork(). It's very easy to use
- include header
httpd.h - write your route method, handling requests.
- call
serve_forever("12913")to start serving on port 12913
| /** | |
| * Writing a Mark-Sweep Garbage Collector in C++. | |
| * | |
| * This is a source code for the Lecture 9 from the | |
| * Essentials of Garbage Collectors course: | |
| * | |
| * http://dmitrysoshnikov.com/courses/essentials-of-garbage-collectors/ | |
| * | |
| * See full details in: | |
| * |
| http://homepage.ntlworld.com/edmund.grimley-evans/bcompiler.html | |
| Bootstrapping a simple compiler from nothing | |
| ============================================ | |
| This document describes how I implemented a tiny compiler for a toy | |
| programming language somewhat reminiscent of C and Forth. The funny | |
| bit is that I implemented the compiler in the language itself without |
| #!/bin/sh | |
| PIPE=/tmp/somagic-pipe | |
| OUTFILEDIR=~/dirs/Videos/ | |
| LOGDIR=~/.somagic-log/ | |
| NOW=`date +"%m_%d_%Y_%H_%M_%S"` | |
| OUTFILE=${OUTFILEDIR}fpv_video_${NOW}.mp4 | |
| mkdir $LOGDIR |
| #include "reference_counting.h" | |
| #include <stdio.h> | |
| #define NULL 0 | |
| // reference counting.... | |
| static struct m_ref { | |
| void *ptr; | |
| int count; | |
| struct m_ref *next; |
| // Converts degrees to radians. | |
| #define degreesToRadians(angleDegrees) (angleDegrees * M_PI / 180.0) | |
| // Converts radians to degrees. | |
| #define radiansToDegrees(angleRadians) (angleRadians * 180.0 / M_PI) |
| /* Read this comment first: https://gist.github.com/tonious/1377667#gistcomment-2277101 | |
| * 2017-12-05 | |
| * | |
| * -- T. | |
| */ | |
| #define _XOPEN_SOURCE 500 /* Enable certain library functions (strdup) on linux. See feature_test_macros(7) */ | |
| #include <stdlib.h> | |
| #include <stdio.h> |