Skip to content

Instantly share code, notes, and snippets.

@thentenaar
thentenaar / dn3dwt-eduke32.patch
Last active October 14, 2016 20:47
eDuke32 Patch for Duke Nukem 3D: World Tour
View dn3dwt-eduke32.patch
This patches the config files shipped with Duke Nukem World Tour so that
the levels should be playable with eduke32. There don't seem to be any
ogg sound effects for Duke's breathing, or the turret sounds, so I've
restored the original filename from Atomic Edition.
I've corrected the pathnames to use '/' as a separator, and altered the
case so that the filenames coincide with the actual filenames in the
sound directory.
I've removed the stuff specific to the 'playback' functionality as
@thentenaar
thentenaar / sunos-551-paging-bug-fix.c
Created July 24, 2015 18:30
Patch for the paging bug on Solaris 2.5.1 (SunOS 5.5.1) i386
View sunos-551-paging-bug-fix.c
/**
* Patch to fix the paging bug in the SunOS 5.5.1 (i386) kernel
* Copyright (C) 2015 Tim Hentenaar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
@thentenaar
thentenaar / echo-server-6.c
Created January 27, 2015 00:59
Simple echo server: Refactor #6: Move the work loop back out into its own function.
View echo-server-6.c
/**
* Simple echo server
*
* This program listens for connections on the
* loopback interface, on port 9999. Upon connecting,
* The first line we read, of up to BUF_LEN bytes, is
* then sent back to the sender, and the connection
* is closed.
*/
#include <stdio.h>
@thentenaar
thentenaar / echo-server-5.c
Created January 27, 2015 00:49
Simple echo server: Refactor #5: Reduce the depth of nesting in main().
View echo-server-5.c
/**
* Simple echo server
*
* This program listens for connections on the
* loopback interface, on port 9999. Upon connecting,
* The first line we read, of up to BUF_LEN bytes, is
* then sent back to the sender, and the connection
* is closed.
*/
#include <stdio.h>
@thentenaar
thentenaar / echo-server-4.c
Created January 27, 2015 00:23
Simple echo server: Refactor #4: Replace duplicate returns with goto
View echo-server-4.c
/**
* Simple echo server
*
* This program listens for connections on the
* loopback interface, on port 9999. Upon connecting,
* The first line we read, of up to BUF_LEN bytes, is
* then sent back to the sender, and the connection
* is closed.
*/
#include <stdio.h>
@thentenaar
thentenaar / echo-server-3.c
Created January 26, 2015 23:29
Simple echo server: Refactor #3: Change the work loop's while into a do { } while(), and make it smaller
View echo-server-3.c
/**
* Simple echo server
*
* This program listens for connections on the
* loopback interface, on port 9999. Upon connecting,
* The first line we read, of up to BUF_LEN bytes, is
* then sent back to the sender, and the connection
* is closed.
*/
#include <stdio.h>
@thentenaar
thentenaar / echo-server-2.c
Created January 26, 2015 22:04
Simple echo server: Refactor #2: Move the work loop into its own function.
View echo-server-2.c
/**
* Simple echo server
*
* This program listens for connections on the
* loopback interface, on port 9999. Upon connecting,
* The first line we read, of up to BUF_LEN bytes, is
* then sent back to the sender, and the connection
* is closed.
*/
#include <stdio.h>
@thentenaar
thentenaar / echo-server-1.c
Created January 26, 2015 20:59
Simple echo server: Refactor #1: Move the socket setup code into its own function.
View echo-server-1.c
/**
* Simple echo server
*
* This program listens for connections on the
* loopback interface, on port 9999. Upon connecting,
* The first line we read, of up to BUF_LEN bytes, is
* then sent back to the sender, and the connection
* is closed.
*
* Refactor #1 - Move socket creation code into its own
@thentenaar
thentenaar / echo-server.c
Created January 26, 2015 20:55
A very simple, and quickly implemented, echo server
View echo-server.c
/**
* Simple echo server
*
* This program listens for connections on the
* loopback interface, on port 9999. Upon connecting,
* The first line we read, of up to BUF_LEN bytes, is
* then sent back to the sender, and the connection
* is closed.
*/
#include <stdio.h>
@thentenaar
thentenaar / add_to_calcurse.sh
Last active April 8, 2020 20:14
A simple script for importing text/calendar files into calcurse
View add_to_calcurse.sh
#!/bin/bash
#
# Import text/calendar files from mutt
# to calcurse.
#
# Make sure calcurse is running
if [ ! -f "$HOME/.calcurse/.calcurse.pid" ]; then
exit 1
fi