text:
Calculate the block entropy
I once needed to write a function that calculates the block entropy of a given symbol series for a given block size and was surprised how short the result was. Thus I am challenging you to codegolf such a function. I am not telling you what I did for now (and in which language), but I will in a week or so, if nobody came up with the same or better ideas first.
Definition of the block entropy:
Given a symbol sequence A = A_1, …, A_n and a block size m:

A block of size m is a segment of m consecutive elements of the symbol sequence, i.e., A_i, …, A_(i+m−1) for any appropriate i.
If x is a symbol sequence of size m, N(x) denotes the number of blocks of A which are identical to x.
p(x) is the probability that a block from A is identical to a symbol sequence x of size m, i.e., p(x) = N(x)/(n−m+1)
Finally, the block entropy for block size m of A is the average of −log(p(x)) over all blocks x of size m in A or (which is equivalent) the sum of −p(x)·log(p(x)) over every x of size m occurring in A. (You can choose any reasonable logarithm you want.)

Restricions and clarifications:

Your function should take the symbol sequence A as well as the block size m as an argument.
You may assume that the symbols are represented as zero-based integers or in another convenient format.
Your program should be capable of taking any reasonable argument in theory and in reality should be able to calculate the example case (see below) on a standard computer.
Built-in functions and libraries are allowed, as long as they do not perform big portions of the procedure in one call, i.e., extracting all blocks of size m from A, counting the number of occurrences of a given block x or calculating the entropies from a sequence of p values – you have to do those things yourself.

Test:
[2, 3, 4, 1, 2, 3, 0, 0, 3, 2, 3, 0, 2, 2, 4, 4, 4, 1, 1, 1, 0, 4, 1,
2, 2, 4, 0, 1, 2, 3, 0, 2, 3, 2, 3, 2, 0, 1, 3, 4, 4, 0, 2, 1, 4, 3,
0, 2, 4, 1, 0, 4, 0, 0, 2, 2, 0, 2, 3, 0, 0, 4, 4, 2, 3, 1, 3, 1, 1,
3, 1, 3, 1, 0, 0, 2, 2, 4, 0, 3, 2, 2, 3, 0, 3, 3, 0, 0, 4, 4, 1, 0,
2, 3, 0, 0, 1, 4, 4, 3]

The first block entropies of this sequence are (for the natural logarithm):

m = 1: 1.599
m = 2: 3.065
m = 3: 4.067
m = 4: 4.412
m = 5: 4.535
m = 6: 4.554

@m.buettner: If you consider your solution borderline regarding my rules, you could still give it a try – I really only want to avoid solutions along the lines of entropy(probabilities(blocks(A,m))).

Isn't it customary to use log base 2 for this?

The values for the entropy at the end are positive, but the logarithm of a probability is negative or zero. Therefore a negative sign is missing in the formula for the entropy.

@JonathanVanMatre: As far as I know, it depends on the discipline which is the most-used pased of the logarithm. Anyway, it should not matter that much for the challenge and thus you can use whatever base reasonable you want.

@HeikoOberdiek: Thanks, I forgot that.

I've voted to close this as unclear, as you cannot objectively define "perform big portions of the procedure in one call"

Mathematica - 81 78 75 72 67 65 62 56 bytes
I haven't golfed anything in Mathematica before, so I suppose there's room for improvement. This one doesn't quite conform to the rules due to the Partition and Tally functions, but it's quite neat so I thought I'd post it anyway.
f=N@Tr[-Log[p=#2/Length@b&@@@Tally[b=##~Partition~1]]p]&

This works with any set of symbols, and can be used like
sequence = {2, 3, 4, 1, 2, 3, 0, 0, 3, 2, 3, 0, 2, 2, 4, 4, 4, 1, 1,
   1, 0, 4, 1, 2, 2, 4, 0, 1, 2, 3, 0, 2, 3, 2, 3, 2, 0, 1, 3, 4, 4,
   0, 2, 1, 4, 3, 0, 2, 4, 1, 0, 4, 0, 0, 2, 2, 0, 2, 3, 0, 0, 4, 4,
   2, 3, 1, 3, 1, 1, 3, 1, 3, 1, 0, 0, 2, 2, 4, 0, 3, 2, 2, 3, 0, 3,
   3, 0, 0, 4, 4, 1, 0, 2, 3, 0, 0, 1, 4, 4, 3};
f[sequence, 3]

> 4.06663

Here is a somewhat ungolfed version:
f[sequence_, m_] := (
    blocks = Partition[sequence, m, 1];
    probabilities = Apply[#2/Length[blocks] &, Tally[blocks], {1}];
    N[Tr[-Log[probabilities]*probabilities]]
)

It will probably run faster if I apply N directly to the result of Tally.
By the way, Mathematica does actually have an Entropy function, that reduces this to 28 bytes, but that's definitely against the rules.
f=N@Entropy@Partition[##,1]&

On the other hand, here is a 128 byte version that reimplements Partition and Tally:
f=N@Tr[-Log[p=#2/n&@@@({#[[i;;i+#2-1]],1}~Table~{i,1,(n=Length@#-#2+1)}//.{p___,{s_,x_},q___,{s_,y_},r___}:>{p,{s,x+y},q,r})]p]&

Ungolfed:
f[sequence_, m_] := (
    n = Length[sequence]-m+1; (*number of blocks*)
    blocks = Table[{Take[sequence, {i, i+m-1}], 1},
                   {i, 1, n}];
    blocks = b //. {p___, {s_, x_}, q___, {s_, y_}, r___} :> {p,{s,x+y},q,r};
    probabilities = Apply[#2/n &, blocks, {1}];
    N[Tr[-Log[probabilities]*probabilities]]
)

Partition and Tally are not borderline cases, they are breaking the rules outright, as they are  “extracting all blocks of size m from A” and “counting the number of occurrences of a given block x”, respectively, in one call. Still, after all I know about Mathematica, I would not be surprised, if there were a decent solution without them.

@Wrzlprmft I've added a not-so-golfed version where I reimplement Partition and Tally.

Perl, 140 bytes
The following Perl script defines a function E that takes the symbol sequence, followed by segment size as arguments.
sub E{$m=pop;$E=0;%h=();$"=',';$_=",@_,";for$i(0..@_-$m){next
if$h{$s=",@_[$i..$i+$m-1],"}++;$E-=($p=s|(?=$s)||g/(@_-$m+1))*log$p;}return$E}

Ungolfed version with test
sub E { # E for "entropy"
    # E takes the sequence and segment size as arguments
    # and returns the calculated entropy.
    $m = pop;    # get segment size (last argument)
    $E = 0;      # initialize entropy
    %h = ();     # hash that remembers already calculated segments
    $" = ',';#"  # comma is used as separator
    $_ = ",@_,"; # $_ takes sequence as string, with comma as delimiters
    for $i (0 .. @_-$m) {
        $s = ",@_[$i..$i+$m-1],"; # segment
        next if$h{$s}++;          # check, if this segment is already calculated
        $p = s|(?=\Q$s\E)||g / (@_ - $m + 1); # calculate probability
             # N(x) is calculated using the substitution operator
             # with a zero-width look-ahead pattern
             # (golfed version without "\Q...\E", see below)
        $E -= $p * log($p); # update entropy
    }
    return $E
}

# Test

my @A = (
    2, 3, 4, 1, 2, 3, 0, 0, 3, 2, 3, 0, 2, 2, 4, 4, 4, 1, 1, 1, 0, 4, 1,
    2, 2, 4, 0, 1, 2, 3, 0, 2, 3, 2, 3, 2, 0, 1, 3, 4, 4, 0, 2, 1, 4, 3,
    0, 2, 4, 1, 0, 4, 0, 0, 2, 2, 0, 2, 3, 0, 0, 4, 4, 2, 3, 1, 3, 1, 1,
    3, 1, 3, 1, 0, 0, 2, 2, 4, 0, 3, 2, 2, 3, 0, 3, 3, 0, 0, 4, 4, 1, 0,
    2, 3, 0, 0, 1, 4, 4, 3
);

print "m = $_: ", E(@A, $_), "\n" for 1 .. @A;

Result:
m = 1: 1.59938036027528
m = 2: 3.06545141203611
m = 3: 4.06663334311518
m = 4: 4.41210802885304
m = 5: 4.53546705894451
m = 6: 4.55387689160055
m = 7: 4.54329478227001
m = 8: 4.53259949315326
m = 9: 4.52178857704904
...
m = 97: 1.38629436111989
m = 98: 1.09861228866811
m = 99: 0.693147180559945
m = 100: 0

Symbols:
The symbols are not restricted to integers, because pattern matching based on strings is used. The string representation of a symbol must not contain the comma, because it is uses as delimiter. Of course, different symbols must have different string representations.
In the golfed version, the string representation of the symbols should not contain specials characters of patterns. The additional four bytes \Q...\E
are not needed for numbers.

Can be about 1/4 shorter: sub f{($s,$m,$r,%h)=@_;$h{x,@$s[$_..$_+$m-1]}++for 0..@$s-$m;$r-=($_/=@$s-$m+1)*log for values %h;return$r}; where $s is a reference, $r and %h are reset to undef with 1st assignment, lists are hash keys (with little help of $;, and some x - unfortunately), and a bit less complicated in general, I think.

@VadimR: Clever! Because of the substantial changes I suggest, you make an answer. The space in values %h is not needed, thus your solution only needs 106 bytes.

Python 127 152B 138B
import math
def E(A,m):N=len(A)-m+1;R=range(N);return sum(math.log(float(N)/b) for b in [sum(A[i:i+m]==A[j:j+m] for i in R) for j in R])/N

Adjusted to not break the rules any more and have a slightly cuter algorithm.
Adjusted to be smaller
Older version:
import math
def E(A,m):
 N=len(A)-m+1
 B=[A[i:i+m] for i in range(N)]
 return sum([math.log(float(N)/B.count(b)) for b in B])/N

My first ever Python script! See it in action: http://pythonfiddle.com/entropy

Nice so far, but unfortunately, the use of the count function is outright against the rules, since it is “counting the number of occurrences of a given block x”.

Also, some golfing tips: You can save some characters by cramming every line except the first into one (separated by ; if necessary). Also the square brackets in the last line are not needed.

Nice answer. Again, some golfing tips: The whole conversion from boolean to integer (i.e., and 1 or 0) is unnecessary. Also, you can save some characters by predefining range(N).

Python with Numpy, 146 143 Bytes
As promised, here is my own solution. It requires an input of non-negative integers:
from numpy import*
def e(A,m):
    B=zeros(m*[max(A)+1]);j=0
    while~len(A)<-j-m:B[tuple(A[j:j+m])]+=1;j+=1
    return -sum(x*log(x)for x in B[B>0]/j)

The disadvantage is that this bursts your memory for a large m or max(A).
Here is the mostly ungolfed and commented version:
from numpy import *
def e(A,m):
    B = zeros(m*[max(A)+1])          # Generate (max(A)+1)^m-Array of zeroes for counting.
    for j in range(len(A)-m+1):
        B[tuple(A[j:j+m])] += 1      # Do the counting by directly using the array slice
                                     # for indexing.
    C = B[B>0]/(len(A)-m+1)          # Flatten array, take only non-zero entries,
                                     # divide for probability.
    return -sum(x*log(x) for x in C) # Calculate entropy

MATLAB
function E =BlockEntropy01(Series,Window,Base )

%-----------------------------------------------------------
% Calculates BLOCK ENTROPY of Series
% Series: a Vector of numbers
% Base: 2 or 10 (affects logarithm of the Calculation)
% for 2 we use log2, for 10 log10
% Windows: Length of the "Sliding" BLOCK
% E: Entropy
%-----------------------------------------------------------
% For the ENTROPY Calculations
% http://matlabdatamining.blogspot.gr/2006/....
% 11/introduction-to-entropy.html
% BlogSpot: Will Dwinnell
%-----------------------------------------------------------
% For the BLOCK ENTROPY
% http://codegolf.stackexchange.com/...
% questions/24316/calculate-the-block-entropy
%-----------------------------------------------------------
% Test (Base=10)
% Series=[2, 3, 4, 1, 2, 3, 0, 0, 3, 2, 3, 0, ....
%     2, 2, 4, 4, 4, 1, 1, 1, 0, 4, 1,2, 2, 4, 0, ....
%     1, 2, 3, 0, 2, 3, 2, 3, 2, 0, 1, 3, 4, 4, 0, ....
%     2, 1, 4, 3,0, 2, 4, 1, 0, 4, 0, 0, 2, 2, 0, ....
%     2, 3, 0, 0, 4, 4, 2, 3, 1, 3, 1, 1,3, 1, 3, 1, ....
%     0, 0, 2, 2, 4, 0, 3, 2, 2, 3, 0, 3, 3, 0, 0, 4, ...
%     4, 1, 0,2, 3, 0, 0, 1, 4, 4, 3]';
%
% Results
%
% Window=1: 1.599
% Window=2: 3.065
% Window=3: 4.067
% Window=4: 4.412
% Window=5: 4.535
% Window=6: 4.554
%-----------------------------------------------------------
n=length(Series);
D=zeros(n,Window); % Pre Allocate Memory
for k=1:Window;    D(:,k)=circshift(Series,1-k);end
D=D(1:end-Window+1,:); % Truncate Last Part
%
% Repace each Row with a "SYMBOL"
% in this Case a Number ...............
[K l]=size(D);
for k=1:K; MyData(k)=polyval(D(k,:),Base);end
clear D
%-----------------------------------------------------------
% ENTROPY CALCULATIONS on MyData
% following  Will Dwinnell
%-----------------------------------------------------------
UniqueMyData = unique(MyData);
nUniqueMyData = length(UniqueMyData);
FreqMyData = zeros(nUniqueMyData,1); % Initialization
for i = 1:nUniqueMyData
    FreqMyData(i) = ....
        sum(double(MyData == UniqueMyData(i)));
end
% Calculate sample class probabilities
P = FreqMyData / sum(FreqMyData);
% Calculate entropy in bits
% Note: floating point underflow is never an issue since we are
%   dealing only with the observed alphabet
if Base==10
    E= -sum(P .* log(P));
elseif BASE==2
    E= -sum(P .* log2(P));
else
end
end

WITH TEST SCRIPT
%-----------------------------------------------------------
Series=[2, 3, 4, 1, 2, 3, 0, 0, 3, 2, 3, 0, ....
    2, 2, 4, 4, 4, 1, 1, 1, 0, 4, 1,2, 2, 4, 0, ....
    1, 2, 3, 0, 2, 3, 2, 3, 2, 0, 1, 3, 4, 4, 0, ....
    2, 1, 4, 3,0, 2, 4, 1, 0, 4, 0, 0, 2, 2, 0, ....
    2, 3, 0, 0, 4, 4, 2, 3, 1, 3, 1, 1,3, 1, 3, 1, ....
    0, 0, 2, 2, 4, 0, 3, 2, 2, 3, 0, 3, 3, 0, 0, 4, ...
    4, 1, 0,2, 3, 0, 0, 1, 4, 4, 3]';
Base=10;
%-----------------------------------------------------------
for Window=1:6
    E =BlockEntropy01(Series,Window,Base )
end

Welcome to PPCG.SE! This is a code golf challenge, where the goal is to solve a problem in as few characters as possible. Please add a version without comments, minimal whitespace and single-character variable names (and any other shortcuts you can think of) as well as the number of bytes in that code.


text:
Is it dark outside? Draw a sun map!
Our closest star, the sun, is quite fidgety. The times it rises and sets depend on where you are, and whether it is winter or not.
We would like to be able to deduce if the sun is shining outside without having to leave the comforts of our basements - which is why we need an up-to-date sun map (a.k.a. daylight map). You are the one to write a program that generates just that!
Rules: Your program should output an image (in a known format) or an ASCII art representation of our planet, showing (an approximation of) which parts are currently lit by the sun. Your program must be original and self-contained: you are not allowed to copy, use, include or call any code except your programming language's standard libraries.
If you still don't have a clue what I'm talking about, here's an example from Wikipedia:

This is a popularity contest. You should note in your answer which of the following you're trying to achieve (multiple choices possible):

Correctness. Note that the rules say 'an approximation of' - the better your approximation, the more points in this category. You can check your implementation against Wolfram Alpha's, Time and Date's or die.net's.
Functionality. For example, what about interactivity? Marking specific locations? Mapping other planets?
Aesthetics. Drawing continents? Bonus points. Textured continents? Bonus points. On a 3D earth? With clouds? Stars? Correct stars? Massive bonus points. And so on.
Using uncommon, old, or just plain wrong technology. Sure, you could whip this up in Mathematica, but have you considered using m4? SQL? Forth? x86 assembly?
Fun. Want to use a Dymaxion-projection map? Go ahead!
Short code. This is the Code Golf SE, after all.

Have fun!

Surely this is a lot easier on a 3D Earth, because you just have to position the lights correctly.

@PeterTaylor Probably! I think you don't even have to do lighting: you could draw a 3D earth and rotate it so that the daylight part (and nothing else) faces the viewer. It wouldn't show the nighttime part of the planet, but that's not required.

An alternative solution is simply to install windows. (In the basement, I mean.)

"x86 assembly" oh boy.

@qwr I'd take x86 assembly over m4 any day of the week for this task...

Also: "the sun is quite fidgety because it rises and sets at different times." Definitely the sun's fault :P

@qwr Ever thought about how easy time/date calculations would be if we had 10-hour days, 10-day weeks, 10-week months and 10-month years, and sun between t=0 and t=5? But no, the sun has to go and show its ugly face at different places at different times and take too long to go around the earth. No complaints division either. Disgusting.

Even if the times formed neat multiples of each other, and if there weren't other astronomical bodies to complicate things, and if the mean axis of rotation of Earth were perpendicular to the ecliptic, it still wouldn't be as simple as you wish because gyroscopic motion is complicated.

@PeterTaylor Without a doubt. But a man can dream, can't he?

Obligatory xkcd link: http://xkcd.com/now

@ntoskrnl the xkcd thing would be a great answer for this if mousing over the earth changed the daylight ring on the outside. Make it so ;)

Haskell - low quality code
I was extremely tired when I wrote this.

I might have gone too far with projections idea, anyway, here's the projection the program uses. Basically like projecting earth onto a cube and then unfolding it. Besides, in this projection, the shadow is made of straight lines.
The program uses current date/time, and outputs a PPM file on stdout.
import Data.Time.Clock
import Data.Time.Calendar
import Control.Applicative
import Data.Fixed
import Data.Maybe

earth :: [[Int]]
earth = [[256],[256],[256],[256],[64,1,1,2,1,5,14,16,152],[56,19,3,27,1,6,50,1,2,1,90],[53,6,1,11,2,36,26,1,2,1,16,2,1,1,2,1,24,4,66],[47,2,5,14,4,35,22,7,54,2,1,3,60],[38,1,2,2,3,1,6,1,2,1,2,7,6,1,1,33,24,3,3,1,56,2,60],[34,2,1,4,2,1,3,1,1,3,3,2,15,3,3,29,57,5,19,1,2,11,17,1,1,1,34],[40,3,10,2,1,8,16,27,54,3,18,19,18,1,36],[33,6,5,3,2,3,1,3,2,2,1,5,16,21,1,2,53,2,10,1,6,19,1,7,4,3,9,2,33],[32,4,1,7,1,2,3,2,1,1,3,11,14,23,53,2,10,3,1,4,2,33,7,7,29],[8,5,25,10,5,3,2,14,10,2,1,18,1,2,31,6,18,1,7,4,1,60,22],[5,18,2,12,3,5,1,3,2,2,1,3,4,2,3,8,11,18,30,13,9,2,7,3,2,72,1,6,8],[4,36,2,1,1,4,3,7,1,4,3,9,8,15,34,18,2,2,2,17,1,78,4],[4,1,1,27,3,1,1,24,6,3,1,1,1,3,6,13,13,1,20,15,1,4,1,104,1],[3,31,1,24,1,2,4,8,10,9,12,6,18,7,3,7,1,1,2,99,3,2,2],[7,50,2,2,2,1,2,1,3,2,1,2,10,7,15,1,20,7,2,111,7,1],[4,35,1,15,9,1,1,3,4,1,12,5,34,8,3,110,10],[4,9,1,2,1,37,12,6,16,3,34,8,3,96,5,6,13],[6,6,1,1,8,32,12,6,3,1,49,9,4,2,1,86,1,3,4,2,19],[9,2,1,1,11,31,11,11,40,1,8,1,2,4,5,83,12,3,20],[8,1,16,33,9,11,39,2,8,1,2,3,3,83,13,5,19],[28,33,5,12,40,2,7,3,6,62,1,19,13,5,20],[27,36,2,15,34,3,2,2,6,71,1,22,11,2,22],[30,21,1,11,2,16,33,3,1,4,2,72,1,24,1,1,9,1,23],[31,21,1,26,39,4,1,98,1,1,33],[31,42,7,1,40,100,1,1,33],[33,25,2,15,4,4,35,102,36],[33,23,2,1,2,14,8,1,36,27,1,9,1,61,3,1,33],[33,26,5,14,42,10,1,11,2,2,2,7,3,5,1,9,1,44,38],[33,26,1,2,1,9,2,1,45,7,1,2,2,9,8,6,2,6,1,53,4,2,33],[33,26,1,4,1,6,44,8,6,2,3,7,9,5,3,56,1,1,4,3,33],[33,37,45,8,7,2,3,6,2,4,3,6,4,53,43],[33,36,46,6,6,1,4,1,2,2,3,16,3,47,1,5,8,2,34],[34,34,46,7,11,1,3,2,2,16,3,45,6,2,8,1,35],[34,33,48,5,11,1,4,1,4,16,2,49,3,2,6,2,35],[35,32,54,8,17,60,5,2,4,4,35],[36,30,50,12,18,60,8,2,1,1,38],[38,27,50,15,16,61,6,2,41],[38,25,51,18,3,4,6,62,6,1,42],[39,1,1,17,2,3,51,93,49],[40,1,1,11,9,2,49,31,1,10,2,50,49],[40,1,2,9,10,2,48,33,1,10,2,49,49],[41,1,2,8,11,1,47,34,2,10,5,44,50],[42,1,2,7,58,36,1,11,2,1,8,36,51],[46,6,58,36,2,15,7,34,2,1,49],[46,6,12,2,43,38,2,14,7,2,1,12,1,15,55],[46,6,5,2,7,2,41,38,2,14,10,10,4,10,59],[47,6,3,3,10,3,38,37,3,12,11,8,6,9,2,1,57],[49,10,51,38,3,9,13,7,8,9,9,2,48],[51,7,51,40,2,7,15,6,9,1,1,8,8,2,48],[55,7,47,41,1,6,17,4,12,8,8,1,49],[57,5,47,42,1,2,20,4,13,8,9,1,47],[59,3,8,1,38,43,22,4,13,1,2,4,10,2,46],[60,2,6,5,38,41,1,4,18,3,17,3,10,2,46],[61,2,1,1,2,3,1,7,34,45,18,2,18,1,60],[63,1,2,13,33,44,22,1,12,1,16,3,45],[66,14,33,43,22,1,13,1,14,1,1,1,46],[66,18,30,4,1,1,5,30,34,1,2,2,9,3,50],[66,19,43,27,34,2,2,1,7,3,52],[65,20,43,26,36,2,1,2,5,5,51],[65,21,42,24,39,3,4,7,2,1,1,1,1,1,44],[56,1,7,23,41,16,1,6,41,2,4,6,7,1,44],[64,25,39,16,1,5,42,3,4,5,2,1,8,1,2,1,37],[64,29,35,22,43,3,1,1,2,3,2,1,1,1,2,1,1,2,1,7,6,1,27],[63,31,35,20,45,2,11,1,9,7,4,2,26],[64,32,34,19,67,1,2,6,1,2,28],[65,31,34,12,1,6,48,4,18,6,31],[65,31,34,19,54,2,1,2,2,1,10,2,2,1,30],[66,29,36,14,1,3,57,1,19,2,28],[66,29,36,14,1,4,63,1,42],[67,27,36,15,1,4,63,5,3,2,33],[67,26,37,20,5,2,53,2,1,4,4,2,33],[68,25,37,20,4,3,52,9,3,3,32],[70,23,36,20,3,4,53,11,1,4,31],[71,22,37,17,5,4,51,18,31],[71,22,37,16,7,3,50,20,30],[71,21,39,15,6,3,5,1,42,24,29],[71,20,40,15,6,3,47,26,28],[71,17,43,15,6,3,46,28,27],[71,16,45,13,8,1,48,27,27],[71,16,45,12,58,28,26],[71,16,45,12,58,28,26],[70,16,47,10,59,28,26],[70,15,49,9,60,27,26],[70,14,50,7,62,7,6,13,27],[70,13,51,6,63,6,8,1,1,9,28],[70,10,138,10,28],[69,12,139,7,29],[69,11,141,5,19,3,8],[69,8,167,3,9],[69,8,166,1,1,1,10],[70,5,149,2,16,2,12],[69,6,166,3,12],[68,6,166,2,14],[68,5,166,3,14],[68,6,182],[67,6,183],[68,4,184],[68,4,6,2,176],[69,4,183],[70,5,20,1,160],[256],[256],[256],[256],[256],[256],[78,1,1,1,109,1,65],[75,2,115,1,23,1,39],[72,3,80,1,1,5,20,42,32],[74,1,70,1,4,21,5,52,2,1,25],[67,1,2,2,1,4,64,28,4,62,21],[69,9,34,1,1,1,1,1,1,1,2,48,3,69,15],[50,1,5,1,16,5,34,130,14],[32,1,1,2,4,1,3,1,4,29,32,128,18],[20,1,1,54,32,128,20],[17,49,34,137,19],[9,1,2,54,20,4,6,143,17],[16,51,18,5,10,135,21],[11,1,4,54,25,140,21],[12,66,4,155,19],[12,231,13],[0,6,9,5,2,234],[0,256],[0,256]]
main = do
    header
    mapM_ line [0..299]
    where
        header = do
            putStrLn "P3"
            putStrLn "# Some PPM readers expect a comment here"
            putStrLn "400 300"
            putStrLn "2"
        line y = mapM_ (\x -> pixel x y >>= draw) [0..399]
            where
                draw (r, g, b) = putStrLn $ (show r) ++ " " ++ (show g) ++ " " ++ (show b)
                pixel x y = fromMaybe (return (1, 1, 1)) $
                    mapRegion (\x y -> (50, -x, y)) (x - 50) (y - 50)
                    <|> mapRegion (\x y -> (-x, -50, y)) (x - 150) (y - 50)
                    <|> mapRegion (\x y -> (-x, y, 50)) (x - 150) (y - 150)
                    <|> mapRegion (\x y -> (-50, y, -x)) (x - 250) (y - 150)
                    <|> mapRegion (\x y -> (y, 50, -x)) (x - 250) (y - 250)
                    <|> mapRegion (\x y -> (y, -x, -50)) (x - 350) (y - 250)
                    where
                        mapRegion f x y = if x >= -50 && y >= -50 && x < 50 && y < 50 then
                            Just $ fmap (worldMap . shade) getCurrentTime
                            else Nothing
                                where
                                    t (x, y, z) = (atan2 y z) / pi
                                    p (x, y, z) = asin (x / (sqrt $ x*x+y*y+z*z)) / pi * 2
                                    rotate o (x, y, z) = (x, y * cos o + z * sin o, z * cos o - y * sin o)
                                    tilt o (x, y, z) = (x * cos o - y * sin o, x * sin o + y * cos o, z)
                                    shade c = ((t $ rotate yearAngle $ tilt 0.366 $ rotate (dayAngle - yearAngle) $ f x y)) `mod'` 2 > 1
                                        where
                                            dayAngle = fromIntegral (fromEnum $ utctDayTime c) / 43200000000000000 * pi + pi / 2
                                            yearAngle = (fromIntegral $ toModifiedJulianDay $ utctDay c) / 182.624 * pi + 2.5311
                                    worldMap c = case (c, index (t $ f x y) (p $ f x y)) of
                                            (False, False) -> (0, 0, 0)
                                            (False, True) -> (0, 0, 1)
                                            (True, False) -> (2, 1, 0)
                                            (True, True) -> (0, 1, 2)
                                            where
                                                index x y = index' (earth !! (floor $ (y + 1) * 63)) (floor $ (x + 1) * 127) True
                                                    where
                                                        index' [] _ p = False
                                                        index' (x:d) n p
                                                            | n < x = p
                                                            | otherwise = index' d (n - x) (not p)

That's right - triangular where-code, nested cases, invalid IO usage.

That's a work of twisted genius. One suggestion, fromIntegral (fromEnum $ utctDayTime c) is neater as (realToFrac $ utctDayTime c). (I only learned this while writing my answer)

I could watch that .gif all day.

mnlip, I agree with @mikeTheLiar. You should embed that gif right at the top of your answer, you'd get all the votes.

I voted solely on the wacky gif. That's just a twisted way to look at the world.

ever so slightly trippy

Delightful! Now somebody needs to turn this into a wall clock.

Haskell, in the 'because it's there' category
I was curious so I wrote one. The formulas are reasonably accurate[1], but then I go and use some ascii art instead of a proper Plate Carrée map, because it looked nicer (the way I convert pixels to lat/long only works correctly for Plate Carrée)
import Data.Time
d=pi/180
tau=2*pi
m0=UTCTime(fromGregorian 2000 1 1)(secondsToDiffTime(12*60*60))
dark lat long now =
  let
    time=(realToFrac$diffUTCTime now m0)/(60*60*24)
    hour=(realToFrac$utctDayTime now)/(60*60)
    mnlong=280.460+0.9856474*time
    mnanom=(357.528+0.9856003*time)*d
    eclong=(mnlong+1.915*sin(mnanom)+0.020*sin(2*mnanom))*d
    oblqec=(23.439-0.0000004*time)*d
    ra=let num=cos(oblqec)*sin(eclong)
           den=cos(eclong) in
       if den<0 then atan(num/den)+pi else atan(num/den)
    dec=asin(sin(oblqec)*sin(eclong))
    gmst =6.697375+0.0657098242*time+hour
    lmst=(gmst*15*d)+long
    ha=(lmst-ra)
    el=asin(sin(dec)*sin(lat)+cos(dec)*cos(lat)*cos(ha))
  in
  el<=0

td x = fromIntegral x :: Double
keep="NSEW"++['0'..'9']
pixel p dk=if dk && p`notElem`keep then if p==' ' then '#' else '%' else p
showMap t= do
  let w=length(worldmap!!0)
      h=length worldmap
  putStrLn (worldmap!!0)
  putStrLn (worldmap!!1)
  mapM_(\y->do
           mapM_(\x->let
                    lat=(0.5-td y/td h)*pi
                    long=(0.5-td x/td w)*tau
                    in
                     putStr [pixel ((worldmap!!(y+2))!!x) (dark lat long t)]) [0..(w-1)]
           putStrLn "") [0..(h-4)]
  putStrLn (last worldmap)

main = do {t<-getCurrentTime; showMap t}

worldmap=[
 "180 150W  120W  90W   60W   30W  000   30E   60E   90E   120E  150E 180",
 "|    |     |     |     |     |    |     |     |     |     |     |     |",
 "+90N-+-----+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+",
 "|          . _..::__:  ,-\"-\"._       |7       ,     _,.__             |",
 "|  _.___ _ _<_>`!(._`.`-.    /        _._     `_ ,_/  '  '-._.---.-.__|",
 "|.{     \" \" `-==,',._\\{  \\  / {)     / _ \">_,-' `                mt-2_|",
 "+ \\_.:--.       `._ )`^-. \"'      , [_/(                       __,/-' +",
 "|'\"'     \\         \"    _L       oD_,--'                )     /. (|   |",
 "|         |           ,'         _)_.\\\\._<> 6              _,' /  '   |",
 "|         `.         /          [_/_'` `\"(                <'}  )      |",
 "+30N       \\\\    .-. )          /   `-'\"..' `:._          _)  '       +",
 "|   `        \\  (  `(          /         `:\\  > \\  ,-^.  /' '         |",
 "|             `._,   \"\"        |           \\`'   \\|   ?_)  {\\         |",
 "|                `=.---.       `._._       ,'     \"`  |' ,- '.        |",
 "+000               |    `-._        |     /          `:`<_|h--._      +",
 "|                  (        >       .     | ,          `=.__.`-'\\     |",
 "|                   `.     /        |     |{|              ,-.,\\     .|",
 "|                    |   ,'          \\   / `'            ,\"     \\     |",
 "+30S                 |  /             |_'                |  __  /     +",
 "|                    | |                                 '-'  `-'   \\.|",
 "|                    |/                                        \"    / |",
 "|                    \\.                                            '  |",
 "+60S                                                                  +",
 "|                     ,/           ______._.--._ _..---.---------._   |",
 "|    ,-----\"-..?----_/ )      _,-'\"             \"                  (  |",
 "|.._(                  `-----'                                      `-|",
 "+90S-+-----+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+",
 "Map 1998 Matthew Thomas. Freely usable as long as this line is included"]

Example output, from a more interesting time of year (we're near the equinox, so Wander Nauta's rectangular blobs are fairly accurate :) ) - this is for Jan 16 13:55:51 UTC 2014:
180 150W  120W  90W   60W   30W  000   30E   60E   90E   120E  150E 180
|    |     |     |     |     |    |     |     |     |     |     |     |
%90N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%##########%#%%%%%%%%##%%%%%%%#######%7#######%#####%%%%%#############%
%##%%%%%#%#%%%%%%%%%%%%%%####%########%%%#####%%#%%%##%##%%%%%%%%%%%%%%
%%%#####%#%#%%%%%%%%%%%##%##%#%%#####%#%#%%%%%%#%################%%%2%%
%#%%%%%%%#######%%%#%%%%%#%%######, [_/(         ##############%%%%%%#%
%%%%#####%#########%####%%#####  oD_,--'            ####%#####%%#%%###%
%#########%###########%%#####    _)_.\\._<> 6        ######%%%#%##%###%
%#########%%#########%######    [_/_'` `"(             ###%%%##%######%
%30N#######%%####%%%#%#####     /   `-'"..' `:._       ###%%##%#######%
%###%########%##%##%%#####     /         `:\  > \  ,-^. #%%#%#########%
%#############%%%%###%%###     |           \`'   \|   ?_)##%%#########%
%################%%%%%%%#      `._._       ,'     "`  |' %%#%%########%
%000###############%####`-._        |     /          `:`<_%%%%%%######%
%##################%####    >       .     | ,          `=.%%%%%%%#####%
%###################%%#    /        |     |{|              %%%%%#####%%
%####################%#  ,'          \   / `'            ,"#####%#####%
%30S#################%  /             |_'                |  %%##%#####%
%####################% |                                 '-'##%%%###%%%
%####################|/                                      ##%####%#%
%####################\.                                       #####%##%
%60S################                                          ########%
%##################   ,/           ______._.--._ _..---.-------%%%%###%
%####%%%%%%%%%%%%%--_/ )      _,-'"             "                ##%##%
%%%%%###########       `-----'                                    ##%%%
%90S%%%%%%%%%----+-----+-----+----+-----+-----+-----+-----+-----+----%%
Map 1998 Matthew Thomas. Freely usable as long as this line is included

[1] they're the same as you'll find elsewhere, except without the extra work to keep degrees between 0 and 360, hours between 0 and 24, and radians between 0 and 2pi. I think those are holdovers from the days we used slide rules; trig functions work just fine outside those ranges...

Brilliant! I love that you can still see the map through the 'dark'. Also, the math looks solid. Could you add the date you used for the example, so other people can compare their solutions to yours?

I see that you've added the date, thanks!

Yep. I like that in the image you can clearly see that it's winter in the Northern Hemisphere, made it easier to believe that date! I'm glad you posted an answer before me, saved me endless faff trying to do a golfed version, there's no way I'll beat yours for that.

.
Bash, 882* characters
This is my second entry, this time in the Aesthetics, Weird tech, Fun and Short code categories. It's inspired by Ram Narasimhan's entry and Peter Taylor's comment.
The script first generates a low-res texture of the world, bundled as base64-encoded data. It then generates 24 PovRay-scenes containing a sphere with that texture, each one rotated to 'face the sun'. Finally, the frames are combined into a GIF animation using ImageMagick. This means you'll have to have both PovRay and ImageMagick installed for the script to work - feel free to ignore this entry if you think that should disqualify it.
Like Ram's entry, and my first entry, this does not account for seasonal change, which means it's not very precise. It is, however, shorter, prettier and more precise than my first entry - and unlike Ram's entry, the map data and the code for generating the GIF animation are included.
                               echo '
                    iVBO  Rw0KGgoAAAA       NS
              UhE  U g      AAAEgAAAA                     kAQMAAAAQFe4lAAAABlB
    MVEUAFFwAbxKgAD63 AAAA   AWJLR0                  QAiAUdSAAAAAlwSFlzAAALEwAACx
 MB AJqcGAAAAAd0SU1FB9  4DE  hUWI   op      Fp5MAAADDSURBVBhXrcYhTsNQGADgr3ShE4Qi
    h4BeYQFBgqAJN8Lh    +r                jBb rArIJHPobgAgkzgeSQkVHT7MWThAHzq44
           /j/jezy6jSH  M6fB           gd  9T Nbxdl99R4Q+XpdNRISj4dlFRCz
            oI11FxIpup4uIRDe5           fokp0Y2W25jQFDfrGNGsDNsoqBaGj34D2
             bA7TcAwnmRoDZM             5tLkePUJb6uIT2rEq7hKaUhUHCXWpv7Q
             PqEv1rsuoc7X              RbV Bn2d   kGTYKMQ3C7H8z2+wc/eMd S
              QW39v8kAAA               AA      SUVOR K5CYII='|base64 \
               -di>t;for                X in     {0..23};do R=$((90-(\
                $X*15)                )); echo "camera{location <0,
                 0,                   -5> angle 38 }    light_source{
                  <0,0,               -1000> rgb < 2,2,   2>} sphere
                    {<0              ,0,0> 1 pigment      {
                      /**/            image_map{\"t\"        map_type
                        1}}                rotate           <0,$R,0>
                        }">s               ;povray             +Is +H300\
                        +Of$X.png          +W400
                        mogrify            -fill                     white    \
                        -annotate           +0+10                    "$X:00" \
                         -gravity           south                    f$X.png
                         done;              convert                -delay     \
                         100                -loop                 0 $(ls f*  \
                         |sort               -V)                  ani.gif
                        exit;

As a bonus, here's a GIF that uses NASA's Blue Marble image instead of the space-saving 1-bit texture, i.e. what the result would have looked like without any size restriction: https://i.stack.imgur.com/euOZf.gif
*: 882 characters not counting decorative whitespace, 1872 characters total.

+1 for making it all self-contained. And also for creating the self-referential code which itself looks like a world map. Nice work.

argh! multiple entries. Now I'm losing my excuse for not doing a mad one...

That's sick! Love it.

Heh, I realize now that I could've used the formatting of the code itself as the source for the world map (with spaces = ocean, everything else = land) and actually get better resolution with less characters. Oh well...

This looks like Minecraft.

^ I was going to say...

I decided to kick off the contest with an entry of my own, in the short code category. It's 923 characters long, not counting newlines.
C: 923 characters
Here's the code:
i;j;w=160;f=40;t;b;p;s;e;k;d=86400;q=599;
char* m="M('+z EDz :!#\"!*!8S$[\"!$!#\"\")\"!3R)V$'!!()1M./!F)\"!!!!)'/GE5@\"\"!&%.3&,Y$D\"!!%$)5i\"\"\"F\"%&&6%!e'A#!#!!#&$5&!f&A'$*\"5&!c-#'3''8\"$!!#\"U'\"=5$'8#$$\"S(#=7!*5\"!\"#['!A@6#!^H=!#6bH;!!!\"6_!!I;<&!&\"!!$\"F\"!I8;&\"#\"$&#\"C#\"I7<%#!\"/\"BP5=$*,\"=#\"$!L4A%&\"\"G\"\"\"#M1@)*F\"%P/@,!N#!S(E;!@W'E=!!!<Y&D7!&!\"$7\\$D8!)$4_$C8!('&#&!!a&@9!&(%$&g$>9!$*#(%h\">:!!-\"(%&!b!$&5:!\"+\"(!!#$!!!c+5<-!'!'!#!e)5:.!(!&!\"\"e,:25!!!\"!\"\"h-;07#\"$h.9/:\"\"$!!#\"a17-;'!\"$!!\"$!X46,<\"%\"&$\\45,>#&!$$#!W45,C!!!'!\"!$!V26,H\"#!$!\"!\"!S17-#!A!!#\"!_07,\"#A&!\"`.7+#\"A*.!Q.7*$\">/^-9)$\"=0^*<)$!>1]*<(D1])>&E2\\)>&F&!)\\)@#G$%(\\'w%]'x#,\"P%z .\"P%z .!R$z -\"S$z b#z c#z d#z 3";
main(){
t=(time(0)%d*160)/d;
printf("P2\n%d 62\n5\n",w);
for(;i<q;i++){
for(j=m[i]-' ';j>0;j--){
p=k%w,s=(t-f),e=(t+f);
printf("%c ","1324"[b*2+((p>s&&p<e)||(p>s+w&&p<e+w)||(p>s-w&&p<e-w))]);
k++;
}
b=!b;
}
}

Here's how it works:

 A crude bitmap of the world* is run-length encoded as a string. Every character in the string represents a run of either land or sea pixels. Long runs of sea are split into a run of sea, then 0 land pixels, then another run of sea, to avoid including unprintable characters in the string. The Python script I wrote to convert PBM files into this format is here.
I then use time() to find out how many seconds have passed in Greenwich since midnight, 1 January 1970. I modulo that to find out how many seconds have passed there today, using that information to position the light portion of the map more-or-less accordingly (I hope).
Correctness is a joke. There's no math at all. The code assumes the earth is a cylinder (block-shaped day/night), that the sun is directly above the equator (no summer/winter), and that you like the color gray (no color).
On the plus side, I do draw continents.
The output is in Portable Graymap (PGM) format, which can then be converted to PNG by something like ImageMagick or the GIMP.

Here's an example output, converted to PNG (larger version):

*: The entire world except Antarctica, but who lives there anyway...

Nice output, it would be better if the dark area was curved though

Yep! Having the output be curved means you would have to do some trigonometry though, which would make it much longer. (Or I guess you could just round the correct corners to make it look right-ish...)

@WanderNauta There'll be some severely pissed off penguins that will feel cheated that you didn't take them into consideration, bro...

@WallyWest If you live on the poles, like your penguins, you don't need this program - midnight sun and all.

Haskell - it's Hammer time.

I did another one. Adapted from my previous version, this one uses an oblique Hammer projection to show both poles at the same time (in fact you're seeing the whole earth in each frame). Just for added weirdness, instead of using a bitmap directly, I sampled the earth along a spiral to give approximately equal area coverage; this is what allows me to distort the earth and rotate it easily. Hammer's projection is equal area too; my idea was that pairing these two things would lead to less distortion when I fill in the gaps. I display a graticule on the projection too, using Bresenham's algorithm to draw the lines. The globe and terminator line both move over the course of the day.
Edited to change the image to a higher resolution but (deliberately) coarser underlying bitmap, so you can see the effect of the spiral. This uses 5000 points (sampled from ~260000), equivalent to a 50x100 bitmap, but giving more resolution to the equator than to the poles.
To use the code, compile with ghc, run with an optional numeric parameter which is the hour offset; files are generated like 'earth0.pgm', 'earth1.pgm'.
import System.Environment
import Data.List (intercalate,unfoldr)
import qualified Data.Set as Set
import Data.List.Split
import Data.List
import Data.Maybe (catMaybes)
import qualified Data.Map as Map
import Data.Time
import Debug.Trace
d=pi/180
tau=2*pi
m0=UTCTime(fromGregorian 2000 1 1)(secondsToDiffTime(12*60*60))
dark::Double->Double->UTCTime->Bool
dark lat long now =
  let
    time=(realToFrac$diffUTCTime now m0)/(60*60*24)
    hour=(realToFrac$utctDayTime now)/(60*60)
    mnlong=280.460+0.9856474*time
    mnanom=(357.528+0.9856003*time)*d
    eclong=(mnlong+1.915*sin(mnanom)+0.020*sin(2*mnanom))*d
    oblqec=(23.439-0.0000004*time)*d
    ra=let num=cos(oblqec)*sin(eclong)
           den=cos(eclong) in
       if den<0 then atan(num/den)+pi else atan(num/den)
    dec=asin(sin(oblqec)*sin(eclong))
    gmst =6.697375+0.0657098242*time+hour
    lmst=(gmst*15*d)+long
    ha=(lmst-ra)
    el=asin(sin(dec)*sin(lat)+cos(dec)*cos(lat)*cos(ha))
  in
  el<=0
infill(open, known)=
  if null open then known else infill gen
  where
    neighbours (x,y)=catMaybes $ map ((flip Map.lookup) known) [(x+1,y),(x-1,y),(x,y+1),(x,y-1),(x+1,y+1),(x-1,y+1),(x-1,y-1),(x-1,y-1)]
    vote a= if null a then Nothing
             else Just ((sum a)`div`(length a))
    fill x (open',  known')=
      case vote (neighbours x) of
        Nothing->(x:open',known')
        Just c->(open',(x,c):known')
    gen=(\(o,k)->(o,Map.fromList k))$foldr fill ([], Map.toList known) open
mpoint (a,b)=case a of Nothing->Nothing;Just c->Just(c,b)
grid w h n g lut= map (\y->map (\x->if Set.member (x,y) g then 3 else case Map.lookup (x,y) lut of Nothing->7;Just c->c) [1..w]) [1..h]
unknowns w h lut=concatMap (\y->concatMap (\x->let z=1-(2*x//w-1)^2-(2*y//h-1)^2 in case Map.lookup (x,y) lut of Nothing->if z<0 then [] else [(x,y)];_->[]) [1..w]) [1..h]
main=do
  args <- getArgs
  let off = if null args then 0 else read(args!!0)
  actual <- getCurrentTime
  let now=((fromIntegral off)*60*60) `addUTCTime` actual
  let tod=realToFrac(utctDayTime now)/86400+0.4
  let s=5000
  let w=800
  let h=400
  let n=6
  -- pbm <- readFile "earth.pbm"
  -- let bits=ungrid s$parsepbm pbm
  let bits=[0,23,4,9,1,3,1,2,6,10,1,10,4,1,3,7,10,7,4,2,2,1,2,6,12,1,1,2,1,5,4,1,8,1,3,
            1,21,7,2,2,35,1,4,3,2,2,2,2,16,1,25,1,2,8,1,4,1,2,13,3,2,1,26,1,1,10,3,3,8,
            2,3,6,1,3,25,2,1,10,15,5,1,6,2,3,30,10,15,19,32,11,16,20,35,11,1,2,14,22,27,
            1,8,14,16,22,2,1,22,1,1,2,1,1,2,1,2,1,3,16,14,25,1,2,21,1,6,1,2,1,1,2,3,17,
            14,26,1,2,1,1,26,1,1,3,3,1,1,19,13,28,4,1,26,6,6,21,11,35,40,21,11,37,41,20,
            2,4,4,1,1,39,19,1,6,1,16,19,2,4,5,40,18,2,7,1,17,19,1,1,1,1,1,2,3,46,7,1,5,
            4,25,16,3,1,1,3,5,44,1,4,5,4,3,6,4,1,19,22,5,46,2,3,4,6,2,9,22,22,2,50,1,5,
            2,1,1,6,1,8,24,15,5,1,2,51,2,5,1,1,1,5,1,10,23,14,9,55,1,4,2,17,16,1,4,14,9,
            57,4,1,3,17,13,20,11,54,2,1,3,1,2,20,12,18,13,47,4,3,8,21,10,17,15,44,5,1,1,
            4,1,3,2,22,10,15,16,46,4,3,1,2,2,25,9,17,15,47,1,1,3,30,9,18,13,46,2,1,4,25,
            2,1,11,16,13,46,8,24,2,2,9,16,11,45,12,22,1,3,7,17,10,45,12,21,1,3,7,19,8,
            43,12,25,6,19,8,41,12,25,5,20,7,40,11,25,4,20,6,40,5,3,2,48,6,38,3,54,4,30,
            1,6,2,55,2,29,1,5,1,53,3,28,1,55,3,49,1,30,2,76,1,284,3,4,1,15,1,17,10,1,9,
            7,1,13,21,4,4,1,2,6,17,2,8,3,63]
  let t(phi,lambda)=unitsphere$rx (-pi/4)$rz (-tod*4*pi)$sphereunit(phi, lambda)
  let hmr=(fmap (\(x,y)->(floor((fl w)*(x+4)/8),floor((fl h)*(y+2)/4)))).hammer.t
  let g=graticule hmr n
  let lut = Map.fromList$ catMaybes $map mpoint$map (\((lat,long),bit)->(hmr(lat,long),bit*4+2-if dark lat long now then 2 else 0))  $zip (spiral s) (rld bits)
  -- let lut = Map.fromList$ catMaybes $map mpoint$map (\((lat,long),bit)->(hmr(lat,long),bit))$zip (spiral s) (rld bits)
  let lut' = infill ((unknowns w h lut), lut)
  let pgm = "P2\n"++((show w)++" "++(show h)++" 7\n")++(intercalate "\n" $ map (intercalate " ")$chunksOf 35 $ map show(concat$grid w h n g lut'))++"\n"
  writeFile ("earth"++(show off)++".pgm") pgm

fl=fromIntegral
spiral::Int->[(Double,Double)]
spiral n=map (\k-> let phi=acos(((2*(fl k))-1)/(fl n)-1) in rerange(pi/2-phi,sqrt((fl n)*pi)*phi)) [1..n]
rld::[Int]->[Int]
rld bits=concat$rld' (head bits) (tail bits)
  where
   rld' bit []=[]
   rld' bit (run:xs) = (replicate run bit):(rld' (case bit of 1->0;_->1) xs)
rle::[Int]->[Int]
rle bits=(head bits):(map length$group bits)
sample::Int->Int->Int->[(Int,Int)]
sample n w h = map (\(phi, theta)->((floor((fl h)*((phi-(pi/2))/pi)))`mod`h, (floor((fl w)*(theta-pi)/(tau)))`mod`w )) $ spiral n
ungrid::Int->[[Int]]->[Int]
ungrid n g = rle $ map (\(y, x)->(g!!y)!!x) (sample n w h)
  where w = length$head g
        h = length g
parsepbm::[Char]->[[Int]]
parsepbm pbm=
    let header = lines pbm
        format = head header
        [width, height] = map read$words (head$drop 1 header)
        rest = drop 2 header
        d = ((map read).concat.(map words)) rest
    in chunksOf width d
rerange(phi,lambda)
 | abs(phi)>pi = rerange(phi - signum(phi)*tau, lambda)
 | abs(phi)>pi/2 = rerange(phi-signum(phi)*pi, lambda+pi)
 | abs(lambda)>pi = rerange(phi, lambda - signum(lambda)*tau)
 | otherwise = (phi, lambda)
laea(phi,lambda)=if isInfinite(z) then Nothing else Just (z*cos(phi)*sin(lambda),z*sin(phi)) where z=4/sqrt(1+cos(phi)*cos(lambda))
hammer(phi,lambda)=case laea(phi, lambda/2) of Nothing->Nothing; Just(x,y)->Just (x, y/2)
bresenham :: (Int, Int)->(Int, Int)->[(Int, Int)]
bresenham p0@(x0,y0) p1@(x1,y1)
  | abs(dx)>50||abs(dy)>50=[]
  | x0>x1 = map h$ bresenham (h p0) (h p1)
  | y0>y1 = map v$ bresenham (v p0) (v p1)
  | (x1-x0) < (y1-y0) = map f$ bresenham (f p0) (f p1)
  | otherwise = unfoldr (\(x,y,d)->if x>x1 then Nothing else Just((x,y),(if 2*(d+dy)<dx then(x+1,y,d+dy)else(x+1,y+1,d+dy-dx)))) (x0,y0,0)
      where
        h(x,y)=(-x,y)
        v(x,y)=(x,-y)
        f(x,y)=(y,x)
        dx=x1-x0
        dy=y1-y0
globe n k=
  (concatMap (\m->map (meridian m) [k*(1-n)..k*(n-1)]) [k*(1-2*n),k*(2-2*n)..k*2*n])
  ++(concatMap (\p->map (parallel p) [k*(-2*n)..k*2*n]) [k*(1-n),k*(2-n)..k*(n-1)])
  where
  meridian m p=(radians(p,m),radians(p+1,m))
  parallel p m=(radians(p,m),radians(p,m+1))
  radians(p,m)=rerange((p//(k*n))*pi/2,(m//(k*n))*pi/2)
graticule f n=Set.fromList $ concatMap (\(a,b)->case (f a,f b) of (Nothing,_)->[];(_,Nothing)->[];(Just c,Just d)->bresenham c d) (globe n 4)
rx theta (x,y,z) = (x, y*(cos theta)-z*(sin theta), y*(sin theta)+z*(cos theta))
ry theta (x,y,z) = (z*(sin theta)+x*(cos theta), y, z*(cos theta)-x*(sin theta))
rz theta (x,y,z) = (x*(cos theta)-y*(sin theta), x*(sin theta)+y*(cos theta), z)
sphereunit (phi, theta) = (rz theta (ry (-phi) (1,0,0)))
unitsphere (x,y,z) = (asin z, atan2 y x)
x//y=(fromIntegral x)/(fromIntegral y)

This is... madness. Absolute madness. I love it.

It tooks me so long to get the transform right on this one. The spiral bitmap alone is hilarious.

re "it does scale up quite well" - do you mean you could easily make a higher-resolution GIF?

Yes. quite a lot larger. I took that code out for a bit while I messed with the graticule, when I get time a bit later I'll put it back in and upload a better image

there you go - nice big image of crazytown

"Stop! Hammer(-Aitoff projection) time."

C, using pnm images
Late answer, focusing on correctness and aesthetics. The output is a blend of two input images (day.pnm and night.pnm), including a stripe of twilight. I'm using images based on NASAs blue marble here.
The code uses my own img.h for clarity (just imagine it being included verbatim in the .c for strict rule compliance...). Everything in there is implemented via C macros. The animations are built with imagemagicks convert from multiple frames - the program itself will only output static images. Code is below.
Now: (Aug 13, ~13:00 CEST)

One day: (Jan 1st)

One year: (12:00 UTC)

sun.c
  #include <math.h>
  #include <time.h>

  #include "img.h"

  #ifndef M_PI
  #define M_PI 3.14159265359
  #endif

  double deg2rad(double x) {return x / 180.0 * M_PI;}
  double rad2deg(double x) {return x * 180.0 / M_PI;}

  double  sind(double x) {return  sin(deg2rad(x));}
  double  cosd(double x) {return  cos(deg2rad(x));}
  double asind(double x) {return rad2deg(asin(x));}

  double elevation(double latitude, double longitude, int yday, int hour, int min, int sec)
  {
     double fd = (hour + (min + sec / 60.0) / 60.0) / 24.0;
     double fyd = 360.0 * (yday + fd) / 366.0;

     double m = fyd - 3.943;
     double ta = -1.914 * sind(m) + 2.468 * sind(2 * m + 205.6);
     double hourangle = (fd - 0.5) * 360.0 + longitude + ta;
     double decl = 0.396 - 22.913 * cosd(fyd) + 4.025 * sind(fyd) - 0.387 * cosd(2 * fyd) + 0.052 * sind(2 * fyd) - 0.155 * cosd(3 * fyd) + 0.085 * sind(3 * fyd);

     return asind(cosd(hourangle) * cosd(decl) * cosd(latitude) + sind(decl) * sind(latitude));
  }

  int main(int argc, char* argv[])
  {
     Image day, night, out;
     int x, y;
     time_t t = time(0);
     struct tm* utc = gmtime(&t);
     int yday = utc->tm_yday, hour = utc->tm_hour, min = utc->tm_min, sec = utc->tm_sec;

     imgLoad(day, "day.pnm");
     imgLoad(night, "night.pnm");
     imgLoad(out, "day.pnm");
     for(y = 0; y < day.height; ++y)
     {
        double latitude = 90.0 - 180.0 * (y + 0.5) / day.height;
        for(x = 0; x < day.width; ++x)
        {
           double longitude = -180.0 + 360.0 * (x + 0.5) / day.width;
           double elev = elevation(latitude, longitude, yday, hour, min, sec);
           double nf = elev > -0.8 ? 0.0 : elev > -6.0 ? 0.5 : 1.0;
           double df = 1.0 - nf;
           Color dc = imgGetColor(day, x, y);
           Color nc = imgGetColor(night, x, y);
           imgDotC3(out, x, y, df * dc.r + nf * nc.r, df * dc.g + nf * nc.g, df * dc.b + nf * nc.b);
        }
     }
     imgSave(out, "out.pnm");
  }

img.h
  #include <stdlib.h>
  #include <stdio.h>
  #include <string.h>

  typedef struct
  {
     unsigned char r;
     unsigned char g;
     unsigned char b;
  } Color;

  typedef struct
  {
     Color* data;
     int width;
     int height;
     Color c;
  } Image;

  #define imgCreate(img, w, h)           {\
                                            int length;\
                                            (img).width = (w);\
                                            (img).height = (h);\
                                            length = (img).width * (img).height * sizeof(Color);\
                                            (img).data = malloc(length);\
                                            memset((img).data, 0, length);\
                                            (img).c.r = (img).c.g = (img).c.b = 0;\
                                         }

  #define imgDestroy(img)                {\
                                            free((img).data);\
                                            (img).width = 0;\
                                            (img).height = 0;\
                                            (img).c.r = (img).c.g = (img).c.b = 0;\
                                         }

  #define imgSetColor(img, ur, ug, ub)   {\
                                            (img).c.r = (ur);\
                                            (img).c.g = (ug);\
                                            (img).c.b = (ub);\
                                         }

  #define imgDot(img, x, y)              {\
                                            (img).data[(int)(x) + (int)(y) * (img).width] = (img).c;\
                                         }

  #define imgDotC3(img, x, y, ur, ug, ub) {\
                                            (img).data[(int)(x) + (int)(y) * (img).width].r = (ur);\
                                            (img).data[(int)(x) + (int)(y) * (img).width].g = (ug);\
                                            (img).data[(int)(x) + (int)(y) * (img).width].b = (ub);\
                                         }

  #define imgDotC(img, x, y, c)          {\
                                            (img).data[(int)(x) + (int)(y) * (img).width] = (c);\
                                         }

  #define imgGetColor(img, x, y)         ((img).data[(int)(x) + (int)(y) * (img).width])

  #define imgLine(img, x, y, xx, yy)     {\
                                            int x0 = (x), y0 = (y), x1 = (xx), y1 = (yy);\
                                            int dx =  abs(x1 - x0), sx = x0 < x1 ? 1 : -1;\
                                            int dy = -abs(y1 - y0), sy = y0 < y1 ? 1 : -1;\
                                            int err = dx + dy, e2;\
                                            \
                                            for(;;)\
                                            {\
                                               imgDot((img), x0, y0);\
                                               if (x0 == x1 && y0 == y1) break;\
                                               e2 = 2 * err;\
                                               if (e2 >= dy) {err += dy; x0 += sx;}\
                                               if (e2 <= dx) {err += dx; y0 += sy;}\
                                            }\
                                         }

  #define imgSave(img, fname)            {\
                                            FILE* f = fopen((fname), "wb");\
                                            fprintf(f, "P6 %d %d 255\n", (img).width, (img).height);\
                                            fwrite((img).data, sizeof(Color), (img).width * (img).height, f);\
                                            fclose(f);\
                                         }

  #define imgLoad(img, fname)            {\
                                            FILE* f = fopen((fname), "rb");\
                                            char buffer[16];\
                                            int index = 0;\
                                            int field = 0;\
                                            int isP5 = 0;\
                                            unsigned char c = ' ';\
                                            while(field < 4)\
                                            {\
                                               do\
                                               {\
                                                  if(c == '#') while(c = fgetc(f), c != '\n');\
                                               } while(c = fgetc(f), isspace(c) || c == '#');\
                                               index = 0;\
                                               do\
                                               {\
                                                  buffer[index++] = c;\
                                               } while(c = fgetc(f), !isspace(c) && c != '#' && index < 16);\
                                               buffer[index] = 0;\
                                               switch(field)\
                                               {\
                                                  case 0:\
                                                     if (strcmp(buffer, "P5") == 0) isP5 = 1;\
                                                     else if (strcmp(buffer, "P6") == 0) isP5 = 0;\
                                                     else fprintf(stderr, "image format \"%s\" unsupported (not P5 or P6)\n", buffer), exit(1);\
                                                     break;\
                                                  case 1:\
                                                     (img).width = atoi(buffer);\
                                                     break;\
                                                  case 2:\
                                                     (img).height = atoi(buffer);\
                                                     break;\
                                                  case 3:\
                                                     index = atoi(buffer);\
                                                     if (index != 255) fprintf(stderr, "image format unsupported (not 255 values per channel)\n"), exit(1);\
                                                     break;\
                                               }\
                                               field++;\
                                            }\
                                            imgCreate((img), (img).width, (img).height);\
                                            if (isP5)\
                                            {\
                                               int length = (img).width * (img).height;\
                                               for(index = 0; index < length; ++index)\
                                               {\
                                                  (img).data[index].r = (img).data[index].g = (img).data[index].b = fgetc(f);\
                                               }\
                                            }\
                                            else\
                                            {\
                                               fread((img).data, sizeof(Color), (img).width * (img).height, f);\
                                            }\
                                            fclose(f);\
                                         }

Very pretty! I like it.

R: Using ggplot2 and Map projection

Inspired by @mniip's post, I decided to try using R's mapproj package, wherein we can orient the globe by specifying where the North Pole should be when computing the projection.
Based on current GMT time, I compute the longitude where is it currently noon and make that point the map's center.  We are looking at Earth from the "Sun's point of view" so whatever is visible is in daylight.
Much of the code is just aesthetics. The only part I had to figure out was to compute the "noon Longitude," that is the longitude value where it was noon given any GMT time.
library(ggplot2);library(maps);library(ggmap)
world <- map_data("world")# a lat-long dataframe from the maps package
worldmap <- ggplot(world, aes(x=long, y=lat, group=group)) +
  geom_path(color="orange") +
  theme(panel.background= element_rect("black"),
        axis.text.y=element_blank(),
        axis.ticks=element_blank(),
        axis.title.x=element_blank(),
        axis.title.y=element_blank(),
        panel.grid.major = element_line(colour="blue", size=0.75),
        panel.grid.minor = element_line(colour="blue")
  )

#Create a function that takes in the current GMT time
print_3d_coordmap <- function (current_gmt_time) {
  curr_gmt_mins <- as.POSIXlt(current_gmt_time)$hour*60 + as.POSIXlt(current_gmt_time)$min
  noon_longitude <- 180 - (curr_gmt_mins * 360/1440)
  #centered at wherever longitude where it is Noon now on (lat:equator)
  worldmap + coord_map("ortho", orientation=c(0, noon_longitude, 0))
}

#test it out
print_3d_coordmap(Sys.time() + 7*60*60) # my location is 7 hours behind UTC

I then used the R animation package to generate 24 images and stitched them into one GIF.

Looks great! Does it correctly handle summer and winter, though? I don't know R that well, but it looks like your equator is always at the center of the image.

Yes, you are correct. I did a quick and dirty implementation using the equator as the only latitude. (Focused on the animation instead.) The project has lots of features that I am not using. If there is a reference that shows how to vary latitudes with seasons, I will be happy to try it out.

Here's a reference in R, Ram - in fact this is where I translated the formulas in my entry from http://stackoverflow.com/questions/8708048/position-of-the-sun-given-time-of-day-latitude-and-longitude

@bazzargh Thanks! Looks like I have a lot of learning about azimuth angles to do.

JavaScript – by Martin Kleppe (http://aem1k.com/)
I want to stress that this is not my work, but the work of Martin Kleppe. I just think it fits so perfectly that it should not be missing here:
Online Demo (or just paste it into the console)
eval(z='p="<"+"pre>"/*        ######## */;for(y in n="zw24l6k\
4e3t4jnt4qj24xh2 x/*    *############### */42kty24wrt413n243n\
9h243pdxt41csb yz/*  #################### */43iyb6k43pk7243nm\
r24".split(4)){/*     *#################*   */for(a in t=pars\
eInt(n[y],36)+/*          ###############*   */(e=x=r=[]))for\
(r=!r,i=0;t[a/*               ############*   */]>i;i+=.05)wi\
th(Math)x-= /*                #############    */.05,0<cos(o=\
new Date/1e3/*                #########*       */-x/PI)&&(e[~\
~(32*sin(o)*/*                     ####*       */sin(.5+y/7))\
+60] =-~ r);/*                         *###    */for(x=0;122>\
x;)p+="   *#"/*                        #####  */[e[x++]+e[x++\
]]||(S=("eval"/*                      *##### */+"(z=\'"+z.spl\
it(B = "\\\\")./*      ###*           ####  */join(B+B).split\
(Q="\'").join(B+Q/*                  ###* */)+Q+")//m1k")[x/2\
+61*y-1]).fontcolor/*               ##   */(/\\w/.test(S)&&"#\
03B");document.body.innerHTML=p+=B+"\\n"}setTimeout(z)')//m1k\

If it's not your work, you should turn your answer into a community wiki.

Thanks for the tip, never noticed that checkbox before. Done!

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Complement a POSIX Extended Regular Expression
Given a POSIX Extended Regular Expression as input, output its complement (also a POSIX ERE). If the given regular expression matches a string, its complement should not match it, and the regex: (regex given)|(complement) should match any string. In other words, negate the regex.
The regex for format input and for output, POSIX ERE, is basically regex without character classes, lookarounds, backreferences, etc. You can assume that we only care about ASCII characters. Also, assume that character classes do not contain - for use as ranges (no [a-d] as input; instead, the input would be [abcd]). Further assume that ? and +  and {} will not be used in the input as metacharacters. x? will be shown with x| and x+ by xx* where x is an arbitrary regular expression. The variations of {m,n} will be similarly written out (e.g.: instead of x{1,4}, you'll get x|xx|xxx|xxxx).
Sample Input:
^([helo][world])([helo][world])*$

Possible Output (Thanks Peter Taylor):
^(([helo]([world][helo])*)?$|([helo][world])*[^helo]|[helo]([world][helo])*[^world])

Please post a few sample Input/Outputs

The string ao is neither matched by the input nor the given output. A possible output would be ^(|(..)*.|(..)*[^helo].(..)*|(..)*.[^world](..)*)$ (assuming . matches all characters).

@HeikoOberdiek Thanks, I decided to go with Peter Taylor's version instead.

As far as I can see, there is no way to complement the empty pattern that matches everything.

@HeikoOberdiek See http://codegolf.stackexchange.com/q/18393/9498 . Example: .^ It's not possible for a character to be before the start of a string.

Oh "complement", not "compliment"... I was going to answer something on the lines of "Nice word boundaries!"

I feel like this will be too hard unless you give a simpler regex grammar than POSIX ERE.

@PeterOlson What do you suggest then? Also, next time, try to bring this up in the sandbox.

I'd suggest a simple grammar that can be described in a few lines. You could use the formal definition of a regular expression, which only uses concatenation (RS), alternation (R|S), and Kleene star (R*).

@PeterOlson That looks good, but I would like to include .. Would that make it too difficult?

I don't think that would make it much harder

@PeterOlson I had another thought; anything in this POSIX ERE can be replaced with something else to make it part of the formal definition. Instead of using the formal definition, I say use POSIX ERE, but restrict input as follows: no ranges in character classes; no character class negations; no use of ? or +; () will only be used when necessary. Output can use any of those.

If you include ., what will be the complement of e.g. AB.D?

@AntonioRagagnin Note I said assume that we are using ASCII. This means that . is equivalent to [x-~] where the x is the null character (ASCII 0). Basically, it is possible to translate POSIX ERE into the formal definition of regular expressions. I'm not sure what the complement would be; I'm working on it.

@AntonioRagagnin A complement of your regular expression is ^([A][B].[^D]|[A][B].$|[A][B]$|[A][^B]|[A]$|[^A])*$. I also found a tool for testing POSIX ERE expressions: http://www.regexplanet.com/advanced/golang/index.html

There's an answer here which describes how to do this: http://stackoverflow.com/a/14817545/1396205

Hmm had more of a look at this. It's possible, but crazy tedious. You need to parse the regexp into an NFA (eg Thompson's algorithm), convert the NFA to a DFA (powerset construction), complete the DFA, find the complement, then convert the DFA to a RE (eg Brzozowski's method). ie slightly harder than writing a complete RE engine! I'd expect a golfed version would need to use library functions for each step.

@mbomb007 I think that was meant to be "complement", not "compliment"... At any rate, I didn't answer or comment on this question until now... So I'm a little confused, why refer to me...?

Not quite a duplicate because it allows regex syntaxes other than ERE, which actually makes a very large difference here.

@WallyWest yeah you did...

@Justin Can we assume that every input regex will start with ^ and end with $ (i.e. no "fuzzy" matching)? If so, I think I will have a solution soon.

Though honestly, supporting printable ASCII is going to be rough, if meta-characters have to be included in the alphabet.

@mbomb007 TBH, it's been so long since I posted this challenge that I'm unsure what is reasonable. I can revisit this and carefully revise it to make it simpler (stuff like only printable ascii or something). Also, is we have a regex regex, if it doesn't start with ^, isn't it exactly equivalent to ^.*regex? I don't know what I originally intended; it will take some work to figure that out

Yeah, you're right. I guess that's fine. I guess it depends what you want the challenge to be. Supporting escaped meta-characters is honestly going to be a challenge in itself if they are part of the alphabet. If what you really want is for the complementing the regex to be the entirety of the challenge, maybe supporting the characters [A-Za-z0-9] plus spaces is enough. Idk. If that was enough, I could (probably) have an answer today.

The parts I haven't finished yet are replacing character classes [abc] with (a|b|c) so that I can work with them, and supporting (certain) escaped meta-chars. I think I get can printable ASCII to work, but it'll just take a while.

Also, golfing will take a long time. The code I have so far is basically 30KB.

@mbomb007 write an automatic golfer for it? (Or just do a size-optimization compile)

@Rogem I just haven't been working on this lately. My previous comment still stands, as I'm not finished with supporting all of the necessary characters yet. As I said, if all I need was to support [A-Za-z0-9], I'd probably have submitted an answer already.

JavaScript, 1563 bytes
m=>`^${((l,n={s:{[e(l[0])]:""}})=>((t=s=>n[x=e(s)]=n[x]||(n[x]={},r.reduce(((r,o,c)=>(c=l[2](s)(o),t(c),r[x=e(c)]=(r[x]||"[]")[$](0,-1)+("\\"==o||"]"==o?"\\":"")+o+"]",l[1](s)||(r.e=""),r)),{})))(l[0]),(g=Object.keys)(n)[h]((e=>"s"!=e&&(c=n[e],d=c[e],delete c[e],delete n[e],g(n)[h]((l=>(s=n[l][e])!={}.x&&delete n[l][e]&&g(c)[h]((e=>(o=s+(d?`(${d})*`:"")+c[e],n[l][e]=n[l][e]!={}.x?`(${n[l][e]}|${o})`:o)))))))),n.s.e||"[]"))((a=e=>e===e+""?e?[0,e=>1==e,l=>t=>[t==e?1:2,2,2][l]]:[0,e=>!e,e=>e=>1]:[([e])=>[0,l=>!l||l.some((l=>e[1](l))),t=>r=>l((t||[e[0]]).flatMap((l=>[x=e[2](l)(r),...e[1](x)?[e[0]]:[]])))],e=>[e[h]((e=>e[0])),l=>l.some(((l,t)=>e[t][1](l))),l=>t=>l[h](((l,r)=>e[r][2](l)(t)))],([e,t])=>[[e[0],e[1](e[0])?[t[0]]:[]],e=>e[1].some((e=>t[1](e))),r=>s=>[x=e[2](r[0])(s),l([...e[1](x)?[t[0]]:[],...r[1][h]((e=>t[2](e)(s)))])]],l=>[0,e=>1==e,l=>t=>[e[1].includes(t)?1:2,2,2][l]]][e[0]](e[1][h](a)))((f=e=>e.length?e.reduce(((e,l)=>[2,[e,l]])):"")(m[$="slice"](1,-1).split(/(\\.|[^\\])/).filter((e=>e)).reverse(e=JSON.stringify,l=l=>[...new Set(l[h](e))].sort()[h](JSON.parse),r=[...Array(95)][h](((e,l)=>String.fromCharCode(l+32))),h="map")[u="reduceRight"](p=(e,l,t,s)=>e&&{[l]:t=>[...e,l[$](-1)],".":l=>[...e,[3,r]],"*":l=>e.concat([[0,[e.pop()]]]),"[":l=>[...e,((e,l)=>[3,e?r.filter((e=>!l.includes(e))):l])(n="^"==s[t-1],s.splice(s.lastIndexOf("]"),s.length)[$](1,-n||{}.x)[h]((e=>e[$](-1))))],")":l=>(i=e,0),"(":l=>[...e,(s[u](p,[]),[1,i.reduce((([e,...l],t)=>1==t?[[],e,...l]:[[...e,t],...l]),[[]])[h](f)])],"|":l=>[...e,1]}[s.pop()](),[]))))}$`

Try it online!
Input/Output Examples
The challenge was to golf the source, not the output ¯\_(ツ)_/¯
Input: ^([helo][world])([helo][world])*$
Output: ^(((((((((|[ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcdfgijkmnpqrstuvwxyz{|}~]([ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~])*)|[ehlo])|[ehlo][ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcefghijkmnpqstuvxyz{|}~]([ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~])*)|[ehlo][dlorw][ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcdfgijkmnpqrstuvwxyz{|}~]([ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~])*)|[ehlo][dlorw][ehlo])|[ehlo][dlorw][ehlo][ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcefghijkmnpqstuvxyz{|}~]([ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~])*)|[ehlo][dlorw][ehlo][dlorw][ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcdfgijkmnpqrstuvwxyz{|}~]([ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~])*)|[ehlo][dlorw][ehlo][dlorw][ehlo](|[ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcefghijkmnpqstuvxyz{|}~]([ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~])*))|[ehlo][dlorw][ehlo][dlorw][ehlo][dlorw]([ehlo][dlorw])*([ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcdfgijkmnpqrstuvwxyz{|}~]([ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~])*|[ehlo](|[ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcefghijkmnpqstuvxyz{|}~]([ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~])*)))$

Input: ^.*$
Output: ^[]$ # Empty character set matches nothing

Input: ^[]$
Output: ^(|[ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~]([ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~])*)$

Input: ^(|[ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~]([ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~])*)$
Output: ^[]$

Ungolfed Less Golfed
let input = "^([helo][world])([helo][world])*$"

const star = 0
const union = 1
const concat = 2
const group = 3
const charset = [...Array(95)].map((_, i) => String.fromCharCode(i + 32));

input = `.*${input}.*`.replace(/\.\*\^|\$\.\*/g, "");

const makeConcat = x => x.length ? x.reduce((a, b) => [concat, [a, b]]) : "";

const regex = makeConcat(input
  .split(/(\\.|[^\\])/)
  .filter(x => x)
  .reverse()
  .reduceRight(_parseRegex = (acc, char, i, arr) => (
    acc && {
      [char]: _ => [...acc, char.slice(-1)],
      ".": _ => [...acc, [group, charset]],
      "*": _ => acc.concat([[star, [acc.pop()]]]),
      "[": _ => [...acc, ((i, a) =>
        [group, i ? charset.filter(x => !a.includes(x)) : a]
      )(
        invert = arr[i - 1] == "^",
        arr
          .splice(arr.lastIndexOf("]"), arr.length)
          .slice(1, -invert || {}.x)
          .map(x => x.slice(-1))
      )],
      ")": _ => (result = acc, null),
      "(": _ => [...acc, (
        arr.reduceRight(_parseRegex, []),
        [union, result.reduce(([a, ...b], char) => (
          char == union ? [[], a, ...b] : [[...a, char], ...b]
        ), [[]]).map(makeConcat)]
      )],
      "|": _ => [...acc, union],
    }[arr.pop()]()
  ), []))

const str = JSON.stringify;
const set = x => [...new Set(x.map(str))].sort().map(JSON.parse)

const initial = 0;
const accept = 1;
const next = 2;

const dfa = (regexToDfa = re =>
  re === re + ""
    ? re
      ? [0, x => x == 1, x => c => [c == re ? 1 : 2, 2, 2][x]]
      : [0, x => !x, x => c => 1]
    : [
      // star
      ([sub]) => [
        0,
        state => !state || state.some(substate => sub[accept](substate)),
        state => char => set((state || [sub[initial]]).flatMap(substate => [
          x = sub[next](substate)(char),
          ...sub[accept](x) ? [sub[initial]] : []
        ]))
      ],
      // union
      subs => [
        subs.map(sub => sub[initial]),
        state => state.some((substate, i) => subs[i][accept](substate)),
        state => char => state.map((substate, i) => subs[i][next](substate)(char)),
      ],
      // concat
      ([a, b]) => [
        [a[initial], a[accept](a[initial]) ? [b[initial]] : []],
        state => state[1].some(x => b[accept](x)),
        state => char =>
          [
            x = a[next](state[0])(char),
            set([
              ...a[accept](x) ? [b[initial]] : [],
              ...state[1].map(substate => b[next](substate)(char))
            ])
          ]
      ],
      // group
      _ => [
        0,
        state => state === 1,
        state => char => [re[1].includes(char) ? 1 : 2, 2, 2][state],
      ]
    ][re[0]](re[1].map(regexToDfa))
)(regex)

const testDfa = i => dfa[accept]([...i].reduce((a, b) => dfa[next](a)(b), dfa[initial]))

const invertDfa = dfa => [dfa[initial], x => !dfa[accept](x), dfa[next]]

const dfaToString = (dfa, paths = { s: { [str(dfa[initial])]: "" } }) =>
(
  (visitState = (state) => paths[x = str(state)] = paths[x] || (paths[x] = {},
    charset.reduce((obj, char, nextState) => (
      nextState = dfa[next](state)(char),
      visitState(nextState),
      obj[x = str(nextState)] = (obj[x] || "[]").slice(0, -1) + (char == "\\" || char == "]" ? "\\" : "") + char + "]",
      dfa[accept](state) && (obj.e = ""),
      obj
    ), {})
  ))(dfa[initial]),
  Object.keys(paths).map(removeState => removeState != "s" && (
    obj = paths[removeState],
    selfPath = obj[removeState],
    delete obj[removeState],
    delete paths[removeState],
    Object.keys(paths).map(a => (
      initialPath = paths[a][removeState]) !== {}.x &&
      delete paths[a][removeState] &&
      Object.keys(obj).map(b => (
        path = initialPath + (selfPath ? `(${selfPath})*` : "") + obj[b],
        paths[a][b] = paths[a][b] != {}.x ? `(${paths[a][b]}|${path})` : path
      ))
    )
  )),
  paths.s.e || "[]"
)

console.log(`^${dfaToString(invertDfa(dfa))}$`)

Explanation
The program executes the following process:

Parse the regex into a tree structure
Convert the tree structure into a DFA
Invert the accepted/rejected states of the DFA
Convert the DFA into a (stringified) regex

In the parsed regex tree, the leaves are characters, and the branches are
operations. For example, ^a[bc](d|e*)$ would look like
[2 /* concat */, [
  [2 /* concat */, [
    "a",
    [3 /* character group */, [
      "b",
      "c",
    ]],
  ]],
  [1 /* union */, [
    "d",
    [0 /* star */, [
      "e",
    ]],
  ]],
]]

A DFA is represented as a 3-tuple:
[
  initial /* state */,
  accept /* state => bool */,
  next /* state => char => bool */,
]

States are numbers or deep arrays of numbers.
To convert this parsed regex into a DFA, the tree is processed bottom-up. Single
characters and character groups become 3-state DFAs (start, accept, and dead).
Operations compose their DFA operands in various ways; for example, union tracks
the state of each operand, and accepts any state where one of the operands is
accepting.
The DFA is then inverted by negating the accept function.
To convert the inverted DFA into a regex, it is encoded into a JS object that
represents a (state, state) -> string. Each string will be a regex that
accepts the set of strings that will move the DFA from one state to another.
Initially, the strings are simply character classes containing all of the
characters between the two states in the DFA. This is what the object would
look like initially for the regex ^[ab]$, if the alphabet was limited to
abc.
{
  s: { 0: "" },
  0: { 1: "[ab]", 2: "[c]" },
  1: { e: "", 2: "[abc]" },
  2: { 2: "[abc]" },
}

The special keys s and e represent the start and end, respectively. In this
case, the state 2 is a dead state, where no progress can be made. The leaf
values are referred to "arrows"; for example, the 01 arrow goes from 0 to
1 and has a regex of [ab]. Any non-existent arrows have a regex of [], a
regex that matches nothing.
This object now needs to be distilled to a singular regex. Then, each of the
states is removed iteratively. When removing states, the arrows associated with
those states must be combined with the other regexes.
If there are states A and B (not necessarily distinct), and a state X which is
being removed, arrow AB will be upserted to be
<AB>|<AX><XX>*<XB>

Note that:

If there is no XX arrow, the AB arrow will become <AB>|<AX><XB>,
as []* is equivalent to () (the regex that matches the empty string).
If there is no AB arrow, there will be a new arrow that is
<AX><XX>*<XB>.
If there is no AX arrow or no XB arrow, the AB arrow will
be unchanged.

Thus, the object evolves as follows:
// Original
{
  s: { 0: "" },
  0: { 1: "[ab]", 2: "[c]" },
  1: { e: "", 2: "[abc]" },
  2: { 2: "[abc]" },
}

// After removing 0
{
  s: { 1: "[ab]", 2: "[c]" },
  1: { e: "", 2: "[abc]" },
  2: { 2: "[abc]" },
}

// After removing 0 and 1
{
  s: { e: "[ab]", 2: "[c]|[ab][abc]" },
  2: { 2: "[abc]" },
}

// Final
{
  s: { e: "[ab]" },
}

In the end, the object will be { s: { e: <regex> } } or { s: {} }. If it's
the latter, there was no path from s to e, so the final regex is [].
Interestingly, this process is far from lossless; running a regex through
without inverting it often still explodes the size:
Input: ^a[bc](d|e*)$
Output (not inverted): ^((([a][bc]|[a][bc][d])|[a][bc][e])|[a][bc][e][e]([e])*)$

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Make two programs communicate with each other
Task:
Your task is to create two programs in different languages that can communicate one-way to each other. Your sending (tx) program will take input, for either stdin or a query, and send it along to the receiving (rx) program. Your rx program will then print out the data that it receives.
Rules:

The two programs must communicate one way from the tx to the rx side, so anything typed in tx will appear in rx.
They will be running on the same computer, in different shells/windows.
They will be running in separate instances, and you are not allowed to chain them (in bash, prog1 | prog2)
The programs must be written in different languages.
They can use any data transfer method, but you must be able to transfer ASCII text.
This is a popularity-contest, so the most up voted answer wins.

Note to voters: look for creativity!

Don't give up on this one! I like the idea, but it needs some more specific instructions.

@TheDoctor - Perhaps specify what type of data should be sent between or some other restriction to make it more difficult.  Another option would be to specify environmental constraints (no HTTP interface)

Bash and GNU Awk communicating on TCP
Bash transmitter:
cat>/dev/tcp/localhost/8080

GNU Awk receiver:
BEGIN{getline<"/inet/tcp/8080/0/0";print}

Sample run:
Bash in terminal 1:
bash-4.2$ cat>/dev/tcp/localhost/8080
Bash says hello to Awk
^D

GNU Awk in terminal 2:
bash-4.2$ gawk 'BEGIN{getline<"/inet/tcp/8080/0/0";print}'
Bash says hello to Awk

Both bash and gawk provides special filenames (/dev/tcp/host/port in bash since 2.04, /net-type/protocol/local-port/remote-host/remote-port in gawk since 3.1.0) for simple networking. These are extensions not specified in the POSIX shell and Awk language standards.

Please mention and underline that you are using gawk features probably not present in most other awk implementations. Thanks!

C and PERL communicating via keyboard status lights
My friend and I got inspired by this one last night.
We use Perl for the sender program and C for the receiver.
The medium of exchange was the keybord status lights!
Three virtual signal lines were used: Caps Lock, Num Lock and Scroll lock, being used as Clock, Serial Data, and Start Of Byte signals.

The sender program pulses those keyboard lights and the receiver polls them and checks the state.  Data is sent serially as binary, in 8 bit bytes.
You can see the transmitter and receiver programs in operation, in the attached video, as well as the flashing of the lights during the transmission.
Video of operation
Source for both programs is attached. Given the question requirements, we didn't try to minimize the size like we would in a normal golfing attempt.
C Code (receiver)
#include <X11/Xlib.h>
#include <stdio.h>
#include <unistd.h>

int main(void)
{
    Display* dpy = XOpenDisplay(":0");
    XKeyboardState x;
    char keys_return[32];
    int b = 0;
    while (1) {
        unsigned char output = 0;
        printf(" \b");
        fflush(stdout);
        while (XQueryKeymap(dpy, keys_return)) //wait for start signal
            if (keys_return[9] == 64) {
                break;
            }
        for (b = 0; b < 8; b++) {
            do {
                XGetKeyboardControl(dpy, &x);
            } while (!(x.led_mask & 1)); //wait for clock to be high
            if (x.led_mask & 2)
                output |= 128;
            if (b != 7)
                output >>= 1;
            do {
                XGetKeyboardControl(dpy, &x);
            } while ((x.led_mask & 1)); //wait for clock to be low
        }
        printf("%c", output);
    }
    XCloseDisplay(dpy);
    return 0;
}

PERL code (transmitter)
use X11::Xlib ':all';
use strict;
use warnings;
use feature 'say';
use Time::HiRes qw(sleep);

use constant {
    DATA  => 77,
    START => 78,
    CLOCK => 66
};

my $display = X11::Xlib->new;

sub transmit_str {
    my ($str) = @_;
    foreach my $char ( split( //, $str ) ) {
        my $ordchar = ord($char);
        for my $i ( 0 .. 7 ) {
            for my $j ( 0 .. 1 ) {
                if ( $i == 0 ) {
                    $display->fake_key( START, !($j) );
                }
                if ( $ordchar & 1 ) {
                    $display->fake_key( DATA, 1 );
                    $display->fake_key( DATA, 0 );
                }
                $display->flush;
                sleep(0.025) if(!$j);
                $display->fake_key( CLOCK, 1 );
                $display->fake_key( CLOCK, 0 );
                $display->flush;
                sleep(0.05);
            }
            $ordchar >>= 1;
        }
    }
}
while ( my $stdin = <STDIN> ) {
    transmit_str($stdin);
}

Original Lisp Eliza communicating with yes
Original Eliza lisp code "communicating" with  with unix yes utility.
First create a FIFO special file:
mkfifo in

Then we make the two programs communicate together (which means that the patient will answer YES to all questions).
clisp coselleliza1969and1972.lisp < in | tee out.txt | yes 'yes.'  > in

Output is inifnite and starts with:
TELL ME YOUR PROBLEMS. PLEASE TERMINATE INPUT WITH A PERIOD OR A QUESTION MARK.
IS THERE SOMETHING BOTHERING YOU?
WHY ARE YOU SO SURE?
I SEE.
I UNDERSTAND.
CAN YOU BE MORE INFORMATIVE?
WHY ARE YOU SO SURE?
I SEE.
I UNDERSTAND.
PERHAPS YOU'D RATHER TALK ABOUT SOMETHING ELSE.

More variety if it communicates with another instance of itself:
clisp coselleliza1969and1972.lisp < in | clisp coselleliza1969and1972.lisp | tee out.txt > in

Output starts with:
TELL ME YOUR PROBLEMS. PLEASE TERMINATE INPUT WITH A PERIOD OR A QUESTION MARK.
WHY ARE YOU CONCERNED OVER MY PROBLEMS?
I AM NOT SURE I UNDERSTAND YOU FULLY.
SUPPOSE * WHY WERE NOT I CONCERNED OVER YOUR PROBLEMS.
IS IT BECAUSE YOU ARE NOT SURE YOU UNDERSTAND I FULLY THAT YOU CAME TO ME?
YOU SAY YOU CONCERNED OVER MY PROBLEMS?
POSSIBLY THAT IS FOR THE BETTER.
SUPPOSE YOU SAY I CONCERNED OVER YOUR PROBLEMS.
POSSIBLY * POSSIBLY THAT REALLY IS NOT FOR THE BETTER.
OH? I SAY YOU CONCERNED OVER MY PROBLEMS?
WHAT IF REALLY WERE FOR THE BETTER?
PLEASE GO ON.
CAN YOU ELABORATE ON THAT?
WHAT DOES THAT SUGGEST TO YOU?
TELL ME MORE ABOUT YOUR PROBLEMS.
WHAT MAKES YOU THINK I ELABORATE ON THAT?
PERHAPS THAT CONCERNS YOUR PROBLEMS.
WHAT ABOUT YOUR OWN PROBLEMS?
WHO ARE YOU REALLY TALKING ABOUT?
YOU DON'T SEEM QUITE CERTAIN.
EARLIER YOU SAID YOU WERE NOT SURE YOU UNDERSTAND I FULLY.
TELL ME MORE ABOUT * WHO.
SUPPOSE YOU DON'T SEEM QUITE CERTAIN.
OH? I SAID I WAS NOT SURE I UNDERSTAND YOU FULLY?
ARE YOU STILL NOT SURE YOU UNDERSTAND I FULLY?
WHAT MAKES YOU THINK I DON'T SEEM QUITE CERTAIN?
WOULD YOU LIKE TO DISCUSS YOUR PROBLEMS?
DO YOU SAY YOU SAID YOU WAS NOT SURE YOU UNDERSTAND I FULLY FOR SOME SPECIAL REASON?
DID YOU THINK * MIGHT NOT BE I STILL NOT SURE I UNDERSTAND YOU FULLY?
WHO ARE YOU REALLY TALKING ABOUT?
SUPPOSE YOU LIKE TO DISCUSS MY PROBLEMS.
OH? I SAY I SAID I WAS NOT SURE I UNDERSTAND YOU FULLY FOR SOME SPECIAL REASON?
WHAT MAKES YOU THINK I THINK * MIGHT NOT BE YOU STILL NOT SURE YOU UNDERSTAND I FULLY?
* WHO PERHAPS ARE I REALLY TALKING ABOUT.
WHO ARE YOU REALLY TALKING ABOUT?
WHAT ELSE WOULD YOU LIKE TO DISCUSS?
TELL ME MORE ABOUT YOURSELF?
SUPPOSE YOU THINK YOU THINK * MIGHT NOT BE I STILL NOT SURE I UNDERSTAND YOU FULLY.
WHY THE UNCERTAIN TONE?
SUPPOSE * WHO WERE NOT I REALLY TALKING ABOUT.
OH? I LIKE TO DISCUSS?
WHY DO YOU SAY THAT JUST NOW?
WHAT MAKES YOU THINK I THINK I THINK * MIGHT NOT BE YOU STILL NOT SURE YOU UNDERSTAND I FULLY?
I AM NOT SURE I UNDERSTAND YOU FULLY.
OH? YOU REALLY TALKING ABOUT?
PLEASE GO ON.
WHAT ELSE DO YOU LIKE?
WHO ARE YOU REALLY TALKING ABOUT?
SUPPOSE YOU THINK YOU THINK YOU THINK * MIGHT NOT BE I STILL NOT SURE I UNDERSTAND YOU FULLY.
HOW LONG HAVE YOU BEEN NOT SURE YOU UNDERSTAND I FULLY?
DID YOU TELL ME YOU WERE NOT SURE YOU UNDERSTAND I FULLY?
OH? I REALLY TALKING ABOUT?
MAYBE NOW WE CAN DISCUSS WHY YOU ARE NOT SURE YOU UNDERSTAND I FULLY.
WHAT MAKES YOU THINK I LIKE?
POSSIBLY * WHO REALLY ARE NOT I REALLY TALKING ABOUT.
WHO ARE YOU REALLY TALKING ABOUT?
SUPPOSE YOU BEEN NOT SURE I UNDERSTAND YOU FULLY.
OH? I TELL YOU I WAS NOT SURE I UNDERSTAND YOU FULLY?
WOULD YOU LIKE TO DISCUSS YOUR PROBLEMS?
THAT'S QUITE INTERESTING.

Not exactly what I was asking for

Our custom is to tag submissions that are not your own work as community wiki. That being said, even though it's not really a true answer to the specs, this is hilarious and awesome! Now I'm curious to see what happens if you get Racter and Eliza talking to one another.

A (very short) dialogue between Racter and Eliza can be found here: http://www.stanford.edu/group/SHR/4-2/text/dialogues.html (you need to scroll down quite a bit).

PHP + Bash
Bash - rx.sh
#!/bin/bash
tail -f output

PHP - tx.php
<?php
$fd=fopen("output", "w");
$msg = print_r($_GET, true);
fputs($fd, $msg);
fclose($fd);
?>

Query the program with rx.php?<message>  or alternately, using a third language,
query.html
<body>
Enter the message to send:
<form action="tx.php" method="get">
<input type="text" name="message">
<input type="submit" value="Submit">
</form>
</body>

Perl and Rebol via ps (process status)
tx.pl
use strict;
use warnings;

my $line;

while (chomp(my $msg = <>)) {
    $line++;
    $0 = "!!$line!!$msg";
    last if $msg eq 'q';
}

rx.reb
Rebol []

get-ps-msg: has [ps msg] [
    ps: copy ""
    call/output "ps" ps
    parse ps [thru "!!" copy msg to #"^/"]
    msg
]

print-msg: func [m /no-warning] [
    unless no-warning [print-warning? m]
    print next next find last m "!!"
]

print-warning?: func [m /local prev new] [
    prev: first back back tail m
    new:  last m
    prev: to-integer copy/part prev find prev "!!"
    new:  to-integer copy/part new  find new  "!!"
    if new != (prev + 1) [print ["WARNING: Out of sequence, expected" prev + 1 "but got" new]]
]

messages: []                     ; state: records all messages
until [not none? m: get-ps-msg]  ; lets wait until first msg appears
print-msg/no-warning append messages m

; loop until messages disappear from ps
until [
    if m != last messages [print-msg append messages m]
    none? m: get-ps-msg
]

So whats going on here?  Well if you start tx.pl and then look at ps in another session you will see something like this:
$ ps
  PID TTY           TIME CMD
32171 ttys001    0:00.02 -bash
32432 ttys001    0:00.01 perl tx.pl

Perl allows you to amend what appears in the CMD (Command) column of ps by amending the $0 variable.  So for e.g. if tx.pl was this:
$0 = "hello mum!";
sleep 10;

Then you'll see this in ps while the script is still running:
$ ps
  PID TTY           TIME CMD
32171 ttys001    0:00.02 -bash
32433 ttys001    0:00.01 hello mum!

So we can use this to send messages from one script to another.  The Rebol receiving script simply monitors ps for all messages sent to ps from the Perl script.
NB. The Rebol script does contain some extra bits that aren't really necessary (see warnings & recording all messages).
Usage: Do perl tx.pl and rebol -qws rx.reb in separate sessions and everything you type into transmitting session will appear in the receiving session.  Once the transmitting session is closed (enter 'q' or ^C) then the receiving script automatically quits.
Tested on Mac OSX 10.7.   Requires Rebol 2 at this moment because call/output not currently implemented in Rebol 3.

sh tx with awk rx connected by a fifo
tx in sh... make a fifo, read user input and send it to fifo, remove fifo.
Run this in one terminal, enter a line and start the receiver in a different terminal.
(yeti@aurora:4)~$ mkfifo F ; read X ; echo $X > F ; rm F
xyzzy

rx in awk ... read fifo, print line and terminate.
(yeti@aurora:5)~$ awk '1' F
xyzzy

A direct connection of tx and rx by a pipe would be shorter but far less interesting.
The fifo would allow tx and rx to be run by different UIDs if the fifo's permissions are set to alow read by others.

q and k
Receiver, rx.q, in q
\p 29010

Transmitter, tx.k, in k
.z.pi:{`::29010(-1;x)};

Shell script and not-quite-HTML
Sending code:
#!/bin/sh
cat >> ~/receiver.html

Receiving code - must be located at ~/receiver.html:
<meta http-equiv="Refresh" content="1">

Inspired choice of rx language!

C++
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
    char input[100];
    cin>>input;
    ofstream inputfile("temp.txt");
    inputfile<<input;
    inputfile.close();
    return 0;
}

C++11
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
    char output[100];
    ifstream outputfile("temp.txt");
    outputfile>>output;
    inputfile.close();
    cout<<output;
    return 0;
}

They communicate through a text file. In C++ code the input is written in a text file and is then collected by C++11 code.
But, C++ is a subset of C++11
If the asker feels cheated please comment I'll delete this answer! sorry :P

I see different versions of the same language, especially if they don't differ that much as the same language. Should be a standard loophole. Nicely found anyway :)

Since C++11 differs from C++89/C++03 quite substantially, one might say they can be considered different languages. However this doesn't use any of the new C++11 features. It is equivalent to writing code in the C subset of C++ (which also has already happened here on codegolf.SE). Therefore the standard loophole would more be to use the language-X-subset of language Y (where here X=C++, Y=C++11). Another such pair, unrelated to C or C++, would be Pascal and Object Pascal.

Prolog and PHP
Tx: writer.pl
start :-
    open('file', write, Str),
    read(In),
    write(Str,In),
    nl(Str),
    close(Str).

Rx: reader.php
<?php
echo file_get_contents('file');

Usage:
$ gprolog
['writer.pl'].
start.
hello.

And then:
$ php reader.php

VBS and Python
communicating over microphone and speakers in cleartext
Works astonishingly well out of the box
transmit
CreateObject("sapi.spvoice").Speak WScript.Arguments.Item(0)

receive
import speech_recognition as sr

r = sr.Recognizer()
m = sr.Microphone()

try:
    while True:
        print("listening")
        with m as source: audio = r.listen(source)
        try:
            value = r.recognize_google(audio)
            print("repeating: " + value)
        except sr.UnknownValueError:
            print("¯\_(ツ)_/¯")
except KeyboardInterrupt:
    pass

(this is 90% straight from the quickstart examples, might as well just run python -m speech_recognition)