text:
The Stack Exchange Site List
Currently, the Stack Exchange network has nearly 150 sites. These sites are as follows:
Computer Graphics
Portuguese Language
elementary OS
Open Source
Law
Русский язык
Mythology
Health
Stack Overflow на русском
CiviCRM
Woodworking
Music Fans
Vi and Vim
Coffee
Engineering
Lifehacks
Economics
History of Science and Mathematics
Emacs
スタック・オーバーフロー
Worldbuilding
Startups
Community Building
Hinduism
Buddhism
Craft CMS
Puzzling
Data Science
Joomla
Earth Science
Mathematics Educators
Expatriates
Arduino
Software Recommendations
Beer
Ebooks
Aviation
Stack Overflow em Português
Italian Language
Amateur Radio
Pets
Tor
Astronomy
Space Exploration
Blender
Freelancing
Open Data
Network Engineering
Reverse Engineering
Tridion
Sustainable Living
English Language Learners
Magento
Anime & Manga
Politics
ExpressionEngine® Answers
Robotics
Genealogy & Family History
Ask Patents
Salesforce
Islam
Russian Language
Raspberry Pi
Chess
Chemistry
Windows Phone
The Workplace
Computer Science
Academia
Sports
Martial Arts
The Great Outdoors
Cognitive Sciences
Mathematica
Poker
Biology
Chinese Language
Movies & TV
Computational Science
Spanish Language
LEGO® Answers
History
Biblical Hermeneutics
Linguistics
Bitcoin
Christianity
French Language
Signal Processing
Cryptography
Personal Productivity
Travel
Gardening & Landscaping
Philosophy
Japanese Language
German Language
Mi Yodeya
Software Quality Assurance & Testing
Music: Practice & Theory
SharePoint
Parenting
Motor Vehicle Maintenance & Repair
Drupal Answers
Physical Fitness
Skeptics
Project Management
Quantitative Finance
Programming Puzzles & Code Golf
Code Review
Science Fiction & Fantasy
Graphic Design
Database Administrators
Video Production
Writers
Information Security
Sound Design
Homebrewing
Physics
Board & Card Games
Electrical Engineering
Android Enthusiasts
Programmers
Bicycles
Role-playing Games
Ask Different
Theoretical Computer Science
WordPress Development
Unix & Linux
User Experience
English Language & Usage
Personal Finance & Money
Ask Ubuntu
TeX - LaTeX
Geographic Information Systems
Home Improvement
Mathematics
Cross Validated
Photography
Game Development
Seasoned Advice
Webmasters
Arqade
Web Applications
Stack Apps
MathOverflow
Super User
Meta Stack Exchange
Server Fault
Stack Overflow

Your Task:

Write a program that prints out all of the sites in Stack Exchange, including those with non-ASCII characters (It doesn't need to be in any specific order).
The program must accept no input, and must output each site on its own line (optional leading/trailing newlines).
No standard loopholes.
This is code-golf, so the shortest program, measured in bytes, wins.

Related challenge: http://codegolf.stackexchange.com/questions/42242/recognise-stack-exchange-sites-by-their-icon  It's not a duplicate, but a bunch of the string compression techniques will carry over.

Oh, dang, I had already thought of posting this challenge xD The only difference is that if STDIN containts the name of a category, it'd have to print all the sites in that category, and if it contains the name of a site, it'd print the category it's in, along with all the sites in that category.

@ETHproductions That's definitely a separate question/challenge than this—that would be an interesting question.

I voted to close this as a duplicate because I believe it's a subset of this question where answers largely compress the list of SE's, then index into it with a hash from the image, so parts of those answers can be reused. I did not expect my vote to be unilaterally binding. I stand by my opinion, but don't want to enforce my sole view where there is judgment call, so please feel free to reopen if you disagree.

@xnor A little disappointing, but fair enough

Related.

Bubblegum, 1227 1197 bytes
0000000: 65 55 37 7a 2b 37 10 ee 71 0a 54 ee de 05 dc 29 4b fe  eU7z+7..q.T....)K.
0000012: 44 8b 56 b4 cb e1 62 48 8e 85 05 d6 00 96 d4 be e6 05  D.V...bH..........
0000024: 75 ce b1 77 eb ec ca 39 fb 02 d4 19 78 11 ff 00 c3 47  u..w...9....x....G
0000036: fa 29 10 3f 06 33 98 f4 63 38 7f fe f3 fc f9 9f f3 fb  .).?.3..c8........
0000048: fb f9 f3 ef e6 f7 bf ce 9f 7f 39 bf ff 6d 7e ff 61 f9  ..........9..m~.a.
000005a: fc 6c 7e ff 0d 80 da a9 c8 70 2d a4 76 6a 4a dc 06 7d  .l~......p-.vjJ..}
000006c: 4e 46 bc da 71 26 78 31 fa c0 a5 71 1b 85 62 8a 90 49  NF..q&x1...q..b..I
000007e: cd fa 25 dd 23 37 82 7e 30 ad 38 8f f5 2d dc a0 76 e2  ..%.#7.~0.8..-..v.
0000090: ad de 97 e1 90 03 bb 54 76 7d 4a 80 b1 e0 ab 41 eb 52  .......Tv}J....A.R
00000a2: 0b 98 82 77 be ee d4 ce 44 28 89 77 6a 97 39 a8 5d 19  ...w....D(.wj.9.].
00000b4: 58 a9 c8 ea 63 0e 35 3b 6e 93 54 11 d2 aa ab 2c 67 e0  X...c.5;n.T....,g.
00000c6: ad 1f 75 58 53 e5 05 36 96 9d c9 66 9e 82 41 40 7b 79  ..uXS..6...f..A@{y
00000d8: 39 a2 3a ab b6 c6 8c 25 d6 6a 6f 8c ac e0 ae cb 28 46  9.:....%.jo.....(F
00000ea: 7c 8a e3 c8 fa 14 c1 b7 34 62 08 02 ce 85 9c 24 e8 c8  |.......4b.....$..
00000fc: 44 f6 ce 7b 6a cf 1b d6 e7 3c 11 9e 02 23 1b c6 32 82  D..{j....<...#..2.
000010e: 8a 4c 58 5f 54 c2 ae e2 08 51 5d b7 d9 4e ef b6 62 8d  .LX_T....Q]..N..b.
0000120: b8 51 16 35 6d 2a 29 91 5d 69 2e a5 1c f4 51 a0 66 9c  .Q.5m*).]i....Q.f.
0000132: 73 5a 4b d6 2a 81 86 49 ef f5 2e 80 7c 8c fa 9a ac 18  sZK.*..I....|.....
0000144: 4a 6c b0 ef 9a e4 47 d9 b2 53 fb 94 68 40 88 7f c7 d4  Jl....G..S..h@....
0000156: e2 72 62 94 7c 88 45 be be 6b 3f b4 0d bc ef b8 38 65  .rb.|.E..k?.....8e
0000168: 9c cd 3e 7f b8 7f 78 f6 f0 6c f6 cb ec a7 d9 cf fa e1  ..>...x..l........
000017a: 83 d9 8f 0f ef cc 7e 51 07 14 d2 78 6d 74 30 f0 fe 36  ......~Q...xmt0..6
000018c: aa 83 2a 37 46 2a 20 cb 55 0a a5 1d 07 6e 84 aa 71 c8  ..*7F* .U....n..q.
000019e: 19 b2 65 b4 26 51 e8 f4 d9 85 3a a8 09 aa 9b e7 c0 56  ..e.&Q....:......V
00001b0: e2 78 5d 60 7d ca 14 1c e2 78 e1 04 1d bb 8a 58 d5 c1  .x]`}....x.....X..
00001c2: 5d 43 f0 84 6c 63 c6 01 7d 42 fd 16 97 fe f3 ed 3a 8f  ]C..lc..}B......:.
00001d4: c3 c0 6c c9 55 f0 92 b1 ab d6 57 b1 ca 5d d7 fb 3c 61  ..l.U.....W..]..<a
00001e6: eb 9b 1c 1e 04 c1 b0 83 2a bc 40 cb c4 8a 9a 6c 78 c4  ........*.@....lx.
00001f8: 8e 29 b3 08 f2 43 aa c5 76 fa 18 65 f4 a1 c3 d1 a2 ca  .)...C..v..e......
000020a: 52 e9 13 37 f4 a1 2e 6d d4 17 5d 4c 5c 47 1c 43 e2 36  R..7...m..]L\G.C.6
000021c: 5c 2e 74 e1 35 ca c8 a9 63 5c 9b c6 ea 58 9c 69 33 f1  \.t.5...c\...X.i3.
000022e: 96 b7 ae 56 ed 87 ab 52 6b 84 83 c7 93 c0 4c 2a 04 3f  ...V...Rk.....L*.?
0000240: f6 35 0f 02 4f 11 5f c1 fa a4 6e 82 9f 70 49 64 2b 14  .5..O._...n..pId+.
0000252: ae da 90 79 7a 12 2d d5 ea 24 91 95 cd 90 5e a1 86 36  ...yz.-..$....^..6
0000264: d9 0d 89 f7 b5 25 75 4a 53 75 7a 70 74 b6 51 cd 53 19  .....%uJSuzpt.Q.S.
0000276: f2 98 aa db 8c a0 2c b1 84 d2 83 91 4b 1e 6b 48 92 39  ......,.....K.kH.9
0000288: 14 12 84 eb 58 69 03 c7 4d ac 0f 4c 5b 15 2a 16 e9 d9  ....Xi..M..L[.*...
000029a: 84 c3 d0 fa a9 ea 71 e6 65 82 1f 7d 70 57 8d 11 16 ab  ......q.e..}pW....
00002ac: 9e e8 37 bc e1 0e 97 79 58 e8 6b 46 19 2d a3 24 e2 12  ..7....yX.kF.-.$..
00002be: 3b 74 38 53 e3 9c 1b 92 00 95 89 70 c4 fe f2 5a f5 da  ;t8S.......p...Z..
00002d0: 28 15 ba e6 e2 02 be ac fb 81 2a b8 e7 7c 3e e6 5c ee  (.........*..|>.\.
00002e2: 5e 97 c6 8b 29 f1 2a a7 a9 0f b7 5b e4 3d 6b d8 e9 fc  ^...).*....[.=k...
00002f4: 56 16 e8 c2 b7 01 d4 ef 53 1e 56 f9 bc cf 21 96 97 7b  V.......S.V...!..{
0000306: 28 ab 38 7a de 71 b7 3e 80 47 8f 4c 31 07 24 65 29 aa  (.8z.q.>.G.L1.$e).
0000318: d3 1f 8b f5 d1 e3 75 02 fa d5 4b 05 ee 10 62 b9 2a a1  ......u...K...b.*.
000032a: 27 71 29 c0 ea 6f 39 e0 d3 4a 5a 6c 43 6a 47 ed 56 d7  'q)..o9..JZlCjG.V.
000033c: e0 04 b7 d4 35 9c ae 71 a6 72 bf 7d fc d8 96 6a 94 01  ....5..q.r.}...j..
000034e: 75 e4 ed 30 9f bf c9 55 ca d3 18 a6 85 32 45 2d a7 f3  u..0...U.....2E-..
0000360: 5a 4b c8 2b 11 c2 e5 55 4a ea 9c 62 33 e0 00 4a f6 45  ZK.+...UJ..b3..J.E
0000372: 61 c6 c1 09 6f 15 e9 dc 0f 7c 0e 0d c0 f2 a3 c6 52 07  a...o....|......R.
0000384: 69 99 ab 10 b5 31 6e 51 ee 82 10 d0 d0 e7 32 2e e9 0d  i....1nQ......2...
0000396: 47 55 66 6b 79 60 2e 51 ec d4 05 13 aa c7 06 53 6b 22  GUfky`.Q.......Sk"
00003a8: 59 93 03 dc e2 b8 b5 49 5d 8c 29 70 df 8b 03 94 d1 b2  Y......I].)p......
00003ba: c6 15 2a 96 63 b9 b8 e5 a6 c4 72 e1 87 69 0a 45 8d 9c  ..*.c.....r..i.E..
00003cc: 6c 1e b9 3b 31 b6 61 d9 a3 4b 8e a5 7d 6b a5 73 ae 3c  l..;1.a..K..}k.s.<
00003de: ca e7 4c 79 37 d9 ba 75 66 f5 52 2f 1a 82 15 06 8d f5  ..Ly7..uf.R/......
00003f0: a1 9c 67 89 db 9c 4c 10 f8 4c fc 05 71 77 9a 66 05 d7  ..g...L..L..qw.f..
0000402: bc de de ea d9 ef b3 ef f5 c3 d3 f5 9c fd 63 f6 db ff  ..............c...
0000414: 55 b8 d6 cb 56 ff fb 65 b9 0e b8 01 68 1b 0e 98 83 1c  U...V..e....h.....
0000426: 00 63 22 34 69 60 41 05 99 e4 84 2e f9 75 fd 08 61 61  .c"4i`A......u..aa
0000438: 55 20 b8 3e 0a 4c 49 9f b5 c9 f8 fc d4 0a e7 39 15 9a  U .>.LI........9..
000044a: bd f0 8d 92 f5 6f f0 00 d0 c0 bc f3 41 5d 06 c2 80 c4  .....o......A]....
000045c: 22 26 67 7d e5 e4 2e 4f 47 71 ed 9d ca 11 e4 9a 70 58  "&g}...OGq......pX
000046e: 58 5f 4b 19 53 d7 52 03 1a f6 6b e2 c3 f0 86 07 b9 28  X_K.S.R...k......(
0000480: 56 aa 65 79 21 a8 29 c2 39 a0 38 e3 a7 51 e3 29 38 56  V.ey!.).9.8..Q.)8V
0000492: 37 de 9b fc 08 91 0b 70 30 fd 3c db b7 e6 34 a4 d6 0c  7......p0.<...4...
00004a4: 56 5f 9f 37 41 ca 2d ff 01                             V_.7A.-..

Prints a sorted list of SE sites.
Compression has been done with zopfli, which uses the DEFLATE format but obtains a much better ratio than (g)zip.

Python3, 1754 1728 1662 bytes
Python3 includes the lzma module, which allowed me to obtain a really decent compression ratio. (I have switched to gzip.) I was originally going to use base64 to encode the output but realized I could squeeze some more bytes out using base85 (ascii85).
I avoided the issue with escaping ' by using a triple-quoted string and avoided the issue with escaping \ characters by using the r"" prefix.
import base64,gzip
print(gzip.decompress(base64.a85decode(r'''+,^C)B/BZj!rlh3]9_20&FK!&W8.1RdSX2MG($0f,4;Ut&gBgi+qS,^:g1Gf=(R8b8Y=`"jO#8sSE-4$#Gc:bO5pd"a]c<M-kMcVF75Ychj%1^aigAZ<M?`A-I0YX;,\St;Kbp<"UQq`P)[UCng5)1'j6s9g1M[#C+ZkYm5DT.]@Ye]gHW,bjmN$5n%8%sn&2_mKemVoLau@M(*\_f>KWEMq71K\\c$=@S(rF=3rJaG^$+dImSCm_V/uIdq5(M-0s6/SjJB.JghWm*0(3p3qJJJE&d,bmQH8[;Oe,L&'L<-_B3iX@>j2e?E4`YS1JKd&2SrS8Jk?c'bFhgZmN:?S+91#42Z(O%pR=DAO)O`]p\W2GmISBsk%D=,Q8eW@egBR-W!?R-!EdLM[Q6=PGPlW\D-lO)MI)k:"i']CRRc$QVd`Q=H=_?MKo5.$9>#5H1eJ/fZT'P.iKSu-c4l-:ieL,pY>qA@&s#0+M:Bf1>'Z90aoI35N`-FXotZS)ba\bga\'%C+%nnr4Que%Rinl/10W?AqBnNn[?jgWCF:GCK=H&1,U%Kr\IiPP5V-:\kIUj[!sD/Bl%tA))40(rLMIZt;e1%4\U%0U)S#3_mFLU9Kj0>2ZrJma=2H0VKPa26iWN/>89p+!i+rG#3g!NMP'dJ9m6\Y@7X&l;<1ZEAfIkXf^W=?J24pDMR;;O*ahk?f/rj;=;O^,sN.dplEWS9Q84]#>0R):Xf>4C`9PXbpB5X_92'WV6::04$aNMmBYn61H4Q=pX:'tW*g_M0oY@V:\-!RBbbbGi79]\74^bqA9.XfghaFsT_fqBc.j\6b:`uaKW"WXLCFGpdVbf"TSTh\C-%GEI#`-KCah+CU2osaZ#.'9SlGJjU*m5b2U1`5)>EI$WGVe62?NP$GG=&Rie4G&6"O7p8bA*1-%#gY#Y)i8uQZa8kp??#UpG8Z;D"8%"?7CV3ce\IA4\AJNX$0pXq[pH2XLnXB"=e%c@#agB@<?,FFB]F^)o.Lg#H,@?.E6jdhC\a7=WDO`um>Dm2Ju2=1W4h3<!knpd*/E*XJ>3+Aqbe!sOVTo;6+p,hn7K;g%U@,&_?>V2a07T5G)/,S8nfq2HsO#4#C7ad'3\QmFgPtcF@fJ*-Q)WIZH0HZDP#Sa5`pgJKH2[f)k$GO]Wu'Sg54>Eh+*HFkfd;=DeMa;CN1>bQTAUqZsA7[+>i(sDo`:n:oKpu1Beh`*.cf*h8HnV3Ot>5kie@>8$:n+U4:>:>V`.Wp8f2c(X2)1a=C??bgX.%N2q\E*$f+&r%h:ubWRX.g:*<::QWNWhWZ"qZ%+)L`,M`HoCm@XJ91.,6dO/,%J.u$jAs%B\7ShidHX6,c1";KU2fc2Ntn=Bj]p@,IV8<UHVW>l6/2Y1a7',4p;eT`m$YKom'MtC%nc?t_gpr?ceY\2Ynjh@V0n;upk;YY/q=:)fPEmM1:6u$la$)!e[aZ:md#3)bkLT]Xp`B<YWMLlPOPB<PSAXF%WPR=Ml'V`6CGj3ItR:0.l+(RDYWYjl0]E?FjoMuiF&=2#K`3d1%?RBmMe9!"kZ)LPK-FcX>]UD]BXk\/OT09#QOi''')).decode())


text:
Base85 Encoding
The Challenge
Write a program that can take an input of a single-line string containing any ASCII printable characters, and output the same string encoded in Base85 (using a big-endian convention). You can assume that the input will always be ≤ 100 characters.

A Guide to Base85

Four octets are encoded into (usually) five Base85 characters.
Base85 characters range from ! to u (ASCII 33 - 117) and z (ASCII 122).
To encode, you continuously perform division by 85 on the four octets (a 32-bit number), and add 33 to the remainder (after each division) to get the ASCII character for the encoded value. For example, the first application of this process produces the rightmost character in the encoded block.
If a set of four octets contains only null bytes, they are encoded as a z instead of !!!!!.
If the last block is shorter than four octets, it's padded with null bytes. After encoding, the same number of characters that were added as padding, are removed from the end of the output.
The encoded value should be preceded by <~ and followed by ~>.
The encoded value should contain no whitespace (for this challenge).

Examples
In: easy
Out: <~ARTY*~>

In: test
Out: <~FCfN8~>

In: code golf
Out: <~@rGmh+D5V/Ac~>

In: Programming Puzzles
Out: <~:i^JeEa`g%Bl7Q+:j%)1Ch7Y~>

The following snippet will encode a given input to Base85.

<input id="in" type="text" value="Base85"><button onclick="$('#out').text($('#in').val().toAscii85())">Submit</button>
<textarea id="out" rows=5 disabled></textarea>

I'm confused as to why, given that you restrict the input to printable ASCII, you then use byte as a synonym of octet and don't allow 7-bit bytes.

Endianness should be specified. A block [0,1,2,3] is converted to a 32 bit number as 0x0123 or 0x3210?

@edc65 big endian according to the wikipedia link

@steveverrill thank you. That should be in the challenge text, and not in an external link. At least it's in a comment now

If the input can only contain printable characters, how could it contain four null bytes?

I was giving a guide to Base85 in general. Not every point is necessarily applicable to the challenge. @LuisMendo

Thanks. Like Dennis says, that input can't happen in this case

CJam, 43 39 35 bytes
"<~"q4/{:N4Ue]256b85b'!f+}/N,)<"~>"

Try it online in the CJam interpreter.
How it works
"<~"      e# Push that string.
q4/       e# Read all input from STDIN and split it into chunks of length 4.
{         e# For each chunk:
  :N      e#   Save it in N.
  4Ue]    e#   Right-pad it with 0's to a length of 4.
  256b85b e#   Convert from base 256 to base 85.
  '!f+    e#   Add '!' to each base-85 digit.
}/        e#
N,)       e# Push the length of the last unpadded chunk, plus 1.
<         e# Keep that many chars of the last encoded chunk.
"~>"      e# Push that string.

If the input was empty, N,) will apply to the string "<~". Since N initially holds a single character, the output will be correct.
We don't have to deal with z or pad the encoded chunks to length 5, since the input will contain only printable ASCII characters.

This solution looks suspiciously like the Base85 version of an ASCII string (cf. last example in question). Wait...

@odjo: There are some invalid characters in the CJam code, the closest I got is this CJam interpreter link

@ojdo because the challenge is just this: a program that can take an input of a single-line string containing any ASCII printable characters,...

Python 3, 71 bytes
from base64 import*
print(a85encode(input().encode(),adobe=1).decode())

I've never golfed in Python, so this is probably sub-optimal.
Thanks to @ZachGates for golfing off 3 bytes!

You can use input().encode() instead of str.encode(input()) to save 3 bytes.

@ZachGates Thanks! All that en-/decoding is still killing me though.

Pure bash, ~738
Encoder first (something golfed):
#!/bin/bash
# Ascii 85 encoder bash script
LANG=C

printf -v n \\%o {32..126};printf -v n "$n";printf -v m %-20sE abtnvfr;p=\<~;l()
{ q=$(($1<<24|$2<<16|$3<<8|$4));q="${n:1+(q/64#378iN)%85:1}${n:1+(q/614125)%85:1
}${n:1+(q/7225)%85:1}${n:1+(q/85)%85:1}${n:1+q%85:1}";};k() { ((${#p}>74))&&ech\
o "${p:0:75}" && p=${p:75};};while IFS= read -rd '' -n 1 q;do [ "$q" ]&&{ print\
f -v q "%q" "$q";case ${#q} in 1|2)q=${n%$q*};o+=($((${#q}+32)));;7)q=${q#*\'\\}
o+=($((8#${q%\'})));;5)q=${q#*\'\\};q=${m%${q%\'}*};o+=($((${#q}+07)));;esac;}||
o+=(0);((${#o[@]}>3))&&{ [ "${o[*]}" = "0 0 0 0" ]&& q=z|| l ${o[@]};p+="${q}";k
o=(); };done;[ "$o" ]&&{ f=0;for((;${#o[@]}<4;)){ o+=(0);((f++));};((f==0))&&[ \
"${o[*]}" = "0 0 0 0" ]&&q=z||l ${o[@]};p+="${q:0:5-f}";};p+="~>";k;[ "$p" ]&&e\
cho "$p"

Tests:
for word in easy test code\ golf Programming\ Puzzles ;do
    printf "    %-24s %s\n" "$word:" $(./enc85.sh < <(printf "$word"))
  done
    easy:                   <~ARTY*~>
    test:                   <~FCfN8~>
    code golf:              <~@rGmh+D5V/Ac~>
    Programming Puzzles:    <~:i^JeEa`g%Bl7Q+:j%)1Ch7Y~>

and decoder now:
#!/bin/bash
# Ascii 85 decoder bash script
LANG=C

printf -v n "\%o" {33..117};printf -v n "$n";o=1 k=1;j(){ read -r q||o=;[ "$q" \
]&&[ -z "${q//*<~*}" ]&&((k))&&k= q="${q#*<~}";m+="$q";m="${m%~>*}";};l(){ r=;f\
or((i=0;i<${#1};i++)){ s="${1:i:1}";case "$s" in "*"|\\|\?)s=\\${s};;esac;s="${\
n%${s}*}";((r+=${#s}*(85**(4-i))));};printf -v p "\%03o" $((r>>24)) $((r>>16&255
)) $((r>>8&255)) $((r&255));};for((;(o+${#m})>0;)){ [ "$m" ] || j;while [ "${m:0
:1}" = "z" ];do m=${m:1};printf "\0\0\0\0";done;if [ ${#m} -ge 5 ];then q="${m:0
:5}";m=${m:5};l "$q";printf "$p";elif ((o));then j;elif [ "${m##z*}" ];then pri\
ntf -v t %$((5-${#m}))s;l "$m${t// /u}";printf "${p:0:16-4*${#t}}";m=;fi;}

Copy this in enc85.sh and dec85.sh, chmod +x {enc,dec}85.sh, then:
for string in 'ARTY*' 'FCfN8' '@rGmh+D5V/Ac' ':i^JeEa`g%Bl7Q+:j%)1Ch7Y' ;do
    printf "    %-42s %s\n" "<~$string~>:" "$(./dec85.sh <<<"<~$string~>")"
  done
    <~ARTY*~>:                                 easy
    <~FCfN8~>:                                 test
    <~@rGmh+D5V/Ac~>:                          code golf
    <~:i^JeEa`g%Bl7Q+:j%)1Ch7Y~>:              Programming Puzzles

./enc85.sh <<<'Hello world!'
<~87cURD]j7BEbo80$3~>
./dec85.sh <<<'<~87cURD]j7BEbo80$3~>'
Hello world!

But you could do some stronger test:
ls -ltr --color $HOME/* | gzip | ./enc85.sh | ./dec85.sh | gunzip

Reduced to 724 chars:
printf -v n \\%o {32..126};printf -v n "$n";printf -v m %-20sE abtnvfr;p=\<~
l(){ q=$(($1<<24|$2<<16|$3<<8|$4))
q="${n:1+(q/64#378iN)%85:1}${n:1+(q/614125)%85:1}${n:1+(q/7225)%85:1}${n:1+(q/85)%85:1}${n:1+q%85:1}"
};k() { ((${#p}>74))&&echo "${p:0:75}" && p=${p:75};};while IFS= read -rd '' -n 1 q;do [ "$q" ]&&{
printf -v q "%q" "$q";case ${#q} in 1|2)q=${n%$q*};o+=($((${#q}+32)));;7)q=${q#*\'\\}
o+=($((8#${q%\'})));;5)q=${q#*\'\\};q=${m%${q%\'}*};o+=($((${#q}+07)));;esac;}||o+=(0)
((${#o[@]}>3))&&{ [ "${o[*]}" = "0 0 0 0" ]&&q=z||l ${o[@]};p+="${q}";k
o=();};done;[ "$o" ]&&{ f=0;for((;${#o[@]}<4;)){ o+=(0);((f++));}
((f==0))&&[ "${o[*]}" = "0 0 0 0" ]&&q=z||l ${o[@]};p+="${q:0:5-f}";};p+="~>";k;[ "$p" ]&&echo "$p"

Octave, 133 131 bytes
Thanks to @ojdo for suggesting I take input from argv rather than stdin, saving me 2 bytes.
function g(s) p=mod(-numel(s),4);s(end+1:end+p)=0;disp(['<~' dec2base(swapbytes(typecast(s,'uint32')),'!':'u')'(:)'(1:end-p) '~>'])

Ungolfed:
function g(s)             %// function header
p=mod(-numel(s),4);       %// number of missing chars until next multiple of 4
s(end+1:end+p)=0;         %// append p null characters to s
t=typecast(s,'uint32');   %// cast each 4 char block to uint32
u=swapbytes(t);           %// change endian-ness of uint32's
v=dec2base(u,'!':'u');    %// convert to base85
w=v'(:)'(1:end-p);        %// flatten and truncate resulting string
disp(['<~' w '~>']);      %// format and display final result

I've posted the code on ideone. The standalone function doesn't require and end statement, but because ideone has the function and the calling script in the same file it requires a separator.
I still haven't been able to figure out how to get stdin to work on ideone. If anyone knows, I'm still interested, so please drop me a comment.
Sample output from ideone:
easy
<~ARTY*~>
test
<~FCfN8~>
code golf
<~@rGmh+D5V/Ac~>
Programming Puzzles
<~:i^JeEa`g%Bl7Q+:j%)1Ch7Y~>

Why not just use argv()? The task description does not seem to require reading input from stdin.

Very nice! So does dec2base in Octave allow bases above 36?

As the doc (and the error message) say: argument BASE must be a number between 2 and 36, or a string of symbols. Here, the expression 'i':'u' expands the the 85 character string !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstu that serves as the base.

@ojdo If that's the case then I should make it a function and maybe save a couple of bytes.

@LuisMendo As ojdo says, dec2base will take a base of arbitrary size as long as you give it an alphabet to pull from. For bases b less than or equal to 36, it defaults to the first b characters of [0..9,A..Z]. Any base over 36 requires that you give it the full alphabet (which you can optionally do for smaller bases as well).

@beaker In Matlab you can't choose the "digits", only the base; and it's limited to 36 maximum :-( That's why I used bsxfun

@LuisMendo Wow, that's interesting. I didn't even look at the Matlab documentation. That kinda stinks.

@beaker It does. Not only the limitation to 36, but the fact that digits are necessarily 0...9ABC, so there's a jump in ASCII codes

Python 2, 193 162 bytes
from struct import*
i=raw_input()
k=4-len(i)%4&3
i+='\0'*k
o=''
while i:
 b,=unpack('>I',i[-4:]);i=i[:-4]
 while b:o+=chr(b%85+33);b/=85
print'<~%s~>'%o[k:][::-1]

This is my first code golf, so I'm sure there's something wrong with my approach.  I also wanted to actually implement base85 rather than just call the library function.  :)

This is 181 bytes. Don't forget to remove the newline that IDLE adds to your code when you save (if you're using IDLE). You also never call the function, or get the user's input, so it doesn't do anything when you run it.

Wasn't sure if it should be a function or read I/O or what... should it read stdin and print stdout?  (Again, never done code golf before...)

Welcome to Programming Puzzles & Code Golf! There seems to be a problem with input lengths that are not divisible by 4 (last 2 test cases). Line 3 should read [:4+len(s)/4*4] and no characters are removed from the end of the output.

I believe I've fixed the issues (and unfortunately made it longer).  Trying to optimize more...

You can turn your second while loop into one like like this: while b:d=chr(b%85+33)+d;b/=85. You can also remove the space between your print statement and the string. Additionally, remove the space between the arguments passed to s.unpack.

Matlab, 175 bytes
s=input('','s');m=3-mod(numel(s)-1,4);s=reshape([s zeros(1,m)]',4,[])';t=char(mod(floor(bsxfun(@rdivide,s*256.^[3:-1:0]',85.^[4:-1:0])),85)+33)';t=t(:)';['<~' t(1:end-m) '~>']

Example:
>> s=input('','s');m=3-mod(numel(s)-1,4);s=reshape([s zeros(1,m)]',4,[])';t=char(mod(floor(bsxfun(@rdivide,s*256.^[3:-1:0]',85.^[4:-1:0])),85)+33)';t=t(:)';['<~' t(1:end-m) '~>']
code golf
ans =
<~@rGmh+D5V/Ac~>

PHP, 181 Bytes
foreach(str_split(bin2hex($argn),8)as$v){for($t="",$d=hexdec(str_pad($v,8,0));$d;$d=$d/85^0)$t=chr($d%85+33).$t;$r.=str_replace("!!!!!",z,substr($t,0,1+strlen($v)/2));}echo"<~$r~>";

Online Version
Expanded
foreach(str_split(bin2hex($argn),8)as$v){
    for($t="",$d=hexdec(str_pad($v,8,0));$d;$d=$d/85^0)
      $t=chr($d%85+33).$t;
    $r.=str_replace("!!!!!",z,substr($t,0,1+strlen($v)/2));
}
echo"<~$r~>";

PHP, 171 bytes
foreach(unpack('N*',str_pad($argn,($m=4-($l=strlen($argn))%4&3)+$l,"\0"))as$c){for($a=$c?'':z;$c|0;$c/=85)$a=chr($c%85+33).$a;$b.=$a;}echo'<~',$m?substr($b,0,-$m):$b,'~>';

Try it online!

JavaScript, 314 Bytes
a=>(g="<~",h="~>",r=[],t=0,[...a].map((d,h)=>{if(0==h%4){for(n=0,o=0,f=0,s=[],e=0;4>n;)o=256*o+(a.substr(t,4)+"\0\0\0").substr(0,4).charCodeAt(n),n++;for(;5>f;)e=o%85,o=(o-e)/85,s.unshift(String.fromCharCode(e+33)),f++;r=[...r,...s],t+=4}}),d=4-a.length%4,4!=d&&r.splice(-d,d),g+r.join("").replace(/!!!!!/g,"z")+h)

This is my first code golf :)
Try It‽

Type Below
<input oninput='document.querySelector("p").innerText = (a=>(g="<~",h="~>",r=[],t=0,[...a].map((d,h)=>{if(0==h%4){for(n=0,o=0,f=0,s=[],e=0;4>n;)o=256*o+(a.substr(t,4)+"\0\0\0").substr(0,4).charCodeAt(n),n++;for(;5>f;)e=o%85,o=(o-e)/85,s.unshift(String.fromCharCode(e+33)),f++;r=[...r,...s],t+=4}}),d=4-a.length%4,4!=d&&r.splice(-d,d),g+r.join("").replace(/!!!!!/g,"z")+h))(this.value)'>
Stuff will go here...

PowerShell, 169 165 162 160 bytes
$ofs=''
"<~$($args-replace'.{1,4}',{$v=$_
&{0..3|%{$n=256*$n+"$v"[$_]}
0..4|%{$r=[char]($n%85+33)+$r;$n-=$n%85;$n/=85}
$r[0..$v.Length]-replace'!!!!!','z'}})~>"

Try it online!

Ruby, 128 114 bytes
$_="<~#{$_.gsub(/.{1,4}/){$&.ljust(4,?\0).unpack1("L>").digits(85).reverse.map{(_1+33).chr}.join[..$&.size-5]}}~>"

Attempt This Online!

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:
Seriously, GolfScript, CJam, or Pyth?
Some time ago, the following question was asked: GolfScript, CJam, or Pyth?
Based on the title only, I thought that it would be a very nice challenge, but unfortunately, it turned out to be a question asking for tips.
Here is the challenge I wanted to read:

Who said golfing languages were not used in the Real World?
  As everybody knows, the ratio of bugs per line of code is the same independently of the programming language being used, so there is a clear opportunity to reduce debugging and maintenance costs with those languages. Your company finally saw the light and decided to use Golfscript, CJam and Pyth to develop its products.
Unfortunately, after a couple of months, your hard drives are cluttered with snippets of code and you don't even know which ones are written in which languages (you even suspect some of your programmers of using Perl).
You must write a tool to detect which of CJam, Golfscript or Pyth is the language in which a program is written. The situation is critical, you can use any language you want, but please keep it short (data storage is expensive: the more bytes we use, the more it costs).

General

Shortest code win
Standard loopholes, etc.
Don't use an online interpreter
You can write a function or a program
You can use eval to detect your own language

Input

Your input is taken from the standard input stream or as a string
Input contains only ASCII printable characters and linefeeds
The size of the input is up to 256 bytes long

Output

Output is printed to output stream or returned as a sequence of strings/symbols
If the input is without doubt a valid X program, print or return X, X ∈ {CJam, Pyth, Golfscript}
Remark: "without a doubt" does not mean that  you are allowed to answer with a dumb analyzer that consistently fails to detect any  language.        For Pyth, I expect Simple Programs to be recognized (but no hardcoding). The same goes for CJam (cheat sheet, examples) and Golfscript (examples). The previous links point to each language's specifications.
 If you use a fuzzy/bayesian approach, "without a doubt" means with a high-level of confidence (you score 99% with your classification, for example).
See below for the actual test suite.
If the input is valid in multiple languages, each detected language should be printed/returned. When printed, there must be a separator between multiple outputs (e.g. space, newline, comma...).
The order in which languages are tried does not matter
I do not care about case (CJam, cjam, CJAM, SPAM) [1]
If none of the above language is detected, print "Probably Perl".
Thanks to this comment from mbomb007, in the above case you can also output "Seriously" for a penalty of 4 bytes (the difference between both strings).

[1] Just to be clear, SPAM is invalid
Examples

Input
"Crime predicted: --
Calling: 1--555-

"30*{_5<{iAa*:mr}&}/

Output (example of multiple return values)
["Golfscript", "Cjam"]

Input
3

Output (example on standard output)
golfscript
cjam
pyth

Input
if {} aazd

Output
Probably Perl

In the last case, the input program produces an error With All Three online interpreters.
Scoring, winning criterion
Shortest code win. Add 4 bytes if you output "Seriously". Then, apply bonuses.
Failing tests
The following are snippets that must not be recognized as any of the three languages above.

One-liners (i.e. one entry per line)

$^X=~/([a-z]+)[^\/]+$/;print$1,$/
<>;map($s-=(-1)**$_/(2*$_-1),1..$_),$s=!print$s,$/for<>
((THIS IS LISP HAIKU) (TRULY THIS IS LISP HAIKU) (THIS IS LISP HAIKU))
(format t"~@(~{~R~^, ~}~).~%~:*~@(~{~:R~^, ~}~)."(loop for i to 99 collect(1+ i)))
print sum(ord(c) for c in 'Happy new year to you!')

Brainfuck

>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
++++++++++++++++++++++++++++++++++++++++++++++++.
-----------------.
++++++++.
+++++.
--------.
+++++++++++++++.
------------------.
++++++++.

Perl

@list=( "aaaa",
        "aaaaaaaa",
        "aaaaaaaaaaaaaaa",
        "aaaaaaaaaaaaaaaa",
        "aaaaaaaaaaaaaaaaaaaaaaa",
        "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

while (@list) {
    for($i=0;$i<6;$i++){
        print length($list[$i])." ";
    }
    print "\n";
}

Fish

#ifndef __linux
#include "x.h"
#define X/*\
a=1 set -e
+++++++++++++++++++++_+++++++++++++....Hello World!?:Q:
#endif
    echo "Hello, World!"
    int m(){}

Basic test suite
Those are tests which must pass. Belows are one-liners for each language where your program must detect the language it is being written in (I did not check which of those are polyglot).
Pyth
*2Q
FNrZTN
FNrZhTN
FNUhTN
VhTN
FNr1hQN
=N5N
K5K
K1FNr1hQ=K*KN
K1FNr1hQ=K*KNK
K1FNr1hQ=K*KN;K
DhZK*3ZRK
L?b*bytb1yQ
A(Z1)VQHA(H+HG

Golfscript
;'2706 410'~{.@\%.}do;
;''6666,-2%{2+.2/@*\/10.3??2*+}*`50<~\;
'Hello, world!'
1 2 [\]

CJam
"Hello, world"
{`"_~"}_~
"`_~"`_~
T1{_2$+}A*]`
{__'`>\'x>26*2-*-}/
Y38#
N/s:X,8-,{X>9<__{'a<},,\4%{'Z>},,*I={4=}{;}?}/

Silver bonus: byte-count * 0.6
All previous tests must pass, as well as the following one-liners.
All those snippets are taken from actual CodeGolf answers.
Pyth
VzJ:zZhZpkJ~Zhy}rJ0-G"aeoui
Vzjdm?@zd}N,dt-lzd\ Uz
jd.iSQs*RtQ,\?":0
rsXOtQmO*-GJ"aeiou"J/Q2*%Q2O"hy"4
VhQIq`N_`NN
s["$$\\varphi=1+"*Q"\cfrac1{1+"\\<\dQ"dots"*Q\}"$$
@c"weak trick fair"d-!JlfhT-M.:us_cG.u+NYtKrH7-52hK.zU52 2>J26

Golfscript
);:|;{0):0;|$:§-1%" - "§" = ""0"4$~§~-+-4>:|n|6174`=!}do"Iterations: "0"."
'-+,/'{)))))}%
4:echo(2+2);
#undef X;A!"$%&'()*+-[,.]/0123456789:<=>?@BCDEFGHIJKLMNOPQRSTUVWYZ\^_`abcghijklmopqrstvwxyz{|}~
{`),32>^.}.~
"126,32>''+".~\-'.~\-"'-
"),@`^^32>#.~".~
...[[]]{{}}&%%++++5i
  *++..0011125::::;;;?bbbbcccc{}
"This program wasn't written in "o"GolfScript"", it was built for ""CJam"oo"!"

CJam
"Q"c("ASSW"1$("aRD"(((T1
%\@_@){;_0}*__*)\15
"This program wasn't written in "o"GolfScript"", it was built for ""CJam"oo"!"
"P2"1e3K51_,1>K*$K*~]N*
li__,\mf:i2m1+:*/fb:+
ri:B__(^2/):G/,{_BBG/@-(#G@*G(B2/*+*}/]:+
{1$+S@]_1=4+1$`,-S*"2$~"}21D2$~
[S'-26*N]:Z[S'|:PS24*PN]:RR'(PS5*qi:XD=X0<-X2%2*+:Y[" ^ "_" > ""(O)"" - "__]=S8*Y[" ^ ""   "" < ""(O)"" - "__]=S5*P')NRRXD=[SPS7*'oA*S7*PN]:QR?Y[[SPS5*'oSC*'oS5*PN]:T_R[SPS7*'oS8*'oS7*PN]RRR]=QY2=TR?RRZ
li4H#+2bW%32<2b
q~:R100:H*\d:T/i){R-H*HT-/m]}6*_H)<*
"JamesBdo,"YZ+/)BA*c+Y*Y%:BS@SB)))[JW:Z____)ci+*]U*

Gold bonus: previous-score * 0.8
Pyth

Compare

jdm@cd)._-FQcj"
is
equal greater less
to than
"Qb

Snowman

M@GCHgc"  ___

  ___
   _"bhzgc" (_*_)
 _===_
 .....
  /_\\"bhzs[g"  \ "@z4\(g"-.oO"@z2g" ,._"@z1g"-.oO"@z3\)g"  / "@z5)s[g" < /"@z4\(gc"
 :
] [
> <"b@z6\)g" > \\"@z5)++" ("gc"
 :
\" \"
___"bez\)

CJam

Big

rri:Hri:Vri:Q[q~]3/_Qa3*a+_|$W%:Pf{\a#}:AH/:B0ff*
P,,[AHAW%HBz:+_W%V\V]2/
ff{~@@f=/::|1#}0Ua4*t:R;
P0f<
V{H{BI=J=_2$=
0R{"I>! I+V<J>! J+H<"4/+4/z{~~}%:&1$*\)}%);2$-|t
}fJ}fI
[P,{_La#\1$0t1$f-}*;;]
{:TR=2/~\~V\-,>\f{\_3$=@~H\-,>{Tt}/t}~}/
:~Pf=:~
~]S*N

Snowman

q:Q;SS"
 _===_,___
 ....., _
  /_\,___
 (_*_)"',/0{Q=~(=}:G~N" \ "4G'(".oO-"_2G",._ "1G@3G')" / "5GN"< / "4G'(" : ] [> <   "3/6G')"> \ "5GNS'(" : \" \"___   "3/7G')

Golfscript

Lorem Ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras imperdiet est ut sem commodo scelerisque. Sed ut ultricies enim. Nam eget lectus suscipit, gravida turpis a, volutpat tellus. Cras efficitur luctus neque, at semper massa condimentum at posuere.

Digital clock

:*{32' _':$@'14'{?~!=}:&~32}%n*{:x' |':|\'1237'&$x'017'&|x'56'&}%n*{:x|\'134579'&$x'147'&|x'2'&}%

Happy birthday

4,{"Happy Birthday "["To You""Dear GolfScript"]@2==n}%

Farey sequence

~:c[,{){.}c(*}%.c/zip{+}*]zip{~{.@\%.}do;1=},{~<},{~\10c?*\/}${'/'*}%', '*'F'c`+' = {0/1, '+\', 1/1}'

From the title, I was hoping this included a new esoteric language called "Seriously".

Are HTTP requests allowed to check with the online interpreter?

@vihan NO. No network trick.

@mbomb007 Seriously: a language that runs result of the source interpreted in Golfscript as Pyth, then pushes the newline separated values onto a CJam stack and finally outputs to STDOUT from there. Twice as easy to use as perl :^)

Related/duplicate: http://codegolf.stackexchange.com/questions/21319/detect-what-programming-language-a-snippet-is

@mbomb007 I feel your disappointment. May I suggest to ask your own question? "Not so long ago, the following question was asked..."

Your first example is also valid GolfScript. 2. I expect Simple Programs to be recognized. Does that mean our submission has to work only for those examples?

@Dennis 1. I encountered "unexpected token" using http://copy.sh/golfscript/; is ther anything wrong with my approach or the interpreter? is there another interpreter I should use?  2. At least those examples. If the answer only works with them, that's ok. Hard-coding the answers feels cheaty, but I don't have an effective criterion to counter that. I guess an answer which is more complete will have more upvotes, but for the byte count criterion, those examples are enough.

copy.sh's interpreter deviates from the spec in many aspects. The first example works using the official Ruby interpreter or http://golfscript.apphb.com/. 2. In that case, I'd recommend including all test cases a submission has to pass in the question body.

@FryAmTheEggman And if the Seriously program encounters a syntax error during any stage, it tries to interpret that stage as Perl instead. :P LET'S MAKE IT! Combining the interpreters, though...

Some test cases that aren't in the language are needed.

And this, my friends, is why shebangs were invented.

I will give a 150 rep bounty to the first solution that is eligible for the gold bonus and validates inputs based on pattern matching, rather than my simple solution of running the programs through the interpreters.

"I did not check which of those are polyglot." If so then how do we know whether our solution is complying with "If the input is valid in multiple languages, each detected language should be printed/returned."?

The set of falsy test cases also contradicts that rule. I haven't checked all of them but most of them are absolutely valid GolfScript programs (there aren't many ways to create a syntax error in GolfScript). If we shouldn't just check the syntax of the program, what exactly determines whether a program is "valid" in a language or not?

@MartinEnder Thanks, I'll look at this.

I think this challenge needs to better define what counts as a valid program in each language (especially given that GolfScript and CJam share a number of primitives). In many cases, the program can run in a given language, but it'd be insane to write it like that.

@ais523 It's clear based on the test cases that a valid program exits without errors (aka exit code 0). All of the test cases cause errors when run in a different language than intended. While it wouldn't hurt to add that specification to the challenge, it's not unclear now.

@Mego: At least one of the programs is a polyglot, and appears in both the GolfScript and CJam sections; additionally, at least one of the Pyth testcases runs without error in GolfScript.

I'm pretty sure there's a language called Seriously now.

@CalculatorFeline Yes indeed. But there is no answer to this challenge written in "Seriously", yet.

Ruby, (135 + 4) * 0.6 * 0.8 = 66.72
This runs on Windows and I'm too tired to shorten it by running on Unix.
(a=[%w(javaw -jar cjam),%w(python pyth),%w(rubyw golfscript)].map{|c|c[-1]if system(*c,?f,'> NUL','2>','NUL')}-[nil])==[]?'Seriously':a

I did these things but I'm not sure if they're allowed:

Rename cjam-[version].jar to cjam, pyth.py to pyth, golfscript.rb to golfscript.
Read from file f instead of getting input. (Add IO.write(?f,gets); to the beginning to fix that, and the new length is (153 + 4) * 0.6 * 0.8 = 75.36)

Unfortunately, I can't test it (a combination of Windows and a lack of time). It looks good and your score is lower, so I am moving the checkmark.

Python 2, 332 * 0.6 * 0.8 = 159.36
import os
from subprocess import*
from tempfile import*
f,n,a=NamedTemporaryFile(delete=0),open(os.devnull,'w'),''
f.write(os.read(0,256))
f.close()
for l in["CJam","java","-jar","cjam.jar"],["Pyth","./pyth.py"],["Golfscript","./golfscript.rb"]:a+=(l[0]+' ')*(call(args=l[1:]+[f.name],stdout=n,stderr=n)>0)
print a or'Probably Perl'

As far as I'm aware, this is within the rules. Requires the Pyth, CJam, and Golfscript interpreters (pyth.py, cjam.jar, and golfscript.rb) in the current directory, and Python 3, Java, and Ruby installed. Simple test: try running the program. If it returns with 0, we're good. If not, it's invalid. A named temporary file (e.g. a file created in $TMP) is created to hold the program, since CJam doesn't have a script option. The delete=False flag is necessary to prevent the file from being deleted when it is closed (the OS will take care of it for us). The file has to be closed before attempting to read from it (though manually flushing the file should also work, but this is simpler). stdout and stderr are redirected to /dev/null to suppress output/errors (note that this makes it only work on *NIX systems).
Extra fun: try running the given code in all 4 languages, to see what we get:
import sys
from subprocess import*
from tempfile import*
c=["Cjam","java","-jar","cjam.jar"]
p=["Pyth","./pyth.py"]
g=["Golfscript","./golfscript.rb"]
e=["Perl","perl"]
f=NamedTemporaryFile(delete=False)
s=sys.stdin.read()
f.write(s)
f.close()
n=open('/dev/null','w+')
a=''
for l in [c,p,g,e]:
    try:
        print '%s: %s'%(l[0],check_output(args=l[1:]+[f.name],stderr=n))
    except:
        continue
n.close()

+1 Nice answer. And it only requires 6 interpreters to run, well done ;-)

bash, Python 2, Python 3, Ruby, Java, CJam, Pyth, Golfscript - I count 8.

That's right. And with the right input file, it can even wipe your home directory. Anyway, this is a valid approach, I don't mind.

Just let's hope you get no programs with endless loops, or returning non-zero.

@Mego if a program itself fails for some reason (like when opening a file which does not exist – or when it is expecting arguments, which I suspect might happen more often for actually productively used programs), it should return a non-zero value according to that decade-old standard. This doesn't mean it doesn't belong to that language. (It might be none of the test cases are actually of that type, though.)  Another case might be waiting for input, like a cat program ... maybe you should at least try to redirect /dev/null also to the input?

You can golf another 12 chars by moving the values of c,p,g into the for statement.

Do you need the continue?  i.e. can you replace it with a 1?  It seems to be at the end anyway.

@RikerW That version was for extra fun, and is not 100% golfed.

How is this not a violation of the third rule, no online interpreters.

@GregTourville Because it doesn't rely on any online interpreters - it requires the interpreters to be locally present.

That is interpreting the question too literally (common loopholes); an online interpreter and offline interpreter are effectively the same, it is not hosted by your program.

@GregTourville I disagree, and so does the challenge author. My understanding is, online interpreters were disallowed to prevent attempts at exploiting this loophole.

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


text:
Confidant Numbers
Confidant Numbers
Let x be an integer of an arbitrary base, such that D is an array of its digits. x is a Confidant Number if, for all n between 1 and the length of D:
D[n+1] = D[n] + D[n-1] + ... + D[1] + n

Take, for example, the number 349 in base 10. If we label the indices for this number, we have the following.
Index    Digit
-----    -----
1        3
2        4
3        9

Starting from the first digit, we have 1 + 3 = 4, which yields the next digit. Then with the second digit we have 3 + 4 + 2 = 9, which, again, yields the next digit. Thus, this number is a Confidant Number.

Given an integer with a base between 1 and 62, calculate all the Confidant Numbers for that base, and output a list of them, separated by newlines. You can assume that there is a finite amount of Confidant Numbers for a given base.
For digits greater than 9, use the alpha characters A-Z, and for digits greater than Z use the alpha characters a-z. You will not have to worry about digits beyond z.
They do not have to be output in any particular order.

Sample Input:
16

Sample Output:
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
12
23
34
45
56
67
78
89
9A
AB
BC
CD
DE
EF
125
237
349
45B
56D
67F
125B
237F

This is code golf, so the shortest code wins. Good luck!
(Thanks to Zach for helping out with the formatting and pointing out a few problems.)

Sorry, little confusion between me and Zach on the question. Everything should be formatted right now.

A useful observation: in a confidant number, each digit is one plus double the previous digit, except the second digit is instead one plus the first digit.

Going columnwise reveals another (possibly) useful pattern ;)

In the example, why is CD not in the list? Since all other combinations where the second digit is one more than the first digit are listed, I don't understand why CD does not qualify.

That was an accident :P Fixed, thanks for pointing it out.

Pyth, 38 bytes
0jms@L+s`MT+rG1Gdf<eTQsm.u+N+lNsNQ]dSQ

Try it online: Demonstration
Explanation:
0jms@L+s`MT+rG1Gdf<eTQsm.u+N+lNsNQ]dSQ  implicit: Q = input base
0                                       print 0
                       m            SQ  map each d of [1, 2, ..., Q] to:
                        .u       Q]d      start with N=[d], apply v Q times
                          +N+lNsN           add (len(N) + sum(N)) to N
                                          gives all intermediate results
                      s                 join to one list of candidates
                 f<eTQ                  filter those, where every digit < Q
  ms@L+s`MT+rG1Gd                       convert numbers to letters 0-9A-Za-z
 j                                      print each on separate line

Python 2, 104 bytes
n=input()
for i in range(n):
 s=''
 while i<n:s+=chr(48+i+(i>9)*7+i/36*6);print s;i+=n**0**i+i*(s>s[:1])

This uses the following observation: in a confidant number, the digit i is followed by 2*i+1, except it's i+1 instead for the second digit. By trying all possible first digits and adding more digits until they get too big, we can generate all confidant numbers.
We compute the character corresponding the number i as chr(48+i+(i>9)*7+i/36*6), which shifts it into the number, uppercase letter, or uppercase letter range for the intervals 0-9, 10-35, 36-61.
Then, we increase i via i+=i+1 with two adjustments. To make this instead i+=1 after the first digit, we add i conditional on s having more than 1 chars. Also, we need to avoid numbers starting with 0 from being printed, while at the same time allowing 0. To do this, we do a hack that causes i=0 to fail the condition i<n on the next loop by adding n to it. This is done by replacing 1 with n**0**i, which right-associates to n**(0**i), which equals n**(i==0) or n if i==0 else 1.

Wow, dang. Nearly half the size compared to Python 3! Hmm. I wonder how many bytes I can save if I use some of your tricks...

Python 3, 201 200 bytes
n=int(input())
X=[[i]for i in range(1,n)]
for x in X:
 y=sum(x)+len(x)
 if y<n:X.append(x+[y])
X=[[0]]+X
print('\n'.join(''.join(map(lambda x:[str(x),chr(x+55),chr(x+61)][(x>9)+(x>35)],x))for x in X))

Explanation
The key insight here is that given a sequence x (like, say, [1,2,5]), you can get the next term in the sequence with sum(x)+len(x), which gives 11 in this case (B). Check to see if this is less than n, and if it is, add the extended sequence to the list of all such sequences (seeded by all single digits).
[str(x),chr(x+55),chr(x+61)][(x>9)+(x>35)]

This is how I map sequence items to characters. These are ''.joined together and then printed, separated by newlines.

You can save one byte by changing your last line to print('\n'.join(''.join(map(lambda x:[str(x),chr(x+55),chr(x+61)][(x>9)+(x>35)],x))for x in X)). Also, currently it's 201 bytes; not 200.

@ZachGates: I did think of that, but didn't realize I could leave out the brackets. Thanks!

GS2, 44 bytes
26 c8 2f 08 4d 08 40 64 45 2e 30 42 67 40 24 d0
75 d3 20 e1 35 09 cb 20 23 78 22 09 34 30 e0 32
08 86 84 30 85 30 92 58 09 34 10

It produces the numbers in a different order, but the problem description doesn't specify, so I'm going for it!  Here's the output for input of 16.
1
12
125
125B
2
23
237
237F
3
34
349
4
45
45B
5
56
56D
6
67
67F
7
78
8
89
9
9A
A
AB
B
BC
C
CD
D
DE
E
EF
F
0

Here are the mnemonic equivalents for the bytes:
read-num dec save-a
range1
{
    itemize
    {
        dup
        sum
        over length
        add

        swap right-cons

        dup last push-a le

            push-d eval
        block2 when
    }
    save-d eval
    init inits tail
} map

+ ' fold

{
    ascii-digits
    uppercase-alphabet catenate
    lowercase-alphabet catenate
    select
    show-line
} map

0

Oh man, this is awesome. I've been trying to learn GS2 but I've been having a real rough time with it :P

CJam, 46 42 40 bytes
ri:R,{Q{+_A,s'[,_el^+f=oNo__,+:+_R<}g&}*

Try it online in the CJam interpreter.
How it works
ri:R            e# Read an integer from STDIN and save it in R.
,               e# Push [0 ... R-1].
{               e# Fold; For each element but the first:
                e#   Push the element.
  Q             e#   Push an empty array (accumulator for base-R digits).
  {             e#   Do:
    +           e#     Concatenate the integer and the array on the stack.
    _           e#     Push a copy of the result.
    A,s'[,_el^+ e#     Push "0...0A...Za...z".
                e#     See: http://codegolf.stackexchange.com/a/54348
    f=          e#     Replace each base-R digit with the corresponding character.
    oNo         e#     Print the resulting string and a linefeed.
    _           e#     Push another copy of the accumulator.
    _,+         e#     Append its length to it.
    :+          e#     Add all digits (including the length).
    _R<         e#     Push a copy of the result and compare it with R.
  }g            e#   If the sum is less than R, it is a valid base-R digit,
                e#   the comparison pushes 1, and the loop is repeated.
  &             e#   Intersect the accumulator with an integer that is greater
                e#   or equal to R. This pushes an empty array.
}*              e#

At the end 0 and a few empty arrays are left on the stack, so the interpreter prints 0.

gawk, 111 bytes
{for(n=$0;n>c=++i;)for(j=0;n>$++j=c+=j;print"")for(c=k=0;k++<j;c+=$k)printf"%c",$k+($k>9?$k>35?61:55:48)}$0="0"

For every starting digit from 1 to base-1 it calculates the next digits, and while these are lower than the base we still have a confidant number. Calculating the next digit while printing. Finally prints 0.


text:
Maze generating one liner
The famous C64 basic one liner
10 PRINT CHR$(205.5+RND(1)); : GOTO 10

prints a maze of slashes and backslashes.
\\/\\\//\/\////\\/\/
\/\///\\///////\//\/
/\\\//\//\////\\//\\
\////\//\//\/\\\\\\/
/\/\\///\\\\/\\\\/\\
\/\//\\\\\\//\/\////
/\//\\///\/\///\////
\/\\\//\\/\\\//\\/\/
//////\\/\\/\/\/\///
\\/\/\\////\/\/\\/\/

Read in such maze made of diagonal walls from stdin and print out the same maze with horizontal and vertical walls consisting of the wall character "#"
For example the small maze
/\\
\\/
///

translates to
     #####
     #   #
     # # # #
     # # # #
 ##### # # #
       #   #
   #########

     #####

To be precise, each isolated wall segment has the length of five characters, adjacent wall segments share a corner. Moving a character to the right/left/top/down in the matrix of slashes and backslashes corresponds to a diagonal translation by 2 characters in vertical and 2 characters in horizontal direction in the #-matrix.
More context can be found in the book 10 print.

Another output example would probably be useful. And I expect the title should be "one liner".

Will the input maze always be a rectangle? Could you should a larger example so we can see the spacing?

Welcome to Programming Puzzles & Code Golf Stack Exchange! Great first challenge, but a few things: can input/output be something other than STDIN/STDOUT (ex. as a function argument and return value)? Can lines be separated via a character other than newlines?

The input will be an n times m rectangle.

Using stdin and stdout is obligatory if possible, otherwise "the closest equivalent." Are there reasons to weaken the newline-assumption?

Related: http://codegolf.stackexchange.com/q/37390/194 , http://codegolf.stackexchange.com/q/21730/194

@PeterTaylor: Bonus, but not obligatory: handle ' ' (space) to procure a general slash image inverter.

Is trailing whitespace (newlines and/or spaces) allowed in the output?

@zgarb: yes xxxxxxxxx

@codegolf.stackexchange: Why am I not allowed to be concise? Why is there a minimum length of a comment - in this very place?

Ok, how about preceding whitespace?

At most 5 preceding whitespace in front of the lower left corner of the original picture, no preceding newline.

reasons to weaken the newline-assumption: in JavaScript inside a browser console, I can get input (stdin like) using prompt. But prompt does not manage multiline input well

You can save some memory by re-writing the program as follows 0 PRINTCHR$(205.5+RND(1));:GOTO

Python 3, 226 224 bytes
My first Python golf, so probably very sub-optimal.
It produces a whole lot of trailing whitespace, but there are no preceding newlines, and at most two preceding spaces.
The input needs to be given by hand from command line (maybe someone knows a shorter way to get multiline input in Python...).
e,z,s=enumerate,'0',list(iter(input,""))
p=''.join(s)*5
r=[len(p)*[' ']for _ in p]
for y,l in e(s):
 for x,c in e(l):
  for i in range(-2,3):r[2*(x+y+(s>[z]))+i*(c>z)][2*(x+len(s)-y)+i*(c<z)]='#'
for l in r:print(''.join(l))

The idea is to initialize a huge array of spaces r, then iterate through the input and replace the spaces with # as needed, and finally print the whole array.
A trick I used is to compare characters to z = '0' instead of testing equality to '/' or '\', which saves a bunch of bytes.

Julia, 258 bytes
A functional solution...
A=split(readall(STDIN))
q(i,j)=fld(i-1,j)
n,^ =A[].(3),q
f(i,j)=try A[1+i^5][1+j^5]<'0'?(i+j)%5==1:(i-j)%5==0catch 0end
h(i,j)=f(i+i^4,j)|f(i+(i-1)^4,j)
g(i,j)=h(i,j+j^4)|h(i,j+(j-1)^4)
for i=1:6length(A),j=-n-5:2n;print(" #"[1+g(i-j,i+j)],j==2n?"\n":"")end

In order of appearance:
f covers '/' and '\' by their 5*5 bit patters,
h folds every fifth and following line into a single line (recall "adjacent wall segments share a corner") and g does the same for the columns. Finally, i-j,i+j rotates the picture.

JavaScript (ES6), 258
A function with the maze as a parameter, returning the output.
Unsure if it's valid, due to the input/output rules (it was fun anyway)

f=m=>([...m].map(c=>{if(c<' ')x=sx-=2,y=sy+=2;else for(x+=2,y+=2,d=c>'0',i=y-3*d,j=x-3*!d,c=5;c--;)o[i+=d][j+=!d]='#';},w=m.search`
`,h=m.match(/\n/g).length,sy=y=0,sx=x=h*2,o=Array(z=(w+h+1)*2).fill(' ').map(x=>Array(z).fill(x))),o.map(r=>r.join``).join`
`)

// LESS GOLFED

U=m=>(
  w=m.search`\n`,
  h=m.match(/\n/g).length,
  o=Array(z=(w+h+1)*2).fill(' ').map(x=>Array(z).fill(x)),
  sy=y=0,
  sx=x=h*2,
  [...m].forEach(c=>{
    if(c<' ')x=sx-=2,y=sy+=2
    else for(x+=2,y+=2,d=c>'0',i=y-3*d,j=x-3*!d,c=5;c--;)o[i+=d][j+=!d]='#';
  }),
  o.map(r=>r.join``).join`\n`
)

// TEST
out=x=>O.innerHTML+=x+'\n'

test=`\\\\/\\\\\\//\\/\\////\\\\/\\/
\\/\\///\\\\///////\\//\\/
/\\\\\\//\\//\\////\\\\//\\\\
\\////\\//\\//\\/\\\\\\\\\\\\/
/\\/\\\\///\\\\\\\\/\\\\\\\\/\\\\
\\/\\//\\\\\\\\\\\\//\\/\\////
/\\//\\\\///\\/\\///\\////
\\/\\\\\\//\\\\/\\\\\\//\\\\/\\/
//////\\\\/\\\\/\\/\\/\\///
\\\\/\\/\\\\////\\/\\/\\\\/\\/`
out(test),out(f(test))

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


text:
Palandrome-ish code
Create a program that does the same thing forwards and backwards, in different languages. “Different languages” does not include different versions of the same language.
Challenge
This program can take any input and write anything to stdout and stderr.
However, the program must output exactly the same things for the same input when run backwards in the other language. This explicitly includes anything written to stderr while the program is running, including errors. The length of the output from stdout and stderr must sum to at least 5. The minimum program length is 2 bytes.

This is a popularity-contest, so the answer with the most votes wins.
Comments are allowed, however the commented text must take up less than ¼ of the total program.

This is too broad because there is no real objective for the code, or criteria for judging one program better than another.

Also, changing it to code-golf is no good because 1 would be valid in numerous languages. BTW, "derivative language" is not well defined at all.

@Calvin'sHobbies should I remove that?

@ETHproductions The challenge is making it do the same thing. I have also removed the derivative languages stipulation.

Would comments and programs that crash with errors be allowed?

@ASCIIThenANSI Yes and Yes. However, the errors must be exactly the same.

BF + Foo
You saw it coming
-[------->+<]>-.-[->+++++<]>++.+++++++..+++."olleH"


text:
Counting Cunningham chains
Prime numbers have always fascinated people. 2300 years ago Euclid wrote in his "Elements"

A prime number is that which is measured by a unit alone.

which means that a prime is only divisible by 1 (or by itself).
People have always looked for relations between prime numbers, and have come up with some pretty weird (as in "interesting") stuff.
For example a Sophie Germain prime is a prime p for which 2*p+1 is also prime.
A safe prime is a prime p for which (p-1)/2 is also prime, which is exactly the backwards condition of a Sophie Germain prime.
These are related to what we are looking for in this challenge.
A Cunningham chain of type I is a series of primes, where every element except the last one is a Sophie Germain prime, and every element except the first one is a safe prime. The number of elements in this chain is called it's length.
This means that we start with a prime p and calculate q=2*p+1. If q is prime too, we have a Cunnigham chain of type I of length 2. Then we test 2*q+1 and so on, until the next generated number is composite.
Cunningham chains of type II are constructed following almost the same principle, the only difference being that we check 2*p-1 at each stage.
Cunningham chains can have a length of 1, which means that neither 2*p+1 nor 2*p-1 are prime. We're not interested in these.
Some examples of Cunningham chains
2 starts a chain of type I of length 5.
2, 5, 11, 23, 47
The next constructed number would be 95 which isn't prime.
This also tells us, that 5, 11, 23 and 47 don't start any chain of type I, because it would have preceeding elements.
2 also starts a chain of type II of length 3.
2, 3, 5
Next would be 9, which isn't prime.
Let's try 11 for type II (we excluded it from type I earlier).
Well, 21 would be next, which isn't prime, so we would have length 1 for that "chain", which we don't count in this challenge.
Challenge

Write a program or function that, given a number n as input, writes/returns the starting number of the nth Cunningham chain of type I or II of at least length 2, followed by a space, followed by the type of chain it starts (I or II), followed by a colon, followed by the length of that type of chain.
  In case a prime starts both types of chains (type I and type II) the chain of type I is counted first.
Example: 2 I:5

Bear in mind, that n might be part of a previously started chain of any type, in which case it shouldn't be considered a starting number of a chain of that type.
Let's look into how this begins
We start with 2. Since it is the first prime at all we can be sure that there is no chain starting with a lower prime that contains 2.
The next number in a chain of type I would be 2*2+1 == 5. 5 is prime, so we have a chain of at least length 2 already.
We count that as the first chain.
What about type II?
Next number would be 2*2-1 == 3. 3 is prime, so a chain of at least length 2 for type II too.
We count that as the second chain. And we're done for 2.
Next prime is 3. Here we should check if it is in a chain that a lower prime started.
Check for type I: (3-1)/2 == 1. 1 isn't prime, so 3 could be a starting point for a chain of type I.
Let's check that. Next would be 3*2+1 == 7. 7 is prime, so we have a chain of type I of at least length 2. We count that as the third chain.
Now we check if 3 appears in a type II chain that a lower prime started.
(3+1)/2 == 2. 2 is prime, so 3 can't be considered as a starting number for a chain of type II. So this is not counted, even if the next number after 3 in this chain, which would be 5, is prime.
(Of course we already knew that, and you can and should of course think about your own method how to do these checks.)
And so we check on for 5, 7, 11 and so on, counting until we find the nth Cunningham chain of at least length 2.
Then (or maybe some time earlier ;) ) we need to determine the complete length of the chain we found and print the result in the previously mentioned format.
By the way: in my tests I haven't found any prime besides 2 that started both types of chains with a length greater than 1.
Input/Output examples

Input
1
Output
2 I:5

Input
10
Output
79 II:3

Input
99
Output
2129 I:2

The outputs for the inputs 1..20

2 I:5
2 II:3
3 I:2
7 II:2
19 II:3
29 I:2
31 II:2
41 I:3
53 I:2
79 II:3
89 I:6
97 II:2
113 I:2
131 I:2
139 II:2
173 I:2
191 I:2
199 II:2
211 II:2
229 II:2

A list of the first 5000 outputs can be found here.
This is code golf. Arbitrary whitespace is allowed in the output, but the type and numbers should be seperated by a single space and a colon as seen in the examples. Using any loopholes is not allowed, especially getting the results from the web is not allowed.
Good luck :)

Forgot to mention in the sandbox: it's easy to prove that 2 and 3 are the only primes p for which both 2p-1 and 2p+1 are primes, so 2 is the only prime which starts non-trivial Cunningham chains of both types.

Okay. Thanks for your help :)

(Converted comment from answer.) There aren't any primes other than 2 with a dual chain length greater than 1. Here is a proof by elimination.

Well thanks for pointing that out in such detail again. Did you just want to remark that or do you think I should change the challenge somehow because of this?

Only a remark. I don't think it changes the challenge in any case, only potentially helpful for golfing: when one chain is found, the other doesn't need to be checked.

A prime is divisible by TWO whole numbers: 1 and itself.

I guess Euclid took it for granted that a number is divisible by itself. ;) Or can be measured by itself.

Related OEIS

Javascript, 236 208 bytes
Saved 28 bytes:
p=(n,i=n)=>n%--i?p(n,i):i==1;f=n=>{for(k=2,c=0;c<n;k++){p(k)&&!p((k-1)/2)&&p(2*k+1)&&(c++,l=1,r='');p(k)&&c-n&&!p((k+1)/2)&&p(2*k-1)&&(c++,l=-1,r='I');};alert(--k+` I${r}:`+eval(`for(j=1;p(k=2*k+l);j++);j`))}

Saved 9 bytes on p function with: p=(n,i=n)=>n%--i?p(n,i):i==1
The t function was replaced by the eval(...) statement directly in the f function.

Previous solution:
p=n=>{for(i=n;n%--i&&i;);return 1==i};t=(n,m)=>{for(j=1;p(n=2*n+m);j++);return j};f=n=>{for(k=2,c=0;c<n;k++){p(k)&&!p((k-1)/2)&&p(2*k+1)&&(c++,l=1,r='');p(k)&&c-n&&!p((k+1)/2)&&p(2*k-1)&&(c++,l=-1,r='I');};alert(--k+` I${r}:${t(k,l)}`)}

Example: f(6)
Output: 29 I:2
Explanation
I'm using 3 functions
1 p: to know if n is prime :
p=n=>{for(i=n;n%--i&&i;);return 1==i}
2 t: to know the length of the Cunningham chain starting with n of type I or II depending on the m parameter which will be 1 or -1 :
t=(n,m)=>{for(j=1;p(n=2*n+m);j++);return j}
3 f: counts the chains (for loop) then display the result
f=n=>{for(k=2,c=0;c<n;k++){p(k)&&!p((k-1)/2)&&p(2*k+1)&&(c++,l=1,r='');p(k)&&c-n&&!p((k+1)/2)&&p(2*k-1)&&(c++,l=-1,r='I');};alert(--k+` I${r}:${t(k,l)}`)}

for loop: for each number the Cunningham chain (I then II if needed) is valid if

the number is prime
the predecessor is not prime
the successor is prime

Wolfram Language (Mathematica), 182 bytes
Union[Flatten[DeleteCases[Table[c@x_:=Module[{t=0,p=Prime@k},If[PrimeQ[(p-x)/2],1,While[PrimeQ@p,p=2p+x;t++];t]];{Prime@k,If[#==1,"I","II"],c@#},{k,7!}],{a_,b_,1}]&/@{1,-1},1]][[#]]&

Try it online!


text:
The Doughnut Shop™
Being short of cash, you have signed up to build donuts for The Doughnut Shop™, the biggest digital doughnut company in the world, mostly because they sell every size of doughnut imaginable.
Now, given that trading standards nowadays is very tough, you need to write a piece of code as short as possible to create these doughnuts so that the source code that created them can be put on the outside of the packet.
Challenge
Given 4 inputs, radius of the outer ring, radius of the inner ring, the possible sprinkles and the chance of a cell having a sprinkle, output a doughnut covered in those sprinkles which has the correct inner and outer radii.

The input may be taken how you wish (arguments to a function, stdin, program arguments) and in any order.

The sprinkles will be given in the form of 1 character per sprinkle type
^+*- as sprinkle input would be a list of 4 sprinkles, ^, +, *, -
The chance of a sprinkle will be entered as a floating point value between 0 and 1. eg: 0.1, 0.23

You must print out the output to stdout or equivalent.
Sprinkles can't be on the edges of the doughnut.
Each type of sprinkle must have an equally likely chance of being on each cell.
The radii are given in 1-cell units.
If the inner radius equals either 0 OR the outer radius, the doughnut is said to have no ring.
Both radii will be non-negative integers.
The inner and outer edges of the doughnut must be represented using hashes (#)
A test to see if a point is in a circle, given a radius and the center of the circle is:
(x-center)**2+(y-center)**2 < radius**2

Example input with output
(outer radius, inner radius, sprinkles, chance of sprinkle)

10, 4, "^+*-", 0.1
     #########
    #         #
  ##  ++   *  *##
  #             #
 #       ^^ - *  #
#      #####   ^  #
#+    #     #     #
#    #       #-   #
#    #       #  * #
#    #       #+   #
#    #       #    #
#^  +#       #    #
#     #     #     #
# *    #####      #
 #       +  -    #
  #        ^    #
  ##  ^  +     ##
    #       ^ #
     #########

5, 2, ":^+*", 0.9
  #####
 #^^+ ^#
#**###  #
#:#   #^#
#^#   #*#
#:#   #*#
#:+###* #
 # *:^:#
  #####

This is code golf, the shortest answer in bytes wins

Should there be an equal distribution of sparkles, or non uniform distribution will also do.

There should be an equal distribution of sprinkles.

It's not clear to me from the spec which positions correspond to the borders of the circles.

@Dennis I'd rather not change it and disqualify the only answer (that's a nice answer too) but I meant for a border to be where circle met non-circle (point is in circle but not all neighbors are)

Your example output pretty much invalidates it already, since the shapes for 10, 4 and 5, 2 are pretty different. I was going to leave a comment on the answer, but I realized that I didn't really understand how the output should look like for any dimensions but those in the examples. If you want to change your original idea match the output from the answer, that's up to you, but the challenge should clearly define how to draw the borders either way.

MATLAB, 231 bytes
Here a matlab solution:
function g=z(r,q,s,p);[x,y]=meshgrid(1:2*r,1:2*r);d=(x-r).^2+(y-r).^2;h=size(d);e=zeros(h);e(d<r^2 & d>=q^2)=1;f=bwperim(e,4);k=rand(h);j=numel(s);l=changem(randi(j,h),s,1:j);g=char(e);g(:,:)=' ';g(k<=p)=l(k<=p);g(f)='#';g(~e)=' ';

Some examples:
>> z(10, 4, '^+*-', 0.1)

ans =

     #########
    #         #
  ##           ##
  #    -       -#
 #               #
#   -  #####    ^ #
#     #     #     #
#   -#       #    #
# *  #       #+   #
#**  #       #    #
#  * #       # -  #
#+  *#       #    #
#     #     #     #
#      #####      #
 #           ^   #
  #     *       #
  ##+          ##
    #         #
     #########

>> z(5, 2, ':^+*', 0.9)

ans =

  #####
 #++::*#
#^^###++#
# #   #+#
#^#   #^#
#*#   #*#
#+:###^*#
 #*:^+^#
  #####

>> z(20,6, 'erthhjjjjkjkk', 0.4)

ans =

             #############
           ##jh  k  k  k  ##
         ##  jjj    j khh   ##
        #r kj h   k tjhj j    #
      ##jk    t k  jh j       h##
     #k       rre            k j #
    # j   j j  j  khtkt jr     kj #
    #  k   rk je    j      h   j  #
   # j   k   k  jth e k j   j    j #
  #h   h h e     t e ej  j  r k r e #
  #    j   r  jh  jk     j  kk   j  #
 #      k     k    h k  jk     k j   #
 #  jjk   hh k hj  r  j  je rjj k j  #
#  ek  j j jj  h#######          hke  #
#hj      k j j #       #ke jhkt  jee  #
#        jk  k#         # k    j   t  #
#k        j  #           #khk  r     j#
#   tj  j te #           # j  r j j   #
#e   je   jhk#           #        t j #
#jj    j  h  #           #     k jj e #
# j j   hj j #           # jkt kjjjr e#
#j k    e    #           #       r   k#
#jj  k    ek #           # hj  j rtj  #
#   k j   hk h#         #     j  h j  #
#   h trt  jrht#       #   et        k#
#j  ehjj      j #######ett  kh kjj k  #
 #   r  jj    ekk jk    th k   kkk h #
 #hj       khe kj hr  jj   kk  r j   #
  #r t    k j  k r  j  jk k hh    jj#
  #  kjj  h k j       j rrr j  r j  #
   #j kej  jj    t       h  j   hh #
    #  he   e  tje j  tjhkjk kj   #
    #j kt rjk    j j  ee    rkj   #
     #   jjr e  j jkt j   e  j  j#
      ##k  thhjj je   kj  kh   ##
        # hje  j     jj kk t j#
         ## k       h     e ##
           ## e jje   kkhj##
             #############

Python, 263 bytes
So I saw a challenge with no answers that looked relatively easy but also interesting and thought to myself:
Hmm... If I'm the only one with an answer, I'll be winning until a better answer inevitably shows up.
So I sat down with Python for a few minutes and came up with a rough draft which, with the help of the community's suggestions, I have been tweaking to reduce its size.
from random import*
def D(O,I,S,P):
 a=range(-O,O+1);C=lambda x,y,z,n:(n-.5)**2<x*x+y*y<(z+.5)**2
 if I>=O:I=0
 for y in a:
  R=''
  for x in a:
   if C(x,y,O,O)+(C(x,y,I,I)&(I!=0)):R+='#'
   elif C(x,y,O,I)&(uniform(0,1)<P):R+=choice(s)
   else:R+=' '
  print(R)

For the examples above, this creates
>>> D(10, 4, "^+*-", 0.1)
       #######
     ##       ##
    #         * #
   #             #
  #          + ^  #
 # +               #
 #   + +#####   -  #
#      ##   ##    ^ #
#     ##     ##  *  #
#-    #       #     #
#     #       #  +  #
# +   #       #     #
#     ##     ##     #
#      ##   ##  *   #
 #+-    #####      #
 #             - - #
  #   -    -     +#
   #      ^      #
    # -    +    #
     ## *     ##
       #######
>>>

and
>>> D(5, 2, ":^+*", 0.9)
   #####
  #*^:* #
 #^::*:^*#
#* :###+*:#
#:*#   #+:#
#::#   #+ #
#+:#   #*:#
#^^:###::^#
 # + :*^ #
  # *:+*#
   #####
>>>

I highly doubt that this is the shortest possible solution, but I think it worked out pretty well for a self-taught teenager's attempt to kill time. Since this was designed to be as small as possible, I have not included comments and have taken shortcuts on every variable name and as such, this program is more for usability than readability.
Should you want to use this code for some reason unbeknownst to me, just run it in IDLE and type the command
D(Outer Radius, Inner Radius, Sprinkles, Chance of Sprinkle)

in the format described above.

Welcome to PPCG! This is a good first answer, but there's a lot of room for improvement. For starters, removing unnecessary whitespace and shortening all variables to single letters will help, as well as removing the abs call, since the radii are guaranteed to be non-negative. I also recommend checking out Tips for golfing in Python for additional pointers. Again, welcome!

This is a nice first answer!

Additionally, folks around here tend to use https://mothereff.in/byte-counter for UTF-8 byte counts, just to have a consistent bases. Also, the recommended format for answers starts with ## Language, xx Bytes such as ##Python 2, 57 bytes -- I see that cat just edited that in for you. Please enjoy your stay!

Tip: Call the function D and not Donut, this saves 4 chars, N=False if I==0 or I>=O else True could be not (I==0 or I>=O) and the function C could be a lambda. But it's a really good first entry!

you can save on indentation by moving multiple statements onto the same line with semicolons.

additionally, i don't think you use P more than once, so there is no point is saving the *100 in a variable.

You don't seem to be using the math module anywhere, too.
Also, from random import*;r=randint is shorter

@AnonymousNoLifer Hi currently this answer is invalid - could you explain to me how your answer chooses where to plot the borders so I can change the challenge so it is? Thanks

Neither (n - 0.5)^2 nor (z + 0.5)^2 requires importing math. Also if you use from random import*, you can do uniform(0,1)<P (without multiplying by 100) and choice(S).

@muddyfish I initially tried to make it so the border was exactly on the line of the circle, but this left a lot of gaps so I smoothed it a bit to find all the areas between two circles of radius r-0.5 and r+0.5 to remove gaps.

@Dennis Thanks, I always thought that the n**p thing was part of the math module for some reason.