text:
Draw the Warm Welcome Secret Hat
Winter Bash 2014 is on its prime and don't we all love the hats? Especially the secret hats!
So why not draw one of secret hats?
The challenge
Your task is to draw the Warm Welcome Hat in proportion, in a language of your choice and having an exact construction as appearing on this page.
As always, you can render the hat to a file or screen using vector or raster graphics. If your output is rasterised, your image must have dimensions of 400x400 pixels or more.
Moreover, the actual contents of the hat (the area of the bounding rectangle of the colored parts of the image) should cover more than 40% of your output image.
Specifications
The image below lists out various dimensions of the hat. All dimensions are in the unit, for example, pixels. All border radius in the image are to be drawn with a radius of 13 units.

Colors:

Red in the star and circular ring - rgb(255, 28, 34)
Yellow in the circle - rgb(255, 202, 87)
Lightest grey - rgb(88, 88, 92)
Darkest grey - rgb(31, 26, 26)
Middle grey - rgb(64, 64, 64)

Scoring
This is code golf, so the shortest answer (in bytes) wins.
As a word of warning, using existing compression (like embedding a compressed GIF) falls into several standard loopholes.

About the suggested edit: I chose to reject. I see the image displaying correctly as it is.

GolfScript (376 373 364 350 or 645 610 607 bytes)
Following the original specification, which called for the exact construction of the SVG, a golfed SVG is generated in 607 bytes.
Code contains lots of non-printing characters, so here's the xxd output:
0000000: 221a c837 cde6 0c0c 4658 5786 cead ca66  "..7....FXW....f
0000010: 3507 d130 1577 4657 4067 df6b 97e7 510f  5..0.wFW@g.k..Q.
0000020: cbb0 e3e5 77c6 a91d d830 fa92 eea0 d447  ....w....0.....G
0000030: 7721 cc59 3f4c 230b e0bb fd3e ecf3 d4f7  w!.Y?L#....>....
0000040: 2c6b abd5 b1e5 939d 68b4 e89e 39ca a259  ,k......h...9..Y
0000050: b934 ef6f 203a 7abf 1a2c b468 3351 4c53  .4.o :z..,.h3QLS
0000060: c056 9a59 f38c a97e cf82 8840 ee7c 43e4  .V.Y...~...@.|C.
0000070: 123f df1a 00d4 542d a29c 0195 3ad5 4af4  .?....T-....:.J.
0000080: c644 57c7 0b6b 4d4f 908b 8cf7 c8e2 536d  .DW..kMO......Sm
0000090: 9d36 1139 1406 5c5c dcbc 3a11 1993 63a6  .6.9..\\..:...c.
00000a0: 4f8b 7b62 de77 5158 a485 dec1 87b4 1d11  O.{b.wQX........
00000b0: 01b1 e49d 8adb 0b29 ad44 93e4 7bbd 027e  .......).D..{..~
00000c0: 7a6f 60ca 99f4 6ab3 7bc0 63c3 ba70 1220  zo`...j.{.c..p.
00000d0: 1aea 9206 da5a 95ce 6f70 67f8 856e 8807  .....Z..opg..n..
00000e0: adec e533 0c1e 3dc6 96e5 54d4 2837 4497  ...3..=...T.(7D.
00000f0: f5ea 2135 d261 9c02 fa61 c12a 7180 085a  ..!5.a...a.*q..Z
0000100: a5b8 e3d6 68cb 0659 f4ad d01d 5fc4 9e5b  ....h..Y...._..[
0000110: d030 46d5 96c4 439f da99 2cb1 52b9 5d53  .0F...C...,.R.]S
0000120: 098e 7598 2785 a962 a40d edbd 18cb e46c  ..u.'..b.......l
0000130: 6edb ba9f 17be 36ab ef23 0caf 3ce8 352d  n.....6..#..<.5-
0000140: fad5 762b a388 ca17 413f 7dac 6dd1 116e  ..v+....A?}.m..n
0000150: b2e8 9cd1 d00a dda1 716d a148 acc7 8749  ........qm.H...I
0000160: f2c3 a7a9 8128 02e9 d83c f350 7a02 74ec  .....(...<.Pz.t.
0000170: 6270 6089 a16d 7bfa b6dd e56a 366a d85b  bp`..m{....j6j.[
0000180: 33e5 b777 05c1 6f4e f06b ca95 3ffc 49f7  3..w..oN.k..?.I.
0000190: 1a08 6bc5 abb0 c745 e439 b87e b81c 52c8  ..k....E.9.~..R.
00001a0: a445 935e 5c5c 00d3 34de c002 721c b69d  .E.^\\..4...r...
00001b0: 16ee aab0 9562 4d44 44ed 0193 13a7 eed2  .....bMDD.......
00001c0: 99e4 6350 a756 c21a 980b 6bca 57f9 8443  ..cP.V....k.W..C
00001d0: eecc 9fd1 05ce 78c4 f95f dc90 8926 6eb4  ......x.._...&n.
00001e0: 88b8 7b90 44be 33c3 cc2a b032 d809 17d0  ..{.D.3..*.2....
00001f0: 7e32 c4c9 e37f ceb3 b1e0 b634 a690 8163  ~2.........4...c
0000200: cd34 e3d9 9768 3e13 ac10 5003 1cb7 af6b  .4...h>...P....k
0000210: 863f cba0 9896 e50a d029 8e2b 584c d86f  .?.......).+XL.o
0000220: 67a7 120e 318a cb22 3235 3662 6173 6520  g...1.."256base
0000230: 3132 3462 6173 655b 305d 2f28 3332 2c7b  124base[0]/(32,{
0000240: 5c5b 3124 295d 2f5c 3224 3d2a 7d2f 5c2c  \[1$)]/\2$=*}/\,
0000250: 297b 2d2e 3634 3e33 322a 2b7d 2b25 2b    ){-.64>32*+}+%+

It's a variant on the constructive grammar engine which followers of kolmogorov-complexity will be familiar with:
'MAGIC STRING'256base 124base[0]/(40,{\[1$)]/\2$=*}/\,){-.64>32*+}+%+

It turned out to be slightly better to upper-case the golfed SVG, compress that, and then lower-case after decompression.
When run it produces an 840-byte SVG:
<svg width="192" height="192"><g transform="translate(-19.356 39.823) scale(.11435537421402706)"><path d="m873 126c-28-56-97-79-153-50l-361 182c-40 20-63 60-62 102v369c0 63 51 114 114 114h1198c63 0 114-51 114-114v-369c1-62-22-82-62-102l-361-182c-56-29-125-6-153 50c-28 56-6 124 49 152h-372c55-28 77-96 49-152z" fill="#231f20"/><path d="m1642 812c0 60-49 109-109 109h-1047c-60 0-109-49-109-109v-435c0-60 49-109 109-109h96.557636322653a530 274 0 0 1 854.884727354693 0h96.557636322653c60 0 109 49 109 109v435z" fill="#424143"/><path d="m1561 826c0 52-42 95-95 95h-912c-52 0-95-42-95-95v-463c0-52 42-95 95-95h912c52 0 95 42 95 95v463z" fill="#595a5c"/><circle cy="594" cx="1010" r="199" fill="#f9c960" stroke="#ec2227" stroke-width="42"/><path d="m1063 615l85-62-105 0-33-100-33 100-105 0 85 62-32 100 85-62 85 62z" fill="#ec2227"/></g></svg>

I've tweaked the position by a few millipixels and corrected one small asymmetry in the darkest grey part.

But the changes to the question and discussion in chat indicate that it's actually permissible to create a good approximation to the SVG, which can be done in 364 bytes. The decompression chain is similar, so the xxd output of the GolfScript file is:
0000000: 2710 9f1d b7bb 6ca9 ad60 1325 b869 45a6  '.....l..`.%.iE.
0000010: 9371 2eee 1271 1dac 0244 9ca3 2820 e6be  .q...q...D..( ..
0000020: b038 68e4 4e53 bbe9 7809 a67a 5f02 2f14  .8h.NS..x..z_./.
0000030: 66a1 0cb3 648c 76d4 0450 028d fd32 b81f  f...d.v..P...2..
0000040: 351a d449 bba8 e685 4de8 1fc0 abfd 8b9f  5..I....M.......
0000050: d9d9 33cd 16e9 5c27 b7a0 dc0f 4138 a2ca  ..3...\'....A8..
0000060: 2b45 a2c2 571e 7e1e 1030 dcfd b48e 377b  +E..W.~..0....7{
0000070: 112e 7762 d14c 1fed 0bcb 15b4 c383 f828  ..wb.L.........(
0000080: b317 8c9f 890b ce84 7782 4c10 fc8e 7602  ........w.L...v.
0000090: 9fef 9563 fe30 45b0 7144 30b3 f3c5 fa22  ...c.0E.qD0...."
00000a0: ccae 8a08 c506 466b 6b84 317e 62dd a558  ......Fkk.1~b..X
00000b0: 8423 d8ef 9d67 e807 0d23 847d 4dab 68ff  .#...g...#.}M.h.
00000c0: 952b ca20 14d3 0881 2880 6611 eb53 10c6  .+. ....(.f..S..
00000d0: 0058 573f 3c87 957c 8512 59ff 94f3 ae38  .XW?<..|..Y....8
00000e0: 4145 bf8d 4123 6e84 aa62 904d a878 0bca  AE..A#n..b.M.x..
00000f0: 854b deaa 32ae 70fc b31a 9578 676a df8a  .K..2.p....xgj..
0000100: 7310 ecfc 47d2 5dde 1a8c 3898 943b ede3  s...G.]...8..;..
0000110: d0a2 55a4 eb00 b623 0302 d79c a712 b616  ..U....#........
0000120: 5037 dc2d 0dad 2732 3536 6261 7365 2031  P7.-..'256base 1
0000130: 3133 6261 7365 5b30 5d2f 2832 312c 7b5c  13base[0]/(21,{\
0000140: 5b31 2429 5d2f 5c32 243d 2a7d 2f5c 2c29  [1$)]/\2$=*}/\,)
0000150: 7b2d 2e36 343e 3332 2a2b 7d2b 252b       {-.64>32*+}+%+

and generates a 547-byte SVG file:
<svg width="1426" height="858"><path d="m475 114-361.5 182v370h1199v-370l-361.5-182" stroke="#231f20" stroke-linecap="round" stroke-linejoin="round" stroke-width="227"/><ellipse cx="713" cy="367" rx="530" ry="274" fill="#424143"/><rect x="80" y="205" width="1266" height="653" rx="109" ry="109" fill="#424143"/><rect x="161" y="205" width="1103" height="653" rx="95" ry="95" fill="#595a5c"/><circle cx="713" cy="531" r="199" fill="#f9c960" stroke="#ec2227" stroke-width="42"/><path d="m713 390 85 262-223-162 276 0-223 162z" fill="#ec2227"/></svg>

Thanks to Paul LeBeau for pointing out a 7-byte saving in the SVG which translated to 9 bytes in the GolfScript, and for his answer which demonstrated that the star can be drawn with just the 5 points. (Using his answer I could get down to 329 bytes, or 323 with some tweaking to his answer, but I'm not comfortable with that).
Exported at 50% with Inkscape:

To see the structure, here's the SVG rendered with fill="none" on everything and some fill colours changed to stroke colours:

@Optimizer, but unlike the JS one it is almost pixel-perfect. Other than golfing it, the only difference to the original SVG is that it fixes an asymmetry. If I relax it in the style of Martin's marked-up image, I can probably save a lot.

The "" and "" are not necessary, so you should be able to save a bit more.

@PaulLeBeau, very true, thanks.

SVG (462 460 454 429 384 365 bytes)
I know it isn't a programming language, but I thought this will at least be useful to anyone generating SVG output...
This is based on Peter Taylor's SVG.
By using the original coords, and optimizing the paths a little, I managed to shrink the SVG down.  I also fixed the colours.

<svg><g stroke-linecap=round stroke-linejoin=round stroke-width=26><path d=M54,13,13,36V75H151V36L110,13 stroke=#1f1a1a /><path d=M21,84V36H37A91,91,0,0,1,127,36h16V84z stroke=#404040 /><path d=M30,36v48h104V36z stroke=#58585c fill=#58585c /></g><circle cx=82 cy=60 r=23 fill=#ffca57 stroke=#ff1c22 stroke-width=5 /><path d=M82,43,92,74,66,55H98L72,74z fill=#ff1c22

Update: Fixed flaw pointed out by Peter Taylor and position of rects and saved 2 more bytes.
Update 2: Incorporated another fix and suggestions from Peter (-6 bytes)
Update 3: Just noticed the instructions now specify all radii are 13, so taking advantage of that, and optimizing the paths a bit more, I saved another 25 bytes. More readable fiddle here.
Update 4: Since I am already assuming the SVG is embedded in HTML (standalone SVGs need the namespace declaration), I can actually squeeze this more. (a) I don't need the  width and height attributes because the size of the SVG is smaller than the default size browsers give to objects whose size is indeteminate (300x150), and (b) the HTML parser is forgiving about attributes which don't have quotes, so some of them can be removed (idea from Squeamish Ossifrage).  Saves another 45 bytes.
Update 5: Using hsl's tricks for de-quoting the colours and dropping the trailing end tags.  We saved another 19 bytes.  The latter seemed a bit cheaty to me at first, but since it works in all browsers, I changed my mind. :)  Thanks hsl!

Some nice ideas, but there's one pretty bad flaw. The mid-grey doesn't come high enough to cover the fill of the dark grey. I'm not sure whether this is best fixed by adding fill="none" to the group or by adjusting the curve.

Well spotted, thanks. Fixed now.  I wasn't using the right arc radius because I forgot to subtract half the stroke width.

The <rect> should have height 74 rather than 78. And I make it a 5-char saving to replace it with a <path> with both fill and stroke, stroke-width="18", then moved inside the <g> and the common stroke-width="18" moved from two paths to the <g>. Having another <path> rather than a <rect> should also help the compressibility a tiny bit.

Thanks.  There seems to be a difference between the radii (8 vs 9), which is why I had them different.  But it's not absolutely clear, so having both as 9 is barely noticeable anyway.

Radii are specified as 13 I see, so I have updated the SVG.

I just knew Snippets would be used for something amazing. I was not disappointed. :P

Your left-top middle-grey curve is not meeting up with light grey-curve correctly

Thanks Optimizer. Fixed. No change to size.

I'll personally award bounty to this answer if it can beat the current minimum score of 350. (of course using the same approach. I want the svg in the answer to be golfed further)

I think I've pretty much reached the limit now.  I definitely don't thing I'm going to find another 35 bytes. :)

100 rep not enough of a reason to push your limits ? ;)

I got it to 365 by removing quotes around the colors and getting rid of /></svg> at the end.

Hmm.. which browser did you test on?  FF, Chrome and IE all require the quotes for the colour attributes, which is why I didn't remove them.

Can you use this to reduce 404040 to 444?

It worked on Chrome as long as you add a space before the end of the tag, e.g. stroke="#1f1a1a"/> becomes stroke=#1f1a1a />.

@feersum Three digit colours are treated as a special case. #444 is equivalent to #444444.  Although it is very close, I was trying to keep the colours and coords as accurate as posible.

Mathematica 787 612 600 514 506 bytes
Surprising amount of code needed. Will surely be beaten.
Ungolfed form
red=RGBColor[1.,.11,.13]
yellow=RGBColor[1.,.79,.34]
lightGrey=RGBColor[.35,.35,.36]
midGrey=RGBColor[.25,.25,.25]
r=RoundingRadius->8;
pentagonalVertices[offset_]:=Table[{Cos[2π k/5+ offset],Sin[2π k/5+offset]},{k,0,5}];
x=63;x2=72;
y=37;
pts={{e=22,50},{h=72,30},{h,-17},{-h,-15},{-h,30},{-e,50}};
pts2={{-h,-15},{-h,30},{-e,50}}
Graphics[{
{Black,Thickness[.13],JoinForm["Round"],CapForm["Round"], Line[pts]},
midGrey,Rectangle[{-x2,-y},{x2,y},r],
Disk[{0,-55},104,{Pi/3,2Pi/3}],
White,Rectangle[{-40,-60},{40,0},r],
lightGrey,Rectangle[{-x,-y},{x,y},r],
red,Disk[{0,0},25],yellow,Disk[{0,0},19.5],red,
GraphicsComplex[16.7 pentagonalVertices[Pi/2],Polygon[{1,3,5,2,4}]],
GraphicsComplex[6.4 pentagonalVertices[3 Pi/2],Polygon[{1,2,3,4,5}]]}]

Golfed
g=GraphicsComplex;c=RGBColor;d=c[1.,.11,.13];o="Round";k=Rectangle;j=Disk;n=Polygon;r=RoundingRadius->8;w@s_:=Table[{Cos[2\[Pi]k/5+s],Sin[2\[Pi]k/5+s]},{k,0,5}];x=63;i=72;y=37;p={{e=22,50},{h=72,30},{h,-17},{-h,-15},{-h,30},{-e,50}};Graphics[{Thickness[.13],JoinForm@o,CapForm@o,Line@p,c[.25,.25,.25],k[{-i,-y},{i,y},r],j[{0,-55},104,{\[Pi]/3,2\[Pi]/3}],White,k[{-40,-60},{40,0},r],c[.35,.35,.36],k[{-x,-y},{x,y},r],d,j[{0,0},25],c[1.,.79,.34],j[{0,0},19.5],d,g[16.7w[\[Pi]/2],n[{1,3,5,2,4}]],g[6.4w[3\[Pi]/2],n[{1,2,3,4,5}]]}]

Can I ask how you count the bytes? (I'm new here) I get 651 bytes when counting your golfed version with this site: https://mothereff.in/byte-counter

I use an automatic counter app used by Wolfram to evaluate the length of submissions to the one-liner contest (http://blog.wolfram.com/2014/11/10/announcing-the-winners-of-the-2014-one-liner-competition/).  It does not count optional spaces included for readability. It actually reads the no, of characters, not bytes, but I assume one char=one byte.

Makes sense! Too bad I can't do the same for my submission :) Thank you for the answer.

I suppose you could see it that way. But that leaves a very difficult-to-read display on a single line.  I prefer to keep it legible.

HTML + ES6, 533
<canvas id=D width=600 height=400><script>c=D.getContext('2d')
S=x=>c.strokeStyle=F(x)
F=x=>c.fillStyle=x
W=x=>c.lineWidth=x
B=x=>c.stroke()||c.fill()||c.beginPath()
G='s.charCodeAt(i++)*9-300,'
L=s=>B()||eval('for(i in s)i%2||c.lineTo('+G+G+'0)')&&B()
c.lineCap=c.lineJoin='round'
W(60)
S('#1F1A1A')
L(';,+3+BXBX3H,')
S('#404040')
L('.3.EUEU3.3')
c.arc(291,390,270,4,5.2,0)
B()
S('#58585C')
L('131ERER313')
S(R='#FF1C22')
F('#FFCA57')
W(30)
c.arc(291,240,69,0,7,0)
B()
c.font='105px serif'
S(R)
c.fillText('\u2605',239,276)</script>

Snippet (modified):

<canvas style="margin:-40px 0 0 100px;height:250px;" id=D width=600 height=400><script>stages=[function(){c=D.getContext('2d');S=function(x){return c.strokeStyle=F(x)};F=function(x){return c.fillStyle=x};W=function(x){return c.lineWidth=x};B=function(x){return c.stroke()||c.fill()||c.beginPath()};G='s.charCodeAt(i++)*9-300,';L=function(s){return B()||eval('for(i in s)i%2||c.lineTo('+G+G+'0)')&&B()}},function(){c.lineCap=c.lineJoin='round';W(60);S('#1F1A1A');L(';,+3+BXBX3H,')},function(){S('#404040');L('.3.EUEU3.3')},function(){c.arc(291,390,270,4,5.2,0);B()},function(){S('#58585C');L('131ERER313')},function(){S(R='#FF1C22');F('#FFCA57');W(30);c.arc(291,240,69,0,7,0);B()},function(){c.font='105px serif';S(R);c.fillText('\u2605',239,276)}];next=function(i){stages[i]();if(i<6)setTimeout(next,1000,i+1)};next(0)</script>

@Optimizer I've added an image, since it looks fine for me in both FF and Chrome. The font must be different on Windows or something.

@grc I think you can't rely on certain fonts being readily available on all systems; especially not if you use serif, which isn't even a specific font...

In Arial Unicode MS (the Windows Arial font which actually has the codepoint) that codepoint doesn't even have the right shape. The points have a narrower base.

HTML + CSS, 676 636 625 bytes
This can be golfed a lot, by getting rid of those left:XXXpx and using some sort of centering Now using transforms to center everything instead of left:XXXpx.

*{left:50%;transform:translate(-50%);position:absolute;border-radius:13px;height:75px}a,b,f{width:145px;background:#404040}b{width:126px;background:#58585C}c{width:163px;height:61px;top:50px}d,e{width:68px;height:40px;top:-15px}c,d,e{background:#1F1A1A}d{left:0;transform:skew(0deg,-26deg);border-radius:9px 24px}e{left:96px;transform:skew(0deg,26deg);border-radius:24px 9px}f{height:40px;width:99px;top:-13px;border-radius:150px/60px}g{height:34px;width:34px;background:#FFCA57;border:5px solid #FF1C22;border-radius:40px;top:13px;color:#FF1C22;font-size:1cm;line-height:31px;padding:3px}
<c><d></d><e></e><f></f><a><b><g>★

Note: This works best/as expected in Firefox on Windows
End result looks like:

I've never seen golfed HTML tags. Interesting.

@ArturoTorresSánchez Then you need to see this

The star now looks a bit shifted to the left and the top on FF 34.0/Windows

ActionScript 3.0, 491 bytes
Golfed form:
var h=new Shape(),g=h.graphics,l=g.lineTo,m=g.moveTo,s=g.lineStyle,b=g.beginFill,e=g.endFill,r=g.drawRoundRect;s(23,0x231F20);m(77,18);l(41,36);l(41,73);m(125,18);l(161,36);l(161,73);s();b(0x424143);g.drawEllipse(48,16,106,55);e();b(0x424143);r(38,27,126,65,23,23);e();b(0x595A5C);r(46,27,110,65,17,17);e();s(4.2,0xEC2227);b(0xF9C960);g.drawCircle(101,59,20);e();s();b(0xEC2227);m(106,61);l(115,55);l(104,55);l(101,45);l(98,55);l(87,55);l(96,61);l(93,71);l(101,65);l(110,71);e();addChild(h);

Output: http://megaswf.com/file/2708781.swf

Or: var ww=new WarmWelcome(); stage.addChild(ww); and draw it in Flash with AS3 linkage :)

MATLAB R2013a, 551 541
This is my first Code Golf. So if anything is not according to the rules, please teach/tell me :)
Golfed form:
hold on
r=[1 .11 .13];h=[];b=2.4;q=-37;o='Curvature';p='Position'
x='FaceColor';z='EdgeColor';v=@rectangle;t=@repmat;s=@set
for i=1:19;h=[h v(p,[-82+b*i -32+i 22 73]) v(p,[60-b*i -32+i 22 73])];end
s(h,o,1,x,[.12 .1 .1])
c=.8:.01:2.2
h=[h fill(104*cos(c),104*sin(c)-52,t(.25,1,3))]
h=[h v(p,[-72 q 144 74],o,.1,x,t(.25,1,3))]
a=v(p,[-63 q 126 74])
a=[a v(p,[-63 q 126 74])]
s(a,o,.1,x,[t(.35,1,2) .36])
v(p,[-20 -20 40 40],o,1,x,[1 .79 .34],z,r,'LineWidth',10)
plot(0,0,'rp',['Marker' x],r,'MarkerSize',58.5)
s([a h],z,'none')
axis equal off

Output (rasterized):

LaTeX/TikZ (613 bytes)
\RequirePackage{xcolor,tikz}\RequirePackage[active,tightpage]{preview}\PreviewMacro[[!]\tikz\def~#1{\definecolor#1{HTML}}~1{EC2227}~2{F9C960}~3{595A5C}~4{231F20}~5{424143}\def\r{rounded
corners}\def\R{radius}\tikz[x=1pt,y=1pt]{\def~{\fill[}\draw[4,line
width=22.8,line
cap=round,line
join=round](-23.8,41.7)--(-59.9,23.5)--(-59.9,-13.3)--(59.9,-13.3)--(59.9,23.5)--(23.8,41.7);~5,x
\R=53,y
\R=27.4](0,16.4)circle;~5,\r=10.9](-63,-32.65)rectangle(63,32.65);~3,\r=9.5](-55.1,-32.65)rectangle(55.1,32.65);~1,\R=22](0,0)circle;~2,\R=17.8](0,0)circle;~1](90:14.1)\foreach\!in{0,...,4}{--(90+\!*144:14.1)}--cycle;}\stop

The result of pdflatex is a PDF file with the hat as vector graphics and a tight bounding box.

Ungolfed
\documentclass{minimal}
% Package xcolor provides color model HTML
% in order to take the exact same values, used in the SVG file
\usepackage{xcolor}
\usepackage{tikz}

% Package preview is used to get a correct bounding
% box for the graphics
\usepackage[active,tightpage]{preview}
\PreviewEnvironment[{[]}]{tikzpicture}

% Color definitions. one digit instead of a name saves many bytes
\definecolor1{HTML}{EC2227}
\definecolor2{HTML}{F9C960}
\definecolor3{HTML}{595A5C}
\definecolor4{HTML}{231F20}
\definecolor5{HTML}{424143}

\begin{document}
  \begin{tikzpicture}[x=1pt,y=1pt]
    % Draws the dark lines in the background
    \draw[4,line width=22.8,line cap=round,line join=round]
    (-23.8,41.7)--(-59.9,23.5)--(-59.9,-13.3)
    --(59.9,-13.3)--(59.9,23.5)--(23.8,41.7);
    % Draws the ellipsis
    \fill[5,x radius=53,y radius=27.4](0,16.4)circle;
    % Draw the rear rectangle
    \fill[5,rounded corners=10.9](-63,-32.65)rectangle(63,32.65);
    % Draws the rectangle in the foreground
    \fill[3,rounded corners=9.5](-55.1,-32.65)rectangle(55.1,32.65);
    % Draws the red full circle
    \fill[1,radius=22](0,0)circle;
    % Draws the inner yellow circle
    \fill[2,radius=17.8](0,0)circle;
    % Draw the star
    \fill[1](90:14.1)\foreach\!in{0,...,4}{--(90+\!*144:14.1)}--cycle;
  \end{tikzpicture}%
\end{document}

The values are taken from the SVG file, they were more accurate (but it also
contains rounding errors). The trickiest part was the dark slanted lines in the background. They are drawn as very thick line with rounded line caps and joins.

What a beauty :)

Perl + TK: 555
The new lines are only for readability, although I got lost of so many variables.
use Tk;@w=(-width=>13);$c=tkinit->Canvas->pack;
$c->createPolygon($a=131,$b=163,168,150,$a,$b,$e=269,$b,232,150,$e,$b,$e,$d=225,$a,$d,-outline=>"#1f1a1a",@w);
$c->createPolygon(137,$f=169,263,$f,263,$g=231,137,$g,-outline=>$h="#".40x3,@w);
$c->createOval($a,147,$e,$g,-fill=>$h,-outline=>$h);
$c->createPolygon(143,$f,257,$f,257,$g,143,$g,-fill=>$l="#58585c",-outline=>$l,@w);
$c->createOval(175,175,$d,$d,-width=>5,-fill=>"#ffca57",-outline=>$r="#ff1c22");
$c->createPolygon((map{200+($_%2?17:6)*sin.628*$_,200+($_%2?17:6)*cos.628*$_}0..11),-fill=>$r);
MainLoop

Here's a picture:

I don't think it's near pixel perfect, but it's close enough :)

authors: n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳


text:
Squarefinder – Locating regular tetragons
Imagine a bunch of rectangles drawn in the plane, each rectangle with its vertices at integer coordinates and its sides parallel to the axes:

The rectangles partition the plane into a number of disjoint regions, coloured red and blue below:

Your goal is to find the number of such regions which are perfect squares. In the example above, there are three:

Note that the big square in the middle is not counted as it is not a single region, but is instead made up of several smaller disjoint regions.
Input
You may write a function or a full program for this challenge.
Input will be 4n nonnegative integers defining n rectangles in the plane. Each rectangle is represented by two opposing vertices, e.g. 4 9 7 8 represents the rectangle with opposing vertices (4, 9) and (7, 8). Note that this rectangle could also be represented as 7 8 4 9 or 4 8 7 9.
The exact input format is flexible (e.g. space-separated string, comma-separated string, single array of integers, list of coordinate tuples, and so on) but please be reasonable and give an example of how to run your code in your post. You may not reorder the input.
For simplicity, you can assume that no two edges will be overlapping — this includes overlapping at a vertex. In particular, this implies that no two rectangles will be touching edge-to-edge or corner-to-corner, and the rectangles will have nonzero area.
Output
Your program should print or return a single integer, which is the number of square regions.
Scoring
This is code golf, so the code in the fewest bytes wins.

Test cases
Input:
0 0 5 5
6 8 10 4
14 16 11 13
19 1 18 2

Output:
4

This is simply four disjoint squares:

Input:
2 1 3 11
1 10 5 19
6 10 11 3
8 8 15 15
13 13 9 5
15 1 19 7
17 19 19 17

Output:
3

This is the example test case at the start of the post.

Input:
0 9 15 12
6 3 18 15
9 6 12 20
13 4 17 8

Output:
7

Input:
5 9 11 10
5 12 11 13
6 8 7 14
9 8 10 14
13 8 14 9
13 10 14 14

Output:
14

Input:
0 99999 100000 0

Output:
0

This is just one big rectangle.

Input:
0 99999 100000 0
2 1 142857 285714

Output:
1

Two big rectangles which overlap.

SQL (POSTGIS), 286 269 261 240 226 218 216
This is a query for the PostGIS extension to PostgreSQL.
I haven't counted the input values in the total.
SELECT SUM(1)FROM(SELECT(ST_Dump(ST_Polygonize(g))).geom d FROM(SELECT ST_Union(ST_Boundary(ST_MakeEnvelope(a,b,c,d)))g FROM(VALUES
-- Coordinate input
(2, 1, 3, 11)
,(1, 10, 5, 19)
,(6, 10, 11, 3)
,(8, 8, 15, 15)
,(13, 13, 9, 5)
,(15, 1, 19, 7)
,(17, 19, 19, 17)
)i(a,b,c,d))i)a WHERE(ST_XMax(d)-ST_XMin(d))^2+(ST_YMax(d)-ST_YMin(d))^2=ST_Area(d)*2

Explanation
The query builds geometries for each coordinate pair.  Unions the exterior rings to properly node the lines. Turns the results into polygons and tests the width against height and the area doubled against the sum of each side squared.
It will run as a standalone query on any PostgreSQL database with the PostGIS Extension.
Edit Found a couple more.

... and Haskell

@optimizer I doubt it will last :)

@MickyT This has turned into a healthy competition. :)

@zgarb it has a bit:-) but I don't think I got anything else to go.

Python 2, 480 436 386 352 bytes
exec u"""s=sorted;H=[];V=[]
FRIinput():
 S=2*map(s,zip(*R))
 FiI0,1,2,3:
    c=S[i][i/2];a,b=S[~i]
    FeIs(H):
     C,(A,B)=e
     if a<C<b&A<c<B:e[:]=C,(A,c);H+=[C,(c,B)],;V+=[c,(a,C)],;a=C
    V+=[c,(a,b)],;H,V=V,H
print sum(a==A==(d,D)&c==C==(b,B)&B-b==D-d&1-any(d<X[0]<D&b<y<B Fy,XIH)Fb,aIH FB,AIH Fd,cIV FD,CIV)""".translate({70:u"for ",73:u" in ",38:u" and "})

Takes a list of coordinate pairs through STDIN in the format:
[  [(x, y), (x, y)],  [(x, y), (x, y)],  ...  ]

and prints the result to STDOUT.

The actual program, after string replacement, is:
s=sorted;H=[];V=[]
for R in input():
 S=2*map(s,zip(*R))
 for i in 0,1,2,3:
    c=S[i][i/2];a,b=S[~i]
    for e in s(H):
     C,(A,B)=e
     if a<C<b and A<c<B:e[:]=C,(A,c);H+=[C,(c,B)],;V+=[c,(a,C)],;a=C
    V+=[c,(a,b)],;H,V=V,H
print sum(a==A==(d,D) and c==C==(b,B) and B-b==D-d and 1-any(d<X[0]<D and b<y<B for y,X in H)for b,a in H for B,A in H for d,c in V for D,C in V)

Explanation
Instead of fiddling with complex polygons, this program deals with simple line segments.
For each input rectangle, we add each of its four edges to a collective segment list, individually.
Adding a segment to the list goes as follows:
we test each of the existing segments for intersection with the new segment;
if we find an intersection, we divide both segments at the point of intersection and continue.
To make things easier, we actually keep two separate segment lists: a horizonal one and a vertical one.
Since segments don't overlap, horizontal segments can only intersect vertical segments and vice versa.
Better yet, it means that all intersections (not considering the edges of the same rectangle) are "proper," i.e., we don't have T-shaped intersections, so "both sides" of each segment are truly divided.
Once we've constructed the segment list(s), we start counting squares.
For each combination of four segments (particularly, two horizontal segments and two vertical ones,) we test if they form a square.
Furthermore, we verify that no vertex lies within this square (which can happen if, for example, we have a small square inside a bigger one.)
This gives us the desired quantity. Note that even though the program tests each combination four times in different orders, the particular ordering of the segment coordinates guarantees that we count each square only once.

I'm pretty impressed by how quickly you solved this and the way you approached the problem! The for loops make me go "surely something can be done..."

@Sp3000 Yeah. I tried using itertools for the loops but it ended up being longer. I can shave a few bytes with exec + string replacements, but nothing too exciting.

Haskell, 276 266 250 237 225 222 217 bytes
It keeps getting shorter... and more obfuscated.
(x#i)l=mapM id[[min x i..max x i-1],l]
(y!j)l f=and[p l==p(f[y,j])|p<-map elem$f[y..j]]
s[h,v]=sum[1|[x,j]<-h,[y,i]<-v,x<i,i-x==j-y,(y!j)h$x#i,(x!i)v$y#j]
n=s.foldr(\(x,y,i,j)->zipWith(++)[x#i$[y,j],y#j$[x,i]])[[],[]]

Evaluate n [(0,0,5,5),(6,8,10,4),(14,16,11,13),(19,1,18,2)] for the first test case. I think I'm getting close to the limits of golfing this algorithm on Haskell.
This function is so slow (at least O(n3) where n is the total perimeter of all rectangles in the input) that I cannot evaluate it on the last two test cases. When I compiled it with optimizations turned on and run it on the 400-times shrunk version [(0,249,250,0),(2,1,357,714)] of the last test, it finished in a little over 12 seconds. Based on this, the actual test case would finish in about 25 years.
Explanation (partial, I will expand this when I have time)
We first build two lists h and v as follows. For each rectangle in the input, we split its border into segments of length 1. The west endpoints of horizontal segments are stored in h, and the south endpoints of vertical segments in v, as lists [x,y] of length 2. The coordinates in v are stored in a reversed form as [y,x] for golfing reasons. Then we just loop over both lists and search for horizontal edge [x,j] and vertical edge [i,y] such that x < i and i-x == j-y (so they are the northwest and southeast corners of a square), and check that the borders of the square are in the correct lists h and v, while the interior coordinates are not. The number of the positive instances of the search is the output.

Well done, I think I'll have to concede now:)

@MickyT It's been a week so I've accepted Zgarb's answer for now, but if you manage to beat it later the check mark might move! Honestly I'm very impressed at how far you two managed to go

@Zgarb well deserved win:-)

@Sp3000 thanks for a nice little challenge.

@Sp3000 Thanks! I had much fun golfing this.

source: Stack Exchange

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

sort: votes


text:
Find the last Sunday in every month of a given year
F# solutions known inside 140 chars, and this is a Rosetta Code problem.
Required result on stdout or in a string variable for input year 2014:
2014-01-26 2014-02-23 2014-03-30 2014-04-27 2014-05-25 2014-06-29 2014-07-27 2014-08-31 2014-09-28 2014-10-26 2014-11-30 2014-12-28

As it was requested, for 1900:
1900-01-28 1900-02-25 1900-03-25 1900-04-29 1900-05-27 1900-06-24 1900-07-29 1900-08-26 1900-09-30 1900-10-28 1900-11-25 1900-12-30

And 2000:
2000-01-30 2000-02-27 2000-03-26 2000-04-30 2000-05-28 2000-06-25 2000-07-30 2000-08-27 2000-09-24 2000-10-29 2000-11-26 2000-12-31

Posed because dates seem to bring out awkwardness in most languages. More than permitting date libraries, I hope to see them! But if external to the base language, declare in the name of the post (e.g. C# + Jon Skeet's NodaTime).
Clarifications:

Year range 1900 to 3015
Gregorian calendar
If it otherwise matters, whatever is conventional for UK/London.
A program taking a commandline switch or stdin is fine, producing the result to stdout
A function taking a value for the year and returning a string is also fine.

Standard loopholes excluded. Looking forward to the APL, J, K solutions, and seeing some new date libraries.

@Sp3000 - 1752 could be particularly awkward :-)

@MartinBüttner: Please do use date libraries, have edited the question to ask people to declare those they use with the language.

You should specify the range of years which are valid input, and considerations about Gregorian adoption. (I.e. if the range of years includes any before 1930 then you should specify either that the Gregorian calendar should be used for the entire range, regardless of locale; or that the output can vary by locale; or you should give a cutoff date before which the Julian calendar should be used and test cases for the three years around the changeover).

@MartinBüttner: leading zeroes are there in the example output, so yes please.

@squeamishossifrage: I've limited it to 1900 and Gregorian, because I'd rather avoid a research project to establish the spec...

I didn't see the requirement, so before I just go ahead with it: Do the dates need to be in ascending order or can they be from Dec 31->Jan 1 for the given year? :)

@PhilH Sorry for letting you wait so long for your desired answer. Is it too late to get a check-mark?

@Adám: Sorry to make you wait so long for a reply :) Yes indeed.

Dyalog APL with cal  from dfns, 19 bytes
Better late than never!
Prompts for year, returns list of dates in yyyy m d format.
⎕{⍺⍵,2↑⊢⌿cal⍺⍵}¨⍳12

⎕ prompt for numeric input and let that be the left argument to the
{ ... }¨ anonymous function (found below) applied to each of
⍳12 the numbers from 1 to 12 (the months)
The above anonymous function is as follows:
⍺⍵, prepend the left and right arguments (i.e. year and month) to
2↑ the first two characters of
⊢⌿ the bottom-most row of
cal the calendar for
⍺⍵ left argument and right argument (year and month)
TryAPL online:

Return to this page after clicking here to import cal and its dependencies.

Click here to run the test cases.

Very good. Had hoped for an APL library that understood what the dates mean, but cal is reasonable!

@PhilH date and days?

@PhilH There's also the Dates namespace from MiServer.

@PhilH And Dyalog APL's dyadic primitives + - < ≤ = ≥ ≠ ⌈ and ⌊ work with .Net date objects.

Ruby, 91+6=97
#!ruby -prdate
$_=(Date.new(y=$_.to_i)...Date.new(y+1)).select(&:sunday?).chunk(&:mon).map{|k,v|v[-1]}*' '

Works out pretty well. select(&:sunday?) is pretty, and surprisingly, *' ' does all of the formatting by itself.

Nice tricks! You can save three more chars by using chunk instead of group_by.

So I can, nice.

Bash 4.x + ncal, 57
If newline separators are OK instead of spaces, then we can remove the -n switch and trailing space from the echo statement. And I guess it will still work without the shebang, so I removed that too:
for i in {01..12};{ echo "$1-$i-`ncal $i $1|tail -c-3`";}

Original script (73 bytes):
#!/bin/bash
for i in {01..12};{ echo -n "$1-$i-`ncal $i $1|tail -c-3` ";}

Usage:
$ bash sundays.sh 2014
2014-01-26
2014-02-23
2014-03-30
2014-04-27
2014-05-25
2014-06-29
2014-07-27
2014-08-31
2014-09-28
2014-10-26
2014-11-30
2014-12-28
$

Note: Bash versions prior to 4.0 will omit the leading zeroes from the months. This can be fixed with the addition of 5 characters by changing {01..12} to `seq -w 1 12)`. Also, tail -c-3 might cause problems on some systems where the output of ncal includes trailing spaces, but I'm not aware of any that do.

Is the difference really related to Darwin, not just the Bash version? Was added in Bash 4.0 (though there were some bugs in it later). Anyway, 1 character can still be spared by using \…`instead of good habit$(…)`.

Ah, could be. Darwin says it's using version 3.2.53; Debian is using 4.1.5.

@manatwork P.S. Just noticed your comment about the back-ticks. Good catch, thanks!

I don't think you need to count the #!/bin/bash for the purposes of golfing.

@DigitalTrauma That's good. It looks like I can use line breaks instead of spaces too. Down to 57 bytes now :-)

IBM DFSORT, 11 3 lines of 71, 72 or 80 characters
 OPTION COPY
 OUTFIL REPEAT=12,OVERLAY=(5:SEQNUM,2,ZD,5,2,1,8,Y4T,LASTDAYM,TOJUL=Y4T*
 ,9,7,Y4T,ADDDAYS,+1,TOJUL=Y4T,1:16,7,Y4T,PREVDSUN,TOGREG=Y4T(-),12X)

The two answers with columnar output format have stood the test of time. That gives me a "loop", sort of, in that on OUTFIL REPEAT= copies the current record that many times.
Different technique to get to the value, which seems longer but is shorter as I can't work out any unconditional way to deal with the 12th record being in the following year, and making it conditional means including IFTHEN=(WHEN=, twice, and some other stuff. Gain on the swings (first of month is simplest way to do it) lose heavily on the roundabouts (particular syntax requirements).
This uses an inbuilt function (all functions in DFSORT are inbuilt) to find the last day of the month. Then adds one day (function) to get to first of following month and uses the PREVDSUN function to get the previous Sunday (which will always be the last Sunday in the previous month, as before).
When turning the year (input) into a valid date, a two-digit sequence number is used for the month, and that value is copied for the day as well, since the starting point does not matter as long as valid, as we are after the last day of the month initially: 5,2 is shorter than C'01'.
Here's the detail:
OPTION COPY - copy input file to output
OUTFIL - to allow multiple output files, with different selection and formatting, produce formatted reports. Used in preference to the shorter INREC because of the use of REPEAT=.
REPEAT=12 - produce 12 copies of each record. In this example, there can be only one input record (unlike the previous version) because of the SEQNUM.
5: - start at column 5 on the record.
SEQNUM,2,ZD - sequence number, defaults to start at one, two digits, "zoned decimal" (for unsigned, which they will be, same as character).
1,8 - copy bytes 1 for length 8 to current location (9). This is because the Y4T need to see that 8, else a different date format will be used.
Y4T - ccyymmdd-format date (due to the 8 immediately in front of it).
LASTDAYM - Last day of Month (also possible of Week, Quarter and Year).
TOJUL= - output date-conversion for date functions (TOJUL is one character less than TOGREG)
9,7 - now that it is 7 long, Y4T is going to be CCYYDDD.
ADDDAYS - adds a number of days, adjusting automatically if goes into following month/year (could also be ADDMONS and ADDYEARS)
PREVDSUN - the Julian date comes in, previous Sunday is located, TOGREG to get the correct output format, with the "-" seperator (could be anything you like as separator)
12X - blanks to clear up the mess which has allowed us to do it in such a short way
The output from the above, for 2014, is:
2014-01-26
2014-02-23
2014-03-30
2014-04-27
2014-05-25
2014-06-29
2014-07-27
2014-08-31
2014-09-28
2014-10-26
2014-11-23
2014-12-28

Something is required to tell the SORT what to do. There is no default. OPTION COPY is the shortest, SORT FIELDS=COPY is equivalent but longer.
The work itself it done this time in OUTFIL (to allow the use of REPEAT). The working code is arguably any of 160 (2 * 80), 144 (2 * 72), 140 (72 + 69), or 138 (70 + 68) (excluding the leading blanks, forced continuation and trailing blanks).
Given that the receiver would have to know what they are doing, I think I can say that the DFSORT code to list the last Sunday of each month for any year from 1900 (will run from year 0001, but I'm avoiding the research as well) up to 9999 (although DFSORT supports years up to 9999, previous solution would not work in year 9999 since the 12th date goes into the following year) can be Tweeted.
Why is the code so long, if there are especially apt inbuilt-functions?
Field-definitions are ephemeral. A field is only defined as a particular location within the data (which is a record) for its immediate use. To put it another way, fields are not defined as such, but are defined for each use and only for use. Date functions need to know which (of many) formats of date are used for the source, and the output must be in a date format, so that has to be specified.
Now that we have a Julian date.... TBC?

 OPTION COPY
 INREC OVERLAY=(1,4,C'0201',1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8*
 ,94:C'1',89:1,4,ZD,ADD,+1,ZD,LENGTH=4,14:C'3',22:C'4',30:C'5',38:C'6',*
 46:C'7',54:C'8',62:C'9',69:C'10',77:C'11',85:C'12',127:X,89,8,Y4T,PREV*
 DSUN,TOGREG=Y4T(-),116:X,81,8,Y4T,PREVDSUN,TOGREG=Y4T(-),105:X,73,8,Y4*
 T,PREVDSUN,TOGREG=Y4T(-),94:X,65,8,Y4T,PREVDSUN,TOGREG=Y4T(-),83:X,57,*
 8,Y4T,PREVDSUN,TOGREG=Y4T(-),72:X,49,8,Y4T,PREVDSUN,TOGREG=Y4T(-),61:X*
 ,41,8,Y4T,PREVDSUN,TOGREG=Y4T(-),50:X,33,8,Y4T,PREVDSUN,TOGREG=Y4T(-),*
 39:X,25,8,Y4T,PREVDSUN,TOGREG=Y4T(-),28:X,17,8,Y4T,PREVDSUN,TOGREG=Y4T*
 (-),17:X,09,8,Y4T,PREVDSUN,TOGREG=Y4T(-),1:1,8,Y4T,PREVDSUN,TOGREG=Y4T*
 (-),11:X,18,120,6X)

Needs some JCL
//LASTSUNG EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *

And an input file (another line of JCL and three instream items of data):
//SORTIN DD *
2014
1900
2000

Produces:
2014-01-26 2014-02-23 2014-03-30 2014-04-27 2014-05-25 2014-06-29 2014-07-27 2014-08-31 2014-09-28 2014-10-26 2014-11-30 2014-12-28
1900-01-28 1900-02-25 1900-03-25 1900-04-29 1900-05-27 1900-06-24 1900-07-29 1900-08-26 1900-09-30 1900-10-28 1900-11-25 1900-12-30
2000-01-30 2000-02-27 2000-03-26 2000-04-30 2000-05-28 2000-06-25 2000-07-30 2000-08-27 2000-09-24 2000-10-29 2000-11-26 2000-12-31

Will actually work up to the year 9999.
DFSORT is IBM's Mainframe sorting product. Data can be manipulated, but since sorting is key and sorts are often large and long-running, the DFSORT control cards have no looping constructs, so we can't put a SORT into a loop. Makes things a bit long-winded for tasks like Golf.
Why to post the answer, is because DFSORT has a PREVDday function. So last Sunday in a month is easy. It is the Sunday previous (PREVDSUN) to the first day of the following month.
It was also fun to do it within one "operand" (OVERLAY), a bit like doing it all within sprintf or similar.
Here it is ungolfed:
 OPTION COPY

 INREC OVERLAY=(1,4,C'0201',1,8,1,8,1,8,1,8,1,8,1,8,
         1,8,1,8,1,8,1,8,
         1,8,94:C'1',89:1,4,ZD,ADD,+1,ZD,LENGTH=4,
         14:C'3',22:C'4',30:C'5',38:C'6',46:C'7',54:C'8',
         62:C'9',69:C'10',77:C'11',85:C'12',
        127:X,89,8,Y4T,PREVDSUN,TOGREG=Y4T(-),
        116:X,81,8,Y4T,PREVDSUN,TOGREG=Y4T(-),
        105:X,73,8,Y4T,PREVDSUN,TOGREG=Y4T(-),
         94:X,65,8,Y4T,PREVDSUN,TOGREG=Y4T(-),
         83:X,57,8,Y4T,PREVDSUN,TOGREG=Y4T(-),
         72:X,49,8,Y4T,PREVDSUN,TOGREG=Y4T(-),
         61:X,41,8,Y4T,PREVDSUN,TOGREG=Y4T(-),
         50:X,33,8,Y4T,PREVDSUN,TOGREG=Y4T(-),
         39:X,25,8,Y4T,PREVDSUN,TOGREG=Y4T(-),
         28:X,17,8,Y4T,PREVDSUN,TOGREG=Y4T(-),
         17:X,09,8,Y4T,PREVDSUN,TOGREG=Y4T(-),
          1:1,8,Y4T,PREVDSUN,TOGREG=Y4T(-),
         11:X,18,120,6X)

Whilst not quite abuse, it wouldn't be usual to attempt to cram all this into one OVERLAY, and there is some seemingly unnecessary stuff which is needed to allow it all to go into one OVERLAY. There is some room for golfing, but since it would only remove one line at most, I'm not tempted.
The INREC is processed for each record.
OVERLAY allows the content of an existing record to be changed. If the record is extended beyond its length in the process, that is not a problem.
1,4 is the year coming in. It has a literal of 0201 appended to it, and then the successive 1,8s repeat it 11 times to give one long chuck of 96 bytes,
The 12th year on the extended current record gets 1 added to it, and its month made to 1 (January).
The remaining 10 months are changed to 3 through 11.
Then there are 12, in reverse order (due to OVERLAY) of these type of thing:
127:X,89,8,Y4T,PREVDSUN,TOGREG=Y4T(-),

The n: is a column-number on the record. The X inserts a blank. 89,8 takes the data from that column/length, Y4T treats it as a CCYYMMDD date, PREVDSUM works out the previous Sunday,TOGREG=Y4T(-) outputs it as a Gregorian CCYY-MM-DD date.
Because you get rubbish if the source and target of a particular part of an OVERLAY overlap destructively, the final 11:X,18,120,6X) rearranges and masks a bit of mess.
Manuals and papers can be found at: http://www-01.ibm.com/support/docview.wss?uid=isg3T7000080, and includes the 900+ page DFSORT Application Programming Guide.
As with all IBM products all manuals are available for free (except an excruciatingly small amount of very expensive ones which only a very small number of people in the world would even pretend to understand).
All DFSORT Control Cards must start with a blank. Column 72 is only used for continuation (any non-blank will do, but * is conventional). Column 72 is followed by a sequence number area which is ignored, making the each record 80 bytes.
Another couple of solutions to come, maybe.

Bash, 63 bytes
for i in {01..12};{  date -v30d -v${i}m  -v2014y  -vsun +%Y-%m-%d;}

Output:
2014-01-26
2014-02-23
2014-03-30
2014-04-27
2014-05-25
2014-06-29
2014-07-27
2014-08-24
2014-09-28
2014-10-26
2014-11-30
2014-12-28

for i in {1..12};{ date -v30d -v${i}m -v$1y -v0w +%Y-%m-%d;} - 60 bytes

-v param to date is specific to BSD date.  So this works on OSX, but not on most Linux - perhaps that should be stated in the answer.

@DigitalTrauma , works on mac and my Linux.

Python 2 - 189 bytes
y=input()
for m in range(12):
 d=[31-(1322>>m&1),28+(y%400<1or 1>y%4<y%100)][m==1];Y=y-(m<2);Z=Y%100;C=Y/100
 while(d+13*((m-2)%12+4)/5+Z+Z/4+C/4-2*C)%7-1:d-=1
 print"%d-%02d-%d"%(y,m+1,d),

Enter the date via STDIN.
Still a lot more golfing that can be done. The program goes a little overboard, just for fun:

No imports, in particular not using any built-in date functions
Uses Zeller's congruence for calculating days of the week

Notes

1322 is a magic lookup table for determining whether a non-February month has 30 or 31 days
No zfill is needed for years due to the input range, nor days as they will always be over 20

Python 2 - 106 bytes
The not-as-fun solution:
from calendar import*
y=input();m=1
while m<13:w,n=monthrange(y,m);print"%d-%02d-%d"%(y,m,n-(n+w)%7),;m+=1

calendar.monthrange returns two numbers: the weekday the month starts on (w) and the number of days in the month (n). The solution is a little counterintuitive due to a catch — the weekday returned starts at 0 for Monday, not Sunday! However, this is offset by the fact that n is 1-based.

A very silly Pyth answer: $from calendar import monthrange as gt$V12AGH>QhN%"%d-%02d-%d"(QhN-H%+GH7

JavaScript, ES6, 222 219 199 bytes
I did not see any JavaScript answer in the rosetta wiki.
Here we go:
S=Y=>{for(l=[],p=new Date(Y,i=0);i<365+!(Y%4);)if(!(d=new Date(Y,0,++i,9)).getDay()){p.getMonth()-d.getMonth()&&l.push(p);p=new Date(d)}return[...l,p].map(x=>x.toISOString().split("T")[0]).join(" ")}

This creates a function S which returns a string with the desired output. the function also takes care of leap years.
Due to ES6, this only works in a latest Firefox.
Thanks to apsillers for the tip which got it reduced to 200 bytes
Find the ungolfed version below as a stack snippet which you can run here itself:

S=Y=>{
  for(l=[],p=new Date(Y,i=0);i<365+!(Y%4);)
    if(!(d=new Date(Y,0,++i,9)).getDay()){
      p.getMonth()-d.getMonth()&&l.push(p);
      p=new Date(d)
    }
  return[...l,p].map(x=>x.toISOString().split("T")[0]).join(" ")
}

alert(S(parseInt(prompt())))

You can use +prompt() rather than parseInt and shave off some bytes

@Jacob That prompt is not added to the byte count.

OIC. I should've read the question...

@apsillers Thanks a tonne! Fixed the issue and reduced it a lot based on your tip.

Input 2100 output 2100-01-31 2100-02-28 2100-03-28 2100-04-25 2100-05-30 2100-06-27 2100-07-25 2100-08-29 2100-09-26 2100-10-31 2100-11-28 2100-12-26 2101-01-02 is wrong.

@Qwertiy Fixed.

Input 2100 output 2099-12-31 2100-01-31 2100-02-28 2100-03-28 2100-04-25 2100-05-30 2100-06-27 2100-07-25 2100-08-29 2100-09-26 2100-10-31 2100-11-28 2100-12-26from the snippet

@BillWoodger I don't get that. I get 2100-01-31 2100-02-28 2100-03-28 2100-04-25 2100-05-30 2100-06-27 2100-07-25 2100-08-29 2100-09-26 2100-10-31 2100-11-28 2100-12-26

I click on Run code snippet, enter 2100 in the box that arrives, and then get the result as previously pasted.

2101 looks OK at a glance. 2500 same as 2100, 2200, 2300, 2400 all OK.

@BillWoodger Must be timezone related. What timezone are you in ?

I'm all WET/GMT

new Date(Y,0,++i,9) - I expect it works only with UTC to UTC+9?

JavaScript (ES6) 155 145
Edit Fixed timezone problems
Could be shorter if made recursive. Maybe.
F=y=>{
  for(n=i=o=[];!o[11];)
    d=new Date(Date.UTC(y,0,++i)),m=d.getMonth(),
    d.getDay()||(m!=n&&o.push(p.toISOString().slice(0,10)),p=d,n=m);
  return o.join(' ')
}

You can use new Date(y,0,++i,9) . Also, this fails for 2100 and above leap years as JS does not have info about those leap years and thus, does not have Feb 29 at all in leap years for 2100 and above.

@Optimizer it's not JS: 2100,2200,2300 are not leap years. 2014 is a leap year and JS knows. As for using hour 9, I can't verify but I think that doesn'to work if you are for instance in Melbourne...

Ah.. Never knew we drop 3 days per 400 yrs. About the 9 - I changed my timezone from -1000 (Hawaii) to +1100 (Melbourne) and new Date(2014,0,26,9) was a Sunday giving correct ISO string as well as getDay() as 0.

Rebol - 120 116 80 79 76
d: do join"1-1-"input print collect[for m 2 13 1[d/2: m keep d - d/weekday]]

Ungolfed + some annotations:
d: do join "1-1-" input         ;; golfy way to create Rebol date! datatype 1-Jan-(year)

print collect [
    for m 2 13 1 [              ;; loop thru months 2 to 13!
        d/2: m                  ;; move to (1st of) next month
        keep d - d/weekday      ;; collect/keep last sunday of month
    ]
]

Example of the sunday calculation in Rebol console:
>> ; get last sunday of Jan 2014

>> d: 1-1-2014
== 1-Jan-2014

>> d/month: d/month + 1
== 2

>> d
== 1-Feb-2014

>> d/weekday
== 6

>> d - d/weekday
== 26-Jan-2014

>> ; above is last sunday of Jan 2014
>> ; and when pass end of year (ie. month 13!)

>> d/month: 13
== 13

>> d
== 1-Jan-2015

Potential 87: d: 1-1-1 d/year: do input print collect[repeat m 12[d/month: m + 1 keep d - d/weekday]]

@rgchris Thanks Chris.  Was able to shave another 7 chars of it to.

Nice!! It's bad, but never really think of FOR as being a shortcut.

CJam, 122 102 bytes
30li:X400%){[1387Yb30f+~28I!I4%!I100%e&|g+\]W%{\_2$>7*-\7%7\m1$+}/}fI;]12/W=12,{101+s1>}%]z{X+W%'-*S}/

This does not use any form of date library. It can be also still be golfed a lot, I think.
Test it here.

I'm so spectacularly stoked that a CJam answer isn't the top answer in a code-golf challenge for once. I can die happy.. Today is a good day (until it's golfed down to 6 bytes, obviously)

@Brandon: That was the kind of reason I thought it would be interesting. Really hoping to see some wondrous library that makes this easy, but disappointed so far.

R, 128 chars
P=paste;f=format;a=strptime(P(1:366,scan()),"%j %Y");cat(sort(sapply(split(a,f(a,"%B")),function(x)P(tail(x[f(x,"%u")==7],1)))))

With line breaks:
P=paste
f=format
a=strptime(P(1:366,scan()),"%j %Y")
cat(sort(sapply(split(a,f(a,"%B")),function(x)P(tail(x[f(x,"%u")==7],1)))))

C# 255
Ungolfed
static void Main(string[] a)
    {
        int y = Int32.Parse(Console.ReadLine());
        DateTime d = new DateTime(y, 1, 1);
        while (d.Year == y)
        {
            if (d.DayOfWeek == DayOfWeek.Sunday && d.Day>(DateTime.DaysInMonth(y,d.Month)-7))
                Console.WriteLine(d.ToShortDateString());
            d = d.AddDays(1);
        }
        Console.ReadKey();
    }

Edit: modified to print only the last Sunday :)

Not the required output format. + This is code golf

"Oh, no, him again!"
Java - 259 246 bytes
void g(int y){for(int i=;i<12;i++){GregorianCalendar c=new GregorianCalendar(y,i,0);c.set(c.DAY_OF_WEEK,c.SUNDAY);c.set(c.DAY_OF_WEEK_IN_MONTH,-1);System.out.print(y+"-"+String.format("%02d",(c.get(c.MONTH)+1))+"-"+(c.get(c.DAY_OF_MONTH))+" ");}}

Ungolfed version:
void g(int y){
    for (int i = 0; i < 12;i++) {
        GregorianCalendar c = new GregorianCalendar(y, i, 0);
        c.set(c.DAY_OF_WEEK, c.SUNDAY);
        c.set(c.DAY_OF_WEEK_IN_MONTH, -1);
        System.out.print(y+"-"+String.format("%02d",(c.get(c.MONTH)+1))+"-"+(c.get(c.DAY_OF_MONTH))+" ");
    }
}

Usage:
import java.util.GregorianCalendar;
import java.util.Scanner;

public class LastSundayInYear {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Year?");
        int year = scanner.nextInt();
        LastSundayInYear sunday = new LastSundayInYear();
        sunday.g(year);
    }

    void g(int y){
        for (int i = -1; ++i < 12;) {
            GregorianCalendar c = new GregorianCalendar(y, i, 0);
            c.set(c.DAY_OF_WEEK, c.SUNDAY);
            c.set(c.DAY_OF_WEEK_IN_MONTH, -1);
            System.out.print(y+"-"+String.format("%02d",(c.get(c.MONTH)+1))+"-"+(c.get(c.DAY_OF_MONTH))+" ");
        }
    }
}

Output:
2014-01-26 2014-02-23 2014-03-30 2014-04-27 2014-05-25 2014-06-29 2014-07-27 2014-08-31 2014-09-28 2014-10-26 2014-11-30 2014-12-28

Yet another "let's put a Java reply just for kicks" answer. Oh well. But, at least, since you bothered to reach this point of my answer, I'll try to bore you some more and explain my reasoning.
The method g receives the desired year and, for each month, creates a GregorianCalendar object (months go from 0 to 11). Then, the first c.set sets the day of the week as a Sunday and the second declares that we want the last week of the month - as seen on the official documentation. The System.out.println prints out the date of that Sunday (if we were doing this right, the year would be printed as c.get(c.YEAR), but using y again shaves off 13 characters), the month has to be formatted to add a leading zero from January to September (and the value is incremented because, well, months in here are represented 0-11) and the day of last Sunday is printed. And this procedure is repeated for the other eleven months.

q, 67
{({{1<>x mod 7}-[;1]/x}')14h$1_til[13]+13h$"D"$(($)x),".01.01"}

Are there no date libraries usable for this in q?

Ruby 76
Uses a commandline parameter ruby sundays.rb 1900. Uses the Date library.
require'date';puts (1..12).map{|m|d=Date.new($*[0].to_i,m,-1);d-d.wday}*" "

C#, 212, 237
string x(int y){var s="";var t="";var d=new DateTime(y,1,1);for(;;){if(d.Year!=y){return s;}t=(d.DayOfWeek==DayOfWeek.Sunday)?t=string.Format("{0}-{1}-{2} ",d.Year,d.Month,d.Day):t;s=(d.AddDays(1).Month!=d.Month)?s+=t:s;d=d.AddDays(1);}}

With line breaks
string x(int y)
    {
        var s = "";
        var t = "";
        var d = new DateTime(y,1,1);
        for (;;)
        {
            if (d.Year != y) {
                return s;
            }
            t = (d.DayOfWeek == DayOfWeek.Sunday) ? t = string.Format("{0}-{1}-{2} ", d.Year, d.Month, d.Day) : t;
            s=(d.AddDays(1).Month!=d.Month)?s+=t:s;
            d=d.AddDays(1);
        }
    }

Output for 2014
"2015-1-25 2015-2-22 2015-3-29 2015-4-26 2015-5-31 2015-6-28 2015-7-26 2015-8-30 2015-9-27 2015-10-25 2015-11-29 2015-12-27"

Not the required output format

There, fixed. Better?

C# 171
Function returning a string.
string S(int y){var r="";for(int m=1;m<13;++m){var d=new System.DateTime(y,1,1).AddMonths(m).AddDays(-1);r+=y+string.Format("-{0:00}-{1} ",m,d.Day-d.DayOfWeek);}return r;}

Ungolfed
string S(int y)
{
    var r="";
    for (int m=1;m<13;++m)
    {
        var d = new System.DateTime(y, 1, 1).AddMonths(m).AddDays(-1);
        r += y + string.Format("-{0:00}-{1} ", m, d.Day - d.DayOfWeek);
    }
    return r;
}

VB-192
Function z(y)
For i = 1 To 11
a = 0
s = IIf(i <> 11, DateSerial(y, i + 1, 1), DateSerial(y + 1, 1, 1))
While Weekday(s - a) <> 1
a = a + 1
Wend
r = r + Str(s - a) + " "
Next
z = r
End Function

Could be worse ^^
My second and last entry (don't think i can get it smaller)
142
Function z(y)
Dim m(12)
For i = 1 To 366
s = DateSerial(y, 1, 1) + i
If Weekday(s) = 1 Then m(Month(s)) = s
Next
z = Join(m, " ")
End Function

C# 194
using Linq:
string d(int y){return string.Join(" ",Enumerable.Range(1,12).Select(m=>new DateTime(y,m,DateTime.DaysInMonth(y,m))).Select(d=>d.AddDays(-(int)d.DayOfWeek)).Select(d=>d.ToString("yyy-MM-dd")));}

Ungolfed
string d(int y)
{
    return string.Join(" ",Enumerable.Range(1,12)
        .Select(m => new DateTime(y, m, DateTime.DaysInMonth(y, m)))
        .Select(d => d.AddDays(-(int)d.DayOfWeek))
        .Select(d => d.ToString("yyy-MM-dd")));
}

Output
2013-01-27 2013-02-24 2013-03-31 2013-04-28 2013-05-26 2013-06-30 2013-07-28 2013-08-25 2013-09-29 2013-10-27 2013-11-24 2013-12-29

Mathematica - 171
Wrapped in an anonymous function, returns the string
StringJoin[Last@#~DateString~{"Year","-","Month","-","Day"," "}&/@GatherBy[Select[DateRange[DateObject[{#}],DateObject[{#+1}]],DayName@#==Sunday&],DateValue[#,"Month"]&]]&

First mathematica golf. I feel like it could be substantially reduced.

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


text:
Draw Sri Yantra
Challenge:
Draw Sri Yantra.
How to:
There are different ways to draw it. All include many steps. If you think you can draw it without following the linked steps scroll below for the elements you must have in your drawing.
Complete steps can be found here:
http://www.saralhindi.com/Shri_Yantra/makingsky14steps_eng.htm
(I didn't copied them here because it would become a very long question, here is archieve.org mirror in case the first link ever goes down)
The final picture should look like the picture below:

Must have:
Basically any method of drawing of your choosing would be a valid answer providing that you keep the most important elements

The number of triangles should the same number as in the above picture (43 smaller triangles resulted from the interlacing of the bigger 9 triangles)
This triple intersections are respected:

The tips of the upward triangles touch the bases of the 4 downward triangles and the tips of downward triangles should touch the bases of the 3 upward triangles as shown in the figure bellow.

The inner circle (bindu) is concentric with the outer circle.
The tips (vertices) of the bigger triangles should touch the outer circle:

The final image should have all the elements and should generally look like:

Color should be roughly the same as the above image for every element (including petals).
The shape of the petals should preferably look roughly like in the image bellow, but can also be just semicircles or simple arc section of circle:
There are no strict proportion restrictions to the circles or the size of the gates, but the most outer circle should have the diameter not less than 90% of the side of the outer square, the other elements would be respectively arranged relative to this proportions.

Programming languages and results
There are no restriction to the programming language nor the format of the result (it can be either a vector image, bitmap image, canvas etc) provided that the result is relatively clear and discernible (at least 800px X 800px)
Latter edit:
There is no perfect method of drawing as this blog so well explores them:
http://fotthewuk.livejournal.com/
Taking that into account minor faults will be tolerated.

At this point it as an interesting exercise to learn that it is very probable that there is no perfect solution, much like squaring of the circle.

I think you'll need to define the colour palette, the relevant length scales of the outer circles and the background and the shape of the petals.

@MartinBüttner I reedited the question, please tell me if the info is better now. Drawing this Yantra is no easy challenge, and laying the specs is a bit challenging too

Hi, I know the spec is very tough on this one. But it is required. My recent similar question was also given a hard time because of spec, so its better you come up with one because without that, this is too hard to draw and practically not a real challenge .

@Optimizer I wish it was that clear as that hat, it will probably close an that's it.

This challenge is crazy.

Your picture does not perfectly match the instructions you linked to.  Notice that your two base line vertices of triangle 5 intersect with the innermost circle.  In the instructions, they do not.  Which, if either, should prevail?

Your coloring pattern is also very different from the one shown on the linked page.

@DavidCarraher The coloring pattern should be of the one of the step 6, the green square, red & yellow petals, idealy there should be no interesaction, only touching, but minimal deviations and errors would be tolerated where they happen

@EduardFlorinescu If you use third party units do you have to count that code to add to your score? Note, this isn't code that creates the picture, it's code that will find the point where lines intersect.

if you use circles, triangles etc, or any other unit as long as you specify where to get that unit, unless it doesn't draw the entire yantra you don't have to add that code to the final score.

Thanks, got it figured out already though ;) And damn.. this is hard, Only got the triangles done and my code is huge already. Optimizing it now xD

@TeunPronk That's the hardest part, kudos

@EduardFlorinescu not sure about that.. not looking forward to those petals haha

Let us continue this discussion in chat.

Indian here, and I see hand-drawn versions of this everywhere (neighborhood grocery shops mostly), so seeing this challenge feels kinda weird :)

This makes more sense as a code challenge.  Just solving the problem by any means seems challenging enough.

@DavidCarraher You are probably right, lets see other people opinion we could do the discussion in the above chat so we don't crowd the comment section here: http://chat.stackexchange.com/rooms/19578/discussion-between-eduard-florinescu-and-teun-pronk

Mathematica - 2836 2536 chars
It was a bit dizzying to figure out the combos of regions that make small triangles available for coloring.
The Frame
The frame objects are inequalities that describe as regions.  E.g. the red and yellow scalloping are two regions of circles.
n1=8;n2=16;
w8=Round[.78 Table[{Cos[2\[Pi] k/n1],Sin[2\[Pi] k/n1]},{k,0,n1-1}],.01];
w16=Round[1 Table[{Cos[2\[Pi] k/n2],Sin[2\[Pi] k/n2]},{k,0,n2-1}],.01];
n=12;y1=.267;
x2=1/Sqrt[2];w=1.8;v=1.85;
pts={{-w,w},{-w/4,w},{-w/4,w+w/8},{-5w/8,w+w/8},{-5w/8,w+5w/24},{5w/8,w+5w/24},{5w/8,w+w/8},{w/4,w+w/8},{w/4,w},
{w,w},{w,w/4},{w+w/8,w/4},{w+w/8,5w/8},{w+5w/24,5w/8},{w+5w/24,-5w/8},{w+w/8,-5w/8},{w+w/8,-w/4},{w,-w/4},
{w,-w},
{w/4,-w},{w/4,-w-w/8},{(5 w)/8,-w-w/8},{(5 w)/8,-w-(5 w)/24},{-((5 w)/8),-w-(5 w)/24},{-((5 w)/8),-w-w/8},{-(w/4),-w-w/8},{-(w/4),-w},{-w,-w},

{-w,-w/4},{-w-w/8,-w/4},{-w-w/8,-5w/8},{-w-5w/24,-5w/8},{-w-5w/24,5w/8},{-w-w/8,5w/8},{-w-w/8,w/4},{-w,w/4}
};

frame=RegionPlot[{
(*MeshRegion[pts2,Polygon[Range[20]]],*) (*orange trim *)
MeshRegion[pts,Polygon[Range[Length[pts]]]], (*green box *)
ImplicitRegion[x^2+y^2<2.8,{x,y}], (*white, largest circle *)
ImplicitRegion[Or@@(((x-#)^2+(y-#2)^2<.1)&@@@w16),{x,y}], (*yellow scallops*)
ImplicitRegion[x^2+y^2<1,{x,y}],(*white circle *)
ImplicitRegion[x^2+y^2<1.4,{x,y}],(*white disk*)
ImplicitRegion[Or@@(((x-#)^2+(y-#2)^2<.15)&@@@w8),{x,y}],(*red scallops*)
ImplicitRegion[x^2+y^2<1,{x,y}] , (*white disk *)
ImplicitRegion[1.8 < x^2+y^2< 2.2,{x,y}] ,(*brown outer rim*)
ImplicitRegion[2.4 < x^2+y^2< 2.8,{x,y}](*yellow outer rim*)},
BoundaryStyle->Directive[Thickness[.005],Black],
AspectRatio->1,
Frame-> False,
PlotStyle->{(*Lighter@Orange,*)
Darker@Green,White,Yellow,White,White,
Red,White,Lighter@Brown,Yellow,Red,
White,White,White,White,White,
White,White,Red,Red,Darker@Blue,
Darker@Blue,Darker@Blue,Darker@Blue,Darker@Blue,Darker@Blue,
Red,Red,Darker@Blue,Red,Yellow,Red}];

Then there is a disk to hide some circles that were used to make the scalloping.
Graphics[{White,Disk[{0,0},.99]}]

The Innards
Some definitions of vertices and triangles.  Each triangle, t1, t2,... is a distinct region.  Logical operations (RegionUnion. RegionIntersection, and RegionDifference) on large triangles are used to define smaller, triangular cells as derived regions that can be individually colored.
p1={-Cos[ArcTan[.267]],y1};
p2={Cos[ArcTan[.267]],y1};
p3={-Cos[ArcTan[.267]],-y1};
p4={Cos[ArcTan[.267]],-y1};
p5={-x2,(x2+y1)/2};
p6={x2,(x2+y1)/2};
p7={-x2,-(x2+y1)/2};
p8={x2,-(x2+y1)/2};
p9={0.5,-x2};
p10={-0.5,-x2};
p11={0.5,-x2};
p12={-0.5,-x2};
p13={a=-.34,b=-.12};
p14={-a,b};
p15={0.5,x2};
p16={-0.5,x2};
t1=MeshRegion[{{0,-1},p1,p2},Triangle[{1,2,3}]];
t2=MeshRegion[{{0,1},p3,p4},Triangle[{1,3,2}]];
t3=MeshRegion[{{0,-x2},p5,p6},Triangle[{1,3,2}]];
t4=MeshRegion[{{0,x2},p7,p8},Triangle[{1,3,2}]];
t5=MeshRegion[{{0,+y1},p9,p10},Triangle[{1,3,2}]];
t6=MeshRegion[{{0,p5[[2]]},p13,p14},Triangle[{1,3,2}]];
t7=MeshRegion[{{0,p13[[2]]},p15,p16},Triangle[{1,3,2}]];
t8=MeshRegion[{{0,p7[[2]]},{-.33,p1[[2]]-.12},{.33,p1[[2]]-.12}},Triangle[{1,3,2}]];
t9=MeshRegion[{{0,p3[[2]]},{z=-.23,0.063},{-z,.063}},Triangle[{1,3,2}]];

disk=Graphics[{White,Disk[{0,0},.99]}];

innards=RegionPlot[{
t1,t2,t3,t4,t5,t6,t7,t8,t9,(*White*)
RegionDifference[t1,RegionUnion[t5,t4,t2]],(*Blue*)
RegionDifference[t4,RegionUnion[t1,t3,t5]],(*red*)
RegionDifference[t3,RegionUnion[t7,t4,t2]], (*blue*)
RegionDifference[t2,RegionUnion[t1,t7,t3]], (*blue*)
RegionDifference[t5,t1],   (*blue*)
RegionDifference[t4,RegionUnion[t1,t7]], (*Blue *)
RegionDifference[t7,t2],(*Blue*)
RegionDifference[t3,RegionUnion[t1,t2]],(*Blue *)
RegionDifference[t8,t2],  (* blue *)
RegionDifference[t9,t5],  (* red *)
RegionDifference[t9,t6],  (* red *)
RegionIntersection[t4,RegionDifference[t6,t1]], (*blue*)
RegionIntersection[t6,RegionDifference[t5,t8]],  (* red *)
RegionIntersection[t7,t9], (*yellow*)
RegionDifference[RegionIntersection[t7,t8],t5], (*red *)
RegionDifference[RegionIntersection[t5,t6],RegionUnion[t7,t9]],(*red *)
ImplicitRegion[x^2+y^2<= .001,{x,y}],  (* smallest circle *) (* red *)
RegionDifference[RegionIntersection[t7,t1 ],t6], (*Red*)
RegionDifference[t8,RegionUnion[t5,t6]],
RegionDifference[t6,RegionUnion[t7,t8]],
RegionDifference[RegionIntersection[t2,t5],RegionUnion[t7,t8]],
RegionDifference[RegionIntersection[t7,t3],t4],
RegionDifference[RegionIntersection[t1,t3],RegionUnion[t5,t4]],
RegionDifference[RegionIntersection[t2,t4],RegionUnion[t7,t3]],
RegionDifference[RegionIntersection[t5,t4],t3]},
BoundaryStyle->Directive[Thickness[.005],Black],
AspectRatio->1,
PlotStyle->{
White,White,White,White,White,White,White,White,White,
Blue,Red,Red,Blue,Blue,Blue,Blue,Blue,Blue,
Red,Red,Blue,Red,Yellow,Red,Red,Red,Blue,Blue,Blue,Blue,Red,Red,Red,Red}]

Putting the parts together
Show[frame,disk,innards,Graphics[{Brown,Thickness[.02],Line[Append[pts,{-w,w}]]}];
Graphics[{RGBColor[0.92,0.8,0.],Thickness[.015],Line[Append[pts,{-w,w}]]}]]

Golfed
r=ImplicitRegion;m=MeshRegion;t=Triangle;d=RegionDifference;u=RegionUnion;i=RegionIntersection;(*s=ImplicitRegion*)

n1=8;n2=16;w8=.78 Table[{Cos[2\[Pi] k/n1],Sin[2\[Pi] k/n1]},{k,0,n1-1}];
w16=Table[{Cos[2\[Pi] k/n2],Sin[2\[Pi] k/n2]},{k,0,n2-1}];n=12;y1=.267;x2=1/Sqrt[2];w=1.8;v=1.85;
pts={{-w,w},{-w/4,w},{-w/4,w+w/8},{-5w/8,w+w/8},{-5w/8,w+5w/24},{5w/8,w+5w/24},{5w/8,w+w/8},{w/4,w+w/8},{w/4,w},
{w,w},{w,w/4},{w+w/8,w/4},{w+w/8,5w/8},{w+5w/24,5w/8},{w+5w/24,-5w/8},{w+w/8,-5w/8},{w+w/8,-w/4},{w,-w/4},
{w,-w},{w/4,-w},{w/4,-w-w/8},{(5 w)/8,-w-w/8},{(5 w)/8,-w-(5 w)/24},{-((5 w)/8),-w-(5 w)/24},{-((5 w)/8),-w-w/8},{-(w/4),-w-w/8},{-(w/4),-w},{-w,-w},
{-w,-w/4},{-w-w/8,-w/4},{-w-w/8,-5w/8},{-w-5w/24,-5w/8},{-w-5w/24,5w/8},{-w-w/8,5w/8},{-w-w/8,w/4},{-w,w/4}};

frame=RegionPlot[{
m[pts,Polygon[Range[Length[pts]]]],
r[x^2+y^2<2.8,{x,y}],
r[Or@@(((x-#)^2+(y-#2)^2<.1)&@@@w16),{x,y}],
r[x^2+y^2<1,{x,y}],
r[x^2+y^2<1.4,{x,y}],
r[Or@@(((x-#)^2+(y-#2)^2<.15)&@@@w8),{x,y}],
r[x^2+y^2<1,{x,y}] ,
r[1.8 < x^2+y^2< 2.2,{x,y}] ,
r[2.4 < x^2+y^2< 2.8,{x,y}]},
BoundaryStyle->Directive[Thickness[.003],Black],
AspectRatio->1,
Frame-> False,
PlotStyle->{Darker@Green,White,Yellow,White,White,Red,White,Lighter@Brown,Yellow,Red}];

c=Cos[ArcTan[y1]];
p1={-c,y1};
p2={c,y1};
p3={-c,-y1};
p4={c,-y1};
p5={-x2,(x2+y1)/2};
p6={x2,(x2+y1)/2};
p7={-x2,-(x2+y1)/2};
p8={x2,-(x2+y1)/2};
p9={0.5,-x2};
p10={-0.5,-x2};
p11={0.5,-x2};
p12={-0.5,-x2};
p13={a=-.34,b=-.12};
p14={-a,b};
p15={0.5,x2};
p16={-0.5,x2};
t1=m[{{0,-1},p1,p2},t[{1,2,3}]];
t2=m[{{0,1},p3,p4},t[{1,3,2}]];
t3=m[{{0,-x2},p5,p6},t[{1,3,2}]];
t4=m[{{0,x2},p7,p8},t[{1,3,2}]];
t5=m[{{0,+y1},p9,p10},t[{1,3,2}]];
t6=m[{{0,p5[[2]]},p13,p14},t[{1,3,2}]];
t7=m[{{0,p13[[2]]},p15,p16},t[{1,3,2}]];
t8=m[{{0,p7[[2]]},{-.33,p1[[2]]-.12},{.33,p1[[2]]-.12}},t[{1,3,2}]];
t9=m[{{0,p3[[2]]},{z=-.23,0.063},{-z,.063}},t[{1,3,2}]];

innards=RegionPlot[{
d[t1,u[t5,t4,t2]],
d[t4,u[t1,t3,t5]],
d[t3,u[t7,t4,t2]],
d[t2,u[t1,t7,t3]],
d[t5,t1],
d[t4,u[t1,t7]],
d[t7,t2],
d[t3,u[t1,t2]],
d[t8,t2],
d[t9,t5],
d[t9,t6],
i[t4,d[t6,t1]],
i[t6,d[t5,t8]],
i[t7,t9],
d[i[t7,t8],t5],
d[i[t5,t6],u[t7,t9]],
r[x^2+y^2<= .001,{x,y}],
d[i[t7,t1 ],t6],
d[t8,u[t5,t6]],
d[t6,u[t7,t8]],
d[i[t2,t5],u[t7,t8]],
d[i[t7,t3],t4],
d[i[t1,t3],u[t5,t4]],
d[i[t2,t4],u[t7,t3]],
d[i[t5,t4],t3]},
BoundaryStyle->Directive[Thickness[.003],Black],
Frame->False,
PlotStyle->{Blue,Red,Red,Blue,Blue,Blue,Blue,Blue,Blue,
Red,Red,Blue,Red,Yellow,Red,Red,Red,Blue,Blue,Blue,Blue,Red,Red,Red,Red}];

trim=Graphics[{RGBColor[0.92,0.8,0.],Thickness[.01],Line[Append[pts,{-w,w}]]}];
trim2=Graphics[{Brown,Thickness[.02],Line[Append[pts,{-w,w}]]}];
Show[frame,Graphics[{White,Disk[{0,0},.99]}],trim2,trim,innards]

*innards, and this is completely amazing; have a +1

Struggling with the colors here aswell, although the inner circle with triangles is all I have so far. I have some catching up to do ;)

Teun Pronk, It helps to use layers for the frame (everything outside the blue triangles).  The moon-like petals can be achieved by rendering full circles and overlaying them with a large white disk onto which the central figure is rendered.  For me the hardest part is coloring the inner triangular cells.

Same, really hard. Trying to work out something with recursion but can't get it to work yet.

@DavidCarraher I fixed the coloring part. Want a tip about it?

if you have point X,Y you have to check in how many triangles that point is. if its in 0,2,4,6,8 triangles its white. if its in 1 or 5 triangles its blue if its in 3 or 7 triangles its red.

Interesting observation! Thinking about the triangles a point is in may help set up the logical operations for isolating the cell.


text:
Caesar-Cypher-Mania
The Caesar Cypher is a very simple substitution cypher where each letter is shifted by a fixed offset (looping around Z to A). Similarly, we can also a Caesar cypher for the set of printable ASCII characters. These are the 95 characters from code points 0x20 to 0x7E. For a given offset d, we map the code point C to
(C - 32 + d) % 95 + 32

which shifts all characters by a d and loops around from ~ to space. Characters outside this range (control characters like newlines, tabs, and characters outside the ASCII range) are unaffected.
You're to write two programs or functions (potentially in different languages), which take an offset d and a string. The first program should return or print the Caesar cypher of the input. The second program should return or print the inverse Caesar cypher (i.e. using offset -d). You may take input via STDIN, command-line argument or function argument.
To make things more interesting, the second program must be a Caesar cypher of the first program. That is, if you pass the source code of the first program to itself, for some non-zero offset d, the output has to be the second program.
Both programs, as well as the input strings, must contain only printable ASCII characters, newlines and tabs. Neither program may contain any comments or read its own source code, file name or process ID directly or indirectly.
This is code golf, so the shortest answer (in bytes) wins. Since both programs must have the same size, you only need to count it once.

Cjam, 40 38 37 bytes
Forward Cypher:
 q~'~),32>_@m<er "o|%|'*10<]>k<cpZ"_-

Inverse Cypher:
"s!)!+.54@aBo>gt"$q~'~),32>_@m>er\$a/

and the second program is the cypher of first one with difference of 2

How it works
I came up with this answer on pure luck while testing things out.
First, the Cypher parts:
q~'~),32>_@m<er
q~                 "Take the input and evaluate it";
  `~)              "Get the next character after the printable ASCII range";
     ,32>          "Get all printable ASCII characters":
         _@        "Copy the printable ASCII string and bring the cypher difference"
                   "on top of stack";
           m<      "Forward rotate the copy of printable ASCII string by difference";
                   "In case of inverse Cypher, this is m> to reverse rotate the string";
             er    "Transliterate to complete the forward/inverse Cypher";

Now comes the explanation of the tricky part.
Key transformations are
<space> -> "     // Empty space to string conversion
Z -> \           // Character Z in an useless string to swap operation
_ -> a           // Copy operation to wrapping in an array
- -> /           // Set subtraction to string splitting

So the first program is
 q~'~),32>_@m<er "o|%|'*10<]>k<cpZ"_-
 q~'~),32>_@m<er                          "no-op space, Forward cypher, no-op space";
                 "o|%|'*10<]>k<cpZ"       "Useless String (Actually not)";
                                   _      "Copy it and ..."
                                    -     "remove all alphabets of copy from original";

And the second program is
"s!)!+.54@aBo>gt"$q~'~),32>_@m>er\$a/
"s!)!+.54@aBo>gt"                       "Cypher of first part of first program"
                                        "with difference of 2";
                 $q~'~),32>_@m>er\$a/   "Cypher of the useless string of first program";
                                        "with difference 2";
                 $                      "Sort the first program's main part's cypher";
                  q~'~),32>_@m>er       "Program to reverse cypher";
                                 \$     "Swap the cypher to the top of stack and sort it";
                                   a    "Wrap it in array";
                                    /   "Split the output string on an array, which";
                                        "always returns the output in an array as there";
                                        "are no occurrences of an array in a string";

Input is like "<escaped string to be cyphered>" <difference>
For example:
"abcd" 4

and output of the first program is
efgh

and of the second program is
]^_`

Try it online here

aren't that 40 bytes? also it gives an error in the online interpreter (something on Arraylists not being implemented)

@Deformyer corrected the byte count. What are you giving the input as ?

yeah my bad, i used the arguments in the wrong order.

'" q~'~),32>@m<er "9}o|%|'*10<]>k<cp}]"-" 2' doesn't work (java.lang.RuntimeException: Unexpected })

@Deformyer You have to escape the quotes in that string

Python 2, 147
Clearly I didn't think too hard about this one, as it would be futile in Python. There are simply two seperate programs, with the unused one encased in a string.
The offset between the two programs is 39.
Forward
Defines the function Z accepting a Unicode string and an offset.
Z=lambda s,d:s.translate({i+32:(i+d)%95+32for i in range(95)})or u''and Z
"uE:F;=:XLd=rLfMK:GLE:M>`TBckjr`Be=a]qmckj?HKXBXBGXK:G@>`qmaVaHKXN__:G=X"

Inverse
Defines the function I accepting a Unicode string and an offset.
"d4)5*,)G;S,a;U<:)6;4)<-OC1RZYaO1R,PL`\RZY.7:G1G16G:)6/-O`\PEP7:G=NN)6,G"
I=lambda s,d:s.translate({i+32:(i-d)%95+32for i in range(95)})or u''and I

Ruby, 131 125 bytes
Here is my own submission (which I had written earlier as a proof of concept, but I managed to violate my own rules somehow). I'm not reusing any code between the two submissions (I want you guys to beat this, after all), but instead it consists of two lines, one of which is turned into a string with gibberish.
Forward cypher:
Y=->d,s{s.chars{|c|x=c.ord;$><<(x<32?x:(x-32+d)%95+32).chr}};Y
"tdu<cKSKe;@9JKST;TPt;eGJ<r[uss_PsjivPq_Pdjid<`\plbji`e;@JUUr"

Inverse cypher:
"eUf-T<D<V,1*;<DE,EAe,V8;-cLfddPAd[ZgAbPAU[ZS-QMa]S[ZQV,1;FFc"
J=->d,s{s.chars{|c|x=c.ord;$><<(x<32?x:(x-32-d)%95+32).chr}};J

Both snippets define a function (called Y in the first one, and J in the second one), which takes an integer and a string and prints the transformed string to STDOUT. The offset between the two pieces of code is 40.

Python 3 - 248 bytes
My goal was to do this as a Python one-liner. Goal success, but now I can't be bothered golfing.
Encrypt:
r=q="".__doc__[2];eval("p"+q+"int(''.join([c,ch"+q+"((o"+q+"d(c)-32+d)%95+32)][31<o"+q+"d(c)<127]fo"+q+" d in[int(input())]fo"+q+" c in input()))")or'\^UZ`smmyV[UZsGOwOT^ss[^PsOtx~}xPtp%!v~}tIG~|([^PsOt(|}$IR[^kPkUZGUZ`sUZ\a`sttIR[^kOkUZkUZ\a`sttt'

Decrypt:
'Q&Q66Bssx$wssoFqOy+u!<6%6?&?6}#)<;;B~$}#<ow@w|6?&?6<<$6?&?6x<w=AGF?x=9MI?GF=qoGEP$6?&?6x<w=PEFKqz$6?&?64x4}#o}#)<}#%*)<==qz$6?&?64w4}#4}#%*)<===6=$';print("".join([c,chr((ord(c)-32-d)%95+32)][31<ord(c)<127]for d in[int(input())]for c in input()));

Edit: Fixed to not affect chars outside the printable ASCII range
Offset from encrypt to decrypt is 20. Use by inputting the offset first, then the string, e.g.
5
hello

Explanation
The following transformations are the key:
r -> '
' -> ;

The first allows the use of or, while the second ignores a string by semicolons.
Note that "".__doc__[2] returns the string r (taken from str). This is necessary to prevent the single quoted string in the decryption program from having stray quotes in the middle.

GolfScript, 95 64 bytes, all code used in both programs
Encrypt:
0 0z{ 1)'[}??)9t:z21,--/; [84;%zt*84*84$|)21*|$Z!!\~'---|}`{)}%~

Decrypt:
1!1{|!2*(\~@@*:u;{32-..0<!\95<&{u+95+95%}*32+}%[""] (...}~a|*~&

Input format:
1 "0 0z{ 1)'[}??)9t:z21,--/; [84;%zt*84*84$|)21*|$Z!!\~'---|}`{)}%~"

Explanation
Decrypt:
1!1                            # Push 0 1.
{                              # Define a block and evaluate it.
    |                          # Or.
    !2*(                       # Get 1 for encryption, or -1 for decryption.
    \~                         # Evaluate the input string.
    @@*:u;                     # u = d for encryption, or -d for decryption.
    {                          # For each character:
        32-                    # Subtract 32.
        ..0<!\95<&             # Test if it is in the printable range.
        {u+95+95%}*            # If so, add u (mod 95).
        32+                    # Add 32 back.
    }%
    [""] (...                  # Push an empty array and 4 empty strings.
}~
a                              # No-op.
|*~                            # Evaluate ""*(""|"") which does nothing.
&                              # Calculate []&"" which is empty.

Encrypt:
0 0                            # Push 0 0.
z                              # No-op.
{                              # Define a block and get its string representation.
    ...                        # See decryption code.
    |                          # This will be decoded into a }. The string will be truncated here when evaluated.
}`                             # Only the closing } will be truncated, but it is still used as the end of the block.
{)}%                           # Increment each character. Note that the braces before and after the block will also be incremented.
~                              # Evaluate the string.

oOo CODE, 750 744 bytes, all code used in both programs
Too long but it's probably the right tool doing that...
Encrypt:
CcCcccccccccCcYcccCCCccCcCcCccccccCcCcccccCcCcccCcCccCccCcCCccccCcCccccCCcCccccCCccCccCcCCcccCCCcCccccCcCCcCCcCCcCcCcCccccCCccCccCccCccCccCccCccCccccccCCCcCccCccCCcCcCcccCCcCcccCcCCcCCcCcCCccCCcCCcCCcCCcCCcCCcCCcCCcCCcCCcCcccccccCccccCccccCCccccCCcCccCCcccCccccccccccCcCccCccCccCccCcCCccCCcccCcCcCccCCcccCCCcCcccccccccccccCCccCccCcCcCcccCCccccccccccCcCccccccCcCccccCCcCccCccCCcCccccccccccCCccCcCcCcccccCcCccCcCCCcCccCccCCcCccCccCccCcCcccccCcCcccCCCcCcCccccCcCccCCcCCcCCcCcCCcccCcCCcCCcCCcCCcCCcCCcCCcCCcCCcCcCcccCccCCcccccCcCcccCcccccCcccCcccCccCccCCcCcccccccccccccCCCcccCcCcCcccCcccCCCcCccCccCccCcCCccCccCcCCCcCccccCcCccccccccCcCccCccCcCCccccccCccccccccCcccCCccCccCccCCcCCcCCcCCcCcCcCcccccCcCCcCCcCCcCCcCCcCCcCCcCccCcCCcccCCccCcCcccCCcccCCCcCC

Decrypt:
SsSsssssssssSsisssSSSssSsSsSssssssSsSsssssSsSsssSsSssSssSsSSssssSsSssssSSsSssssSSssSssSsSSsssSSSsSssssSsSSsSSsSSsSsSsSssssSSssSssSssSssSssSssSssSssssssSSSsSssSssSSsSsSsssSSsSsssSsSSsSSsSsSSssSSsSSsSSsSSsSSsSSsSSsSSsSSsSSsSsssssssSssssSssssSSssssSSsSssSSsssSssssssssssSsSssSssSssSssSsSSssSSsssSsSsSssSSsssSSSsSsssssssssssssSSssSssSsSsSsssSSssssssssssSsSssssssSsSssssSSsSssSssSSsSssssssssssSSssSsSsSsssssSsSssSsSSSsSssSssSSsSssSssSssSsSsssssSsSsssSSSsSsSssssSsSssSSsSSsSSsSsSSsssSsSSsSSsSSsSSsSSsSSsSSsSSsSSsSsSsssSssSSsssssSsSsssSsssssSsssSsssSssSssSSsSsssssssssssssSSSsssSsSsSsssSsssSSSsSssSssSssSsSSssSssSsSSSsSssssSsSssssssssSsSssSssSsSSssssssSssssssssSsssSSssSssSssSSsSSsSSsSSsSsSsSsssssSsSSsSSsSSsSSsSSsSSsSSsSssSsSSsssSSssSsSsssSSsssSSSsSS

Brainfuck translations:
+>>>+>,<[->[->+>+<<]>[-<+>]<<]>,[>++++[-<-------->]+<<+[<+>+++]<++++++++++>>[>-<-<+<-[>>>+<<<<]<-[+<-]+>>>>]<<[-]>>>[->[-<+<<+>>>]<[->+<]+<<+<<<[>[-]+[>+<+++]>++++++++++[<<->+>->-[<<<+>>>>]-[+>-]+<<<]<<]+>[->>+<<]>>->>-]<<<++++[->++++++++<]>.[-]>,]
+>>>->,<[->[->+>+<<]>[-<+>]<<]>,[>++++[-<-------->]+<<+[<+>+++]<++++++++++>>[>-<-<+<-[>>>+<<<<]<-[+<-]+>>>>]<<[-]>>>[->[-<+<<+>>>]<[->+<]+<<+<<<[>[-]+[>+<+++]>++++++++++[<<->+>->-[<<<+>>>>]-[+>-]+<<<]<<]+>[->>+<<]>>->>-]<<<++++[->++++++++<]>.[-]>,]

oOo CODE is a Brainfuck variant where only the case of letters matters.
It take the first byte and use its character code as d (so a newline means d=10). The rest of input is the string. EOF is 0.

Javascript (ES7 Draft) - 167 165 bytes
Borrowing from @feersum 's use of strings and @MartinButtner 's use of semicolon ;)
Encrypt:
J=(s,d)=>s.replace(/[ -~]/g,x=>String.fromCharCode((x.charCodeAt()-32+d)%95+32));J
"eP<T-Qef<V;.95*,.PW$HUG&W0TAef{=;270V/;86k1*;k8-.PPAV,1*;k8-.i=PQS^[U-QMa]S[ZQQc"

Decrypt:
"t_Kc<`tuKeJ=HD9;=_f3WdV5f?cPtu+LJAF?e>JGEz@9JzG<=__Pe;@9JzG<=xL_`djib<`\plbji``r"
Y=(s,d)=>s.replace(/[ -~]/g,x=>String.fromCharCode((x.charCodeAt()+63-d)%95+32));Y

Offset to use: 55

Fails for empty strings. That's why I had to put or <empty string> and <function> rather than only or <function>.

@feersum it's fixed now... and 2 bytes shorter :)

Hm, this looks familiar. ;)

@MartinBüttner I don't know what you mean... ;)

><> (Fish), 467 bytes
Encrypt:
ffii{{~~__:0a('0'*!.0a('0'*22(!'(~$~_:}-}$-a*}+{{if~~:i:0({}?;__:{}84{}*__({}?\__:{} _{}70{}g_{})_{}?\4__{}8*-_{}+{}80{}g_%4_{}8*{}+\\sl||||||||||||||||||||||||||||9||||||||||||||9||||||||||||||||||||||||||||||||||||||||||||||||||||9
                                                                              >                      >                              >!;7f7-_{}!%_{}!<872-d_{}!&_{}!<[755(7(%~~_{}!<[55(7(_{}!*!*23a(_{}!'_{}!"55(7((~~_{}~~~o__'4'0.{{{o,

Decrypt:
iill~~""bb=3d+*3*-$13d+*3*-55+$*+"'"b=!0!'0d-!.~~li""=l=3+~!B>bb=~!;7~!-bb+~!B_bb=~!#b~!:3~!jb~!,b~!B_7bb~!;-0b~!.~!;3~!jb(7b~!;-~!.__vo                            <              <                                                    <
##############################################################################A######################A##############################A$>:i:0b~!$(b~!$?;:50gb~!$)b~!$?^:88+:+(""b~!$?^88+:+b~!$-$-56d+b~!$*b~!$%88+:++""b~!"""rbb*7*31~~~r/

The two programs are offset by 3, and they take input of the form:
<2-digit offset> <text>

The offset must be 2 digits, so an offset of 5 needs to be entered as 05.
This is a long submission, but nearly all non-filler chars are used by both programs. There's a lot of whitespace that can definitely be golfed out, but I thought the program would be more interesting this way.
This image highlights the chars used by both programs.
Explanation
The main construct that makes this possible is _{} -> b~!, which allows arbitrary skipping of chars in the decryption program. How?
Encrypt:
  _ : Mirror, but is a no-op if the program flow is horizontal
  { : Shift stack left
  } : Shift stack right

Decrypt:
  b : Push 11 to stack
  ~ : Pop top of stack
  ! : Skip the next instruction

All in all, the encryption program does nothing, but the decryption program skips the next instruction. This can then be extended to _{}! -> b~!$, which allows arbitrary skipping of chars in the encryption program instead.
Aside from this, most of the rest of the program is pushing numbers, performing operations on those numbers then finding ways to pop them. For example, one useful construct is ~~ -> "", which pops two values for the encryption program, but pushes nothing in the decryption program.

><>, 149 bytes
Here's the less interesting version, which uses the fact that instructions not passed through are effectively comments in 2D languages.
Encrypt:
i68*:@-a*i@@-+i~v
4:v?)g31:;?(0:i:/8
(?v48*-+03g%48*+\*
_~\of0.   .1+1fo/
j*+:zq<6B99A6=qz6g
53Ji?C58/8;?r0?C5:
C?EiJ4r?<EFJ3;EtEg
:tAC5EK8l5tKK86t*i

Decrypt:
^+-~/5"V~^55" ^sk
)/k4}\(&/04|%/^/$-
|4k)-~" %(\y)-~ Q~
TsQd[%#ttt#& &[d$
_~ /of1+7..6+2fo+\
*(?^48*-$-04g%48*/
84:^?)g41:;?(0:i:\
/i68*:@-a*i@@-+i~^

The two programs are offset by 84, and take input the same way as above. The first instruction decides which half of the program to execute, with i (input) maintaining program flow rightward in the encryption program, and ^ redirecting program flow upward (looping around and coming back from the bottom) in the decryption program.
Explanation
For the relevant half of the encryption program (decryption program is similar):
i                       read first input digit as char
68*:@-a*                subtract 48 (ASCII "0") and multiply by 10, keeping another 48 on the stack
i                       read second input digit as char
@@-+                    subtract 48 and add to 10*(first digit), giving the offset
i~                      read in space and discard it

--- LOOP ---
:                       copy the offset
i:                      read input char
:0)?;                   check if less than 0 (i.e. EOF) and terminate if so
:13g)?v                 check if greater than ~ in cell (1,3) and drop down if so
48*(?v                  check if less than 32 and drop down if so
48*-+03g%48*+           calculate Caesar shift of the char, fetching 95 from (0,3)

of1+1.                  repeat loop
of0.                    repeat loop

Coding tool
This isn't related to the rest of the post above, but I thought I'd post this because I need to use it :P

for(var i=0;i<95;++i){var option=document.createElement("option");option.text=i;document.getElementById("offset").add(option)};function update(m){if(m==1)var code=document.getElementById("in").value;else var code=document.getElementById("out").value;var offset=parseInt(document.getElementById("offset").value);var output="";for(var i=0;i<code.length;i++){var n=code[i].charCodeAt(0);if(n<32||n>127)output+=code[i];else{var c=(n-32+offset*m)%95;output+=String.fromCharCode(c<0?c+95+32:c+32)}}if(m==1)document.getElementById("out").value=output;else document.getElementById("in").value=output};
<textarea id="in" onkeyup="update(1)" rows=5 style="width:100%"></textarea><textarea id="out" rows=5 style="width:100%" onkeyup="update(-1)"></textarea><select id="offset" onchange="update(1)"></select>

Perl - 131
It takes input from command line args.
We;{for(split//,$ARGV[1]){print chr(((ord$_)-32+$ARGV[0])%95+32)}};q!LUXmYVROZttqi'8-<AvCnaVXOTZeINXmmmUXJiEnrxwri'8-<AuCnj~zpxwnc!

Shifting it by 26 gives the other one:
q U6!*-B.+'$/IIF>[lapuKwC6+-$)/:}#-BBB*-~>yCGMLE>[lapuJwC?SOEMLC88U,;for(split//,$ARGV[1]){print chr(((ord$_)-32-$ARGV[0])%95+32)};

@Martin Büttner Woah, an upvote! It actually does work?

it does as far as I can tell ;)