This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% Simple web server. | |
-module(sws). | |
-author('Steve Vinoski <[email protected]>'). | |
-export([start/1, start/2]). | |
%% start/1 takes a handler function and starts the web server on port 8000. | |
%% start/2 takes a handler function and a port number. The handler function | |
%% takes two arguments: a TCP socket and request data. The request data is | |
%% a property list indicating the invoked HTTP method, the target URI, the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"github.com/miekg/dns" | |
"os" | |
) | |
var ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fcntl | |
import os | |
import struct | |
import subprocess | |
# Some constants used to ioctl the device file. I got them by a simple C | |
# program. | |
TUNSETIFF = 0x400454ca | |
TUNSETOWNER = TUNSETIFF + 2 |
NewerOlder