text:
Code golf for the lazy
Your goal in this code golf is to take two strings, language and code (if the golfed code you wrote for this is multiline, then this variable would be multiline.), and one integer, bytes. They represent the variables for a programming language, number of bytes it takes, and the code itself.
After that, you are going to format it like a code golfer does it.
The output variable is a multiline string called answer.
You can use multiline strings on:

C++
Python
Perl
JavaScript

If you search Stack Overflow, you should be able to find more programming languages that support it.
Here is a template of the output markdown. The code variable is in a code block, and there is a second-level header.
## {language}, {bytes} bytes

     {code}

Here is what the output would look like when pasted into a Markdown parser.

{language}, {bytes} bytes
    {code}

Variables are assumed to be filled out already as the language you coded your code golf entry in, the number of bytes it takes, and the actual code for it.
Here is another example of the output as code, this time with variables filled out:
## JavaScript, 1337 bytes

document.getElementById("foo").innerHTML = bar;

Here is the version as a blockquote:

JavaScript, 1337 bytes
    document.getElementById("foo").innerHTML = bar;

Bytes can be taken off from your code if you use a way to set the text of a
 element in HTML by the id result, like the following JavaScript code:
document.getElementById("result").innerHTML = answer;

Make sure to also include the

 in the HTML section of JSFiddle for this to work.
Scoring
Like all code-golf questions, the code that uses the least amount of bytes is the best.

Can the header look like # Language Name, Byte Count instead of ## Language Name, Byte Count?

@dorukayhan No.

Will {code} ever be a multiline code?

Does our output have to exactly match yours, or does it just have to be valid mark down?

@DrGreenEggsandIronMan, it needs to be an exact match except the variables have to be replaced.

Can't you use the builtin js snippet instead of JSFiddle?

"Variables will be filled out as the language you coded your code golf entry in, the number of bytes it takes, and the actual code for it." Am I the only one interpreting this as a quine variation?

@primo yeah, I'm actually very confused by all the current answers. E.g. the top-rated Java one seems to be assuming the existence of a variable b such that b[0]=="Java" && b[1]=="70" && b[2]=="String A(String[]b){return\"## \"+b[0]+\", \"+b[1]+\" bytes\\n\\n    \"+b[2];}", which really feels like cheating. I would have expected that the program would have to generate those outputs itself, not read them in from a magic variable.

Since the answers are solving two completely different problems, I'm putting this on hold this as unclear. Please clarify whether language, bytes and code are input or whether this is a [tag:quine] variant where those things should match the solving code itself. (And if so, whether directly or indirectly reading that source code is allowed, and whether quine built-ins are allowed.)

@MartinEnder They are inputs. code and language are strings, and bytes are integers.

Could you also clarify Adnan's question whether the input code can itself contain linefeeds?

@Adnan, yes, you can do that just like you do with the answer.

@MartinEnder Okay, I've clarified that to them. I'm also editing the question to make sure people understand that we're assuming all the variables except answer will already be filled out.

If {code} contains linefeeds, do we need to indent each line with four spaces, or only the first?

@msh210 Do whatever you want.

@Peanut You realize that in an actual PPCG answer, you'd have to indent each line for it to be formatted correctly?

@Peanut I'm confused. Can we assume code will not be multiline, or can't we? Please indicate that in the challenge text

05AB1E, 21 bytes
Code:
“## ÿ, ÿ¡Ï
“,|v4ð×y«,

Uses the CP-1252 encoding. Try it online!.

This doesn't handle multiline strings

@DrGreenEggsandIronMan Fixed.

And so the V vs O5AB1E battle continues... Nice job!

@DrGreenEggsandIronMan I'll be waiting for the next ASCII art challenge to take revenge :).

Java, 70 bytes
String A(String[]b){return"## "+b[0]+", "+b[1]+" bytes\n\n    "+b[2];}

Assumes b[0] is the language name, b[1] is the byte count, and b[2] is the code.
Making it compilable costs 9 bytes, resulting in a 79-byte non-standalone program:
class a{String A(String[]b){return"## "+b[0]+", "+b[1]+" bytes\n\n    "+b[2];}}

The equivalent monolithic program is 103 bytes long:
interface a{static void main(String[]A){System.out.print("## "+A[0]+", "+A[1]+" bytes\n\n    "+A[2]);}}

The monolithic one works with command line arguments, assuming these just like the non-standalone program:

First argument is the language name
Second argument is the byte count
Third argument is the code

Java (lambda expression), 56 48 bytes
(b)->"## "+b[0]+", "+b[1]+" bytes\n\n    "+b[2];

This is a java.util.function.Function<String[], String>.

None of these programs/functions handle multiline strings. To do so, simply replace b[2] and A[2] with b[2].replace("\n","\n    ") and A[2].replace("\n","\n    ") - doing so adds 23 bytes.

I'm not near a computer right now to confirm it, but can't you use \t or something to replace the 4 spaces after the two newlines?

@R.Kap Sometimes using tabs instead of spaces creates a mess on SE.

Ah, I see. So does the byte count take into consideration \t and not 4 spaces?

@R.Kap Exactly.

Lose the parens on the lambda; you can save two bytes with just b->.

What happens if there's more than one line of code?

V, 24  bytes
Note that there is a trailing space at the end.
This program makes the assumption that {code} will not be on multiple lines.
Op has clarified, "code" may be a multiline string. This 24 byte version works:
2é#á $á,JA bytes
vGî4é

Since this contains an unprintable character, here is the readable version:
2é#á $á,JA bytes
<esc>vGî4é<space>

Where <esc> is the literal escape character, e.g. 0x1B.

It always seems like a constant struggle between Jolf and V... :3

JavaScript (ES6), 56 bytes
(l,b,c)=>`## ${l}, ${b} bytes

`+c.replace(/^/gm,`    `)

Also, for laughs, here is an answer that formats itself for me:
JavaScript (ES6), 68 bytes
f=_=>`## JavaScript (ES6), ${`${f}`.length+3} bytes\n\n    f=${f};`;

Print the result of f().

@PatrickRoberts Oops, I didn't actually check the length, I just copied and pasted it, then later added 6 bytes for the (ES6). (Why did Cᴏɴᴏʀ O'Bʀɪᴇɴ only bother to change the length?)

C#, 40 38 bytes
(a,b,c)=>$"## {a}, {b} bytes\n\n\t"+c;

C# lambda where inputs and output are strings.

C#, 59 bytes
(a,b,c)=>$"## {a}, {b} bytes\n\n\t"+c.Replace("\n","\n\t");

With handling of a multiline answer.

C#, 71 bytes
The 38 bytes solution which print itself
()=>$"## C#, 38 bytes\n\n\t"+@"(a,b,c)=>$""## {a}, {b} bytes

\t""+c;";

Try them online

Python 3.5, 40 33 bytes:
(-7 bytes thanks to some clarification from Mego)
lambda*f:'## %s, %s bytes\n\n\t%s'%f

An anonymous lambda function that takes inputs as positional arguments in the format <function name>(String, Number, String) and outputs a multiline string.
Try It Online! (Ideone)

You can shave off several bytes if you make the parameter list *f and drop the tuple call.

@Mego Unfortunately, that does not work, as I get TypeError: not enough arguments for format string whenever I run it like that.

Works fine when I try it - you have to take positional arguments instead of a list argument. Additionally, you can drop the space between the # and the %.

@Mego Wow, that is so weird, because when I try it in PyCharm with Python 3.5.1, I get an error. That confused me so much. Also, the space between the # and the lambda is needed, or so I think.

@Mego It's updated.

Mathematica, 40 bytes
Print["## ",#,", ",#2,"bytes

    ",#3]&

Anonymous function. Takes the language, byte count, and program as input and prints the body to STDOUT.

Jolf, 24 22 bytes
"## ¦i, ¦j Ξ/u3

    ¦

Not much to explain here. ¦ means interpolated input.
Try it here! Output for the input in the link is:
## Jolf, 24 bytes

    some filler code I think

Input is as:
name

number

"code"

MATL, 28 27 bytes
1 byte saved thanks to @NinjaBearMoneky's suggestion
35tOj', 'j' bytes'10t4Z"j&h

Try it online!
The code block must be on a single line.
Explanation
35t           % Push 35 (ASCII for '#') twice
0             % Push 0. When converted to char, it will be displayed as a space
j             % Input string (language name)
', '          % Push this string
j             % Input string (byte count)
' bytes'      % Push this string
10t           % Push 10 (ASCII for linefeed) twice
4Z"           % Push string containing four spaces
j             % Input string (code)
&h            % Concatenate everything into a string. Implicitly display

Common Lisp, 57 bytes
(lambda(L b c)(format()"## ~A, ~A bytes~%~%    ~A"L b c))

Also, for fun, here below is a snippet of code which prints a header for itself.
Common Lisp, 146 bytes
#1=(PROGN
(SETF *PRINT-CIRCLE* T)
(LET ((S (FORMAT NIL "~S" '#1#)))
  (FORMAT NIL "## Common Lisp, ~A bytes~%~%    ~A" (LENGTH S) S)))

Ruby, 63 bytes
def f(l,b,c) s="\#\# #{l}, #{b} bytes\n\n    #{c}";return s;end

Try it online: http://codepad.org/EIn0Gw9M

CJam, 26 23 bytes
Thanks to @NinjaBearMonkey for removing 3 bytes!
'#_Sl',Sl" bytes"N_S4*l

The code block must be on a single line.
Try it online!
Explanation
'#_S       e# Push character "#" twice, then a space
l          e# Read line from input
',S        e# Push a comma, then a space
l          e# Read line from input
" bytes"   e# Push this string
N_S4*      e# Push newline twice, then four spaces
l          e# Read line from input. Implicitly display

23 bytes: '#_Sl',Sl" bytes"N_S4*l

@NinjaBearMonkey Thanks! Edited. This idea saved a byte also for my other answer

hashmap, 29 bytes.
"## "i", "h" bytes.\n\n    "i

(I wrote that post with the program, but I had to escape \n into \\n)
Explanation:
"## "                         Push string
     i", "                    Push input and string
          h" bytes.\n\n    "i Push input as number and string, then the input.

Pyke, 25 bytes
"##"Q", "z" bytes"skd4*z+

Try it here!
Or
Pyke, 0 bytes
Try it here! - click the copy answer button ;)
EDIT -
It's just a feature of the website, it's cheating (or at least I would consider it so) because it never parses an AST and the web program probably isn't considered part of the language due to it not interacting with the language much (even though it is running the Pyke interpreter)

What makes the 0 bytes version work?

Can you add that to the answer? I'm not counting that but you can still keep it up there.

Hey @muddyfish, can you separate these into two answers?

@haykam if this is for the purposes of accepting an answer, I'd rather not as I don't think the 0 byte solution counts as actually using Pyke and feels too chesty

I won't accept that answer.

Emacs Lisp, 97 bytes
(lambda(l c)(format"## %s, %s bytes\n\n%s"l(string-bytes c)(replace-regexp-in-string"^""    "c)))

Also, since it can sometimes be tough to escape quotes and what not, a usage example that copies the string to the clipboard. (Mark region and use M-:)
Emacs Lisp, 184 bytes
(kill-new ((lambda(l c)(format"## %s, %s bytes\n\n%s"l(string-bytes c)(replace-regexp-in-string"^""    "c)))"Emacs Lisp"(buffer-substring-no-properties(region-beginning)(region-end))))

Perl 5, 35 bytes
A full program, this takes input as command-line arguments in reverse order. It requires -M5.01, which is free.
say pop.', '.pop.' bytes

    '.pop


text:
Use 16 colors while writing Hey! 4 times
i.e each byte appears in a different ANSI shell colour.
Rules

Resetting the color of the shell after output is not required
Must be output in STDOUT or the primary colour text output of your language.
Must be done programmatically (iterating through each color and letter of the string induvidually) instead of just writing a fixed string to shell like the reference command.
Must output the same as the reference command:
echo -e '\e[30mH\e[31me\e[32my\e[33m!\e[34mH\e[35me\e[36my\e[37m!\e[90mH\e[91me\e[92my\e[93m!\e[94mH\e[95me\e[96my\e[97m!'
on a recent version of bash (I am using 4.3 installed via Homebrew on OS X) i.e like this:

Obviously colours will vary based on terminal colour scheme.

Scoring
This is code-golf, so lowest bytes wins.

"Must be done programmatically (with iteration) instead of just writing a fixed string to shell like the reference command." Restrictions like this are highly problematic (several other answers on that post also apply). For a start it's not clear how much iteration is enough: can I have a loop with only two iterations that prints the first half and then the second half? Can I have a loop with ten iterations that prints the string on the first run and does nothing at all on the other nine?

If you're worried that printing the fixed string is always going to beat printing the output in a loop, then that usually indicates a problem of the challenge. Either, loops are going to beat fixed-output answers, in which case the restriction is unnecessary, or the fixed-output answers will be shorter in which case the restriction seems like a very artifical patch to a fundamental problem of the challenge.

Is the example order of colors binding, or may we use any order as long as all 16 are used?

Can I write "Heyyyyy..."?

Bash, 62
h=y!He
for i in {3,9}{0..7};do printf \\e[${i}m${h:i%4:1};done

Must be run from an actual script file.  If you want to try it from the command line, you'll need to escape the !, i.e. h=y\!He
Online.

C, 126 bytes
#define a"\x1B[%d;%dm"
#define b j,i++
i,j;main(){for(;i=30,j<2;j++)printf(a"H"a"e"a"y"a"!"a"H"a"e"a"y"a"!",b,b,b,b,b,b,b,b);}

output may vary depending on your compiler, linker, operating system, and processor
Ideone doesn't have colour output, so have a screenshot from my phone:

bash, 101 72 bytes
29 bytes saved with a trick from @DomHastings.
s='y!He'
for i in {30..37} {90..97}
do
printf "\e["$i"m"${s:$i%4:1}
done

If I hadn´t scrambled the string, this would have been 105 (($i+2)%4 instead of $i%4), just as my
previous approach, 105 bytes
function p
{
s='Hey!'
for i in {0..3}
do
let r=i+$1
printf "\e["$r"m"${s:$i:1}
done
}
p 30;p 34;p 90;p 94

Hooray for bash! Looks like you can use one brace expansion and negate the need for the if (... for i in {30..37} {90..97} ...) for 72!

dc, 72 71 bytes
Fi4C 2:c6B 3:c81 0:c23 1:c28si20[d1CP61Pn74Pd4%;cP1+dli>P]dsPx68si60lPx

Of course the escape codes won't render right on TIO, but you can still try it online!
First we set our input to base 15, this is solely for the sake of saving a byte. Make an array, c, of the code points for 'y', '!', 'H', and 'e'. We'll exploit the fact that 30 mod 4 == 90 mod 4; for both of our sets of color values, value mod 4 starts at 2, so that's where we put our 'H' in the array. From there it's just a matter of setting up a loop that runs until we hit the value stored in i. We have our color code on the stack, we print the necessary escape codes, print the stack value, mod 4 and print that value from the array c, then increment the stack. We run through this once starting from 30 w/ i set at 38, then once more starting from 90 w/ i set at 98.
Shaved off one byte by doing everything in base 15; decimal version below for slightly more clarity:
72 2:c101 3:c121 0:c33 1:c38si30[d27P91Pn109Pd4%;cP1+dli>P]dsPx98si90lPx

J, 59 bytes
echo,(u:27 91),"1(16$'Hey!'),.~'m',.~,/30 90":@+/i.8
exit''

Save it as a script to run using J. It will print the output to stdout with the escaped colors.

Doesn't this do only one single output of the entire string?

Octave, 78 bytes
c=[b=[a="\x1b[30m"' a a a;'Hey!'] b];c(4,:)+=0:7;d=c;d(3,:)+=6;disp([c d](:)')

Usage:
If the code is in a file hey.m:
$ octave hey.m
Hey!Hey!Hey!Hey!

APL (Dyalog), 38 41 bytes
Now returns right result too!
∊(⍕¨∊29 89∘.+⍳8){'\e[',⍺,'m',⍵}¨16⍴'Hey!'

Try it online!
16⍴'Hey!' cyclically reshape the string to length 16
(…){…}¨ apply the below anonymous function to each letter pairing it with the corresponding element for this list as left argument:
 ⍳8 1 through 8
 29 89∘.+ addition table with these numbers vertically and those horizontally
 ∊ ϵnlist (flatten)
 ⍕¨ format (stringify) each
 'm',⍵ prepend an "m"
 ⍺, prepend the left argument
 '\e[', prepend the string
∊ ϵnlist (flatten)

Python 3, 81 bytes
print(*['\33[%sm%s'%(i,'Hey!'[i%4-2])for i in range(30,98)if not 37<i<90],sep='')

A full program that prints to STDOUT.
How it works
for i in range(30,98)...       For all possible colour codes i in [30,97]...
...if not 37<i<90              If i is in the desired range [30,37] or [90,97]...
'\33[%sm%s'%(i,'Hey!'[i%4-2])  ...create a string of the form
                               '\033[{colour code}m{current string character}'...
[...]                          ...and store all strings in a list X
print(*...,sep='')             Print all strings in X with no separating space

Try it on CodingGround

Pyke, 25 bytes
"Hey!"4*F\mo8.D6*3+"["s_

Try it here!
                           - o = 0
"Hey!"4*                   -   "Hey!Hey!Hey!Hey!"
        F                  -  for i in ^:
                           -   stack = [i]
         \m                -   stack.append("m")
           o               -    o += 1
            8.D            -   stack.extend(divmod(^, 8))
               6*3+        -   stack[-1] = stack[-1]*6+3
                   "["     -   stack.append("[\x1b")
                        s  -   stack = sum(stack)
                         _ -  stack = reverse(stack)
                           - print "".join(^)

SmileBASIC, 39 bytes
FOR I=0TO 15COLOR I?("Hey!"*4)[I];
NEXT

4, 392 bytes
3.600486014960250603516045260553606546075560957610276119161318012111362072623336241062530021112402211255105115035005125205105115035015125215105115035025125225105115035035125235105115035045125205105115035055125215105115035065125225105115035075125235105115095005125205105115095015125215105115095025125225105115095035125235105115095045125205105115095055125215105115095065125225105115095075125234

Try it online!
Tip: use the -verbose flag.

Is it this language? http://esolangs.org/wiki/4

@JerryJeremiah yes

Perl 5, 50 bytes
49 bytes code + 1 for -p. Note that \x1b is a literal escape character. Utilises empty input which TIO doesn't support, so a newline is provided and not used.
$_="Hey!"x4;s/./\x1b[@{[(30..37,90..97)[$-++]]}m$&/g
Try it online!

PowerShell, 41 Bytes.
0..15|%{Write-Host -n('Hey!'[$_%4])-f $_}

The day we get an alias for Write-Host is a good day.

JavaScript 134 bytes
<script>
  var a=0;
  var c=["H","e","y","!"];
  for(;a<3;){
    var b=-1;
    for(;++b<4;){
      document.write(<b style='color:rgb(0,0,"+(a*4+b)+"'>"+c[b]);
    }
  }
</script>

Golfed
<script>a=0;c=["H","e","y","!"];for(;a++<3;){b=-1;for(;++b<4;){document.write(<b style='color:rgb(0,0,"+(a*4+b)+"'>"+c[b]);}}</script>

source: Stack Exchange

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

sort: votes


text:
Illustrate music beats
You know—they look like this:

source
The goal is to draw a music beats illustration like the following:
=     =      =
=  =  =      =          =
== = ==   =  ==     = ====
== ====  == ===   = = =======
======== == ====  = ========= =
=================================

The rules are:

The width of the illustration is 33 symbols, but if you need—any trailing spaces exceeding this width are allowed.
Each column is made of equals signs (=).
Each column has a random height (the height of the next column shouldn’t depend in any way on the height of the previous column), varying from 1 to 6. It’s also fine if it’s at least possible to get some input with no strict math probability (i.e. some inputs could appear more rarely than others).
A column can’t float above the bottom and have gaps in it.
Since every column has the minimal height of 1, the last row can’t have any gaps either—it always consists of 33 equals signs.
Since it’s possible to have no columns with the height of 6 (it’s all random after all): in this case you don’t need to have a top line made of spaces. Applies to any edge cases of this nature: if suddenly your code provided no columns with the height greater than 1, you don’t need to have additional lines made of spaces above the bottom line.
You don’t take any input.

@Lynn Oh, originally it did specify, but I accidentally removed it from the post.

(Nitpicking) That looks to me like a spectrogram at a given instant, rather than a representation of any beats

@Luis Oh, that could be. But I love music and this is my first association :))

Is ================================= allowed as an output, or do we need to put newlines before it?

@Leaky Nice example, edited.

Plot twist: you need to output a fixed (maybe a number given as the input) number of total = signs.

Are columns allowed to be separated by spaces? (i.e., bottom row would be = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =)

Is it OK to have extra lines above the output?

@LegionMa Nope.

@Jan You could, not required though.

"the height of the next column shouldn’t depend in any way on the height of the previous column" -- most languages' built-in random number generators are seeded. For this reason a function like Math.random() is directly calculable from its previous call if the parameters of the linear congruential generator are known, which means you'd have to modify most built-in random functionality in order to meet this criteria. I suggest that this is better-worded.

@Patrick I mean, you shouldn't specifically implement the dependance.

Pyth, 13 bytes
And I outgolfed Jelly.
j_.tm*hO6\=33

Try it online!
j_.tm*hO6\=33
    m      33  for 33 times:
       O6          yield a random number in [0,1,2,3,4,5].
      h            add one.
     *   \=        repeat "=" that number of times.
  .t           transpose, filling with whitespace
 _             reverse
j              join by newlines.

Why doesn't this work here?

@Insane Pyth is quite outdated on TIO.

@Dennis But I love TIO :'(

Dyalog APL, 14 bytes
⊖⍉↑'='⍴¨⍨?33⍴6

Explanation
33⍴6 33 repetitions of 6
? random integer in range [1,n] for each of the 33 6s
'='⍴¨⍨ equality symbol repeated each of those number of times
↑ convert list of lists to table of rows
⍉ transpose rows into columns, columns into rows
⊖ flip upside down
Example runs
Input is indented six spaces:
      ⊖⍉↑'='⍴¨⍨?33⍴6
=          ==        =      ==
= =    =   ==      ====     ==
= = = ===  ==  === ==== =  ===  =
= = ===== ==== === ==== = ====  =
=== ============== ==== ====== ==
=================================
      ⊖⍉↑'='⍴¨⍨?33⍴6
         =  =  =    =    =
  =      =  =  ==  == == =  =
 === == ==  =  === =======  =
==== == ==  ====== ==========   =
==== ============= ========== = =
=================================
      ⊖⍉↑'='⍴¨⍨?33⍴6
             =    =   =  =
         =   =    =   = == =
=      = =   =    ==  = ==== ===
= = =  = =   =    ==  = ==== ====
=====  = == ==  ============ ====
=================================

JavaScript (ES6), 116 bytes
(a=Array(33).fill``.map(_=>[,,,,,,].fill` `.fill('=',Math.random()*6)))[0].map((x,i)=>a.map(x=>x[i]).join``).join`
`

Check it out in the animated snippet below:

F = () => (a=Array(33).fill``.map(_=>[,,,,,,].fill` `.fill('=',Math.random()*6)))[0].map((x,i)=>a.map(x=>x[i]).join``).join`
`

var interval;
G = () => output.innerHTML = F().split('\n').map((r, i) => `<span id="row-${6-i}">${r}</span>`).join('\n');
A = () => {
  clearInterval(interval);
  if (auto.checked) {
    speed.disabled = false;
    interval = setInterval(G, speed.value);
  } else {
    speed.disabled = true;
  }
}
S = () => {
  if (stylized.checked) {
    output.classList.add('stylized');
  } else {
    output.classList.remove('stylized');
  }
}

generate.onclick = G;
auto.onchange = speed.onchange = A;
stylized.onchange = S;

G();
A();
S();
#output {
  background: #000;
  color: #9fff8a;
  overflow: hidden;
  padding: 1em;
  line-height: 1;
}

#output.stylized {
  line-height: 0.25;
  font-size: 2em;
  margin: 0.5em 0 0 0;
  padding: 0.5em;
}

.stylized #row-1 { color: #9fff8a; }
.stylized #row-2 { color: #c5ff8a; }
.stylized #row-3 { color: #e0ff8a; }
.stylized #row-4 { color: #ffe88a; }
.stylized #row-5 { color: #ffc28a; }
.stylized #row-6 { color: #ff8a8a; }
<button id="generate">Generate</button>
Auto: <input id="auto" type="checkbox" checked/>
Speed: <select id="speed">
  <option value="25">25</option>
  <option value="50">50</option>
  <option value="100" selected>100</option>
  <option value="200">200</option>
  <option value="400">400</option>
  <option value="600">600</option>
  <option value="800">800</option>
  <option value="1000">1000</option>
</select>
Stylized: <input id="stylized" type="checkbox" checked/>

Wow, that's really cool!

Jelly, 14 bytes
6x33X€”=ẋz⁶Ṛj⁷

Try it here.

Uh oh, that can't be right. Jelly must by definition be shorter than APL.

It's not very efficient, but 6ṗ33X works as well.

C, 87 bytes
f(x,y){for(y=6;y--;){srand(time(0));for(x=33;x--;)putchar("= "[rand()%6<y]);puts("");}}

Call as f();. This answer relies on the fact that six consecutive calls to time(0) return the same result (in seconds). This is virtually always true, but probably worth mentioning.

You put x and y to avoid to declare them as int. Since there is no input, is this allowed? If yes, it is a nice idea!

Just tried you code. You can run it with f(); Thats nice! I didnt know that C can do that.

I really like you code. I port it to C# for a result of 117 bytes.I am not sure about posting it because it is literally your code.

Feel free to post it, as long as you credit me. :)

84 bytes

Cheddar, 68 65 bytes (non-competing)
->(1:33).map(->IO.sprintf("%6s","="*Math.rand(1,7))).turn().vfuse

O_O Cheddar is actually doing good! Uses sprintf and turn to do a bulk of the work. vfuse is vertical-fuse meaning it joins the array but vertically. This is very golfy but also rather fast. Version is prerelease v1.0.0-beta.10, which post-dates the challenge.
Explanation
->           // Anonymous function
  (1:33)     // Range 1-33 inclusive
  .map(->    // Loop through the above range
    IO.sprintf("%6s",       // `sprintf` from C/C++
      "="*Math.rand(1,7)    // Repeat `=` a random time from [1,7)
    )
  ).turn().vfuse     // Turn it 90deg, and fuse it vertically

Some example runs:

05AB1E, 22 bytes
No auto joining, no automatic filling while transposing, osabie is doomed on this one. Code:
33F6ð×6L.R'=×ðñ})ø€J¶ý

Uses the CP-1252 encoding. Try it online!.

Python 2, 95 bytes
from random import*
x=map(randrange,[6]*33)
for y in range(6):print''.join('= '[z>y]for z in x)

MATL, 20 19 18 17 bytes
1 byte saved thanks to @Luis
33l2$r6*6:>!~61*c

Try it Online

Python 3, 115 bytes
Python never even had a chance...
from random import*
for k in zip(*[[' ']*(6-len(j))+j for j in[randint(1,6)*['=']for i in[0]*33]]):print(*k,sep='')

How it works
from random import*    Import everything in the random module
randint(1,6)*['=']     Create a list containing a random number in [1,6] of '='...
...for i in[0]*33      ...33 times...
[...]                  ...and store in a list X
for j in...            For all lists j in X...
[' ']*(6-len(j))+j     ...create a list containing j padded with the correct number of
                       spaces to give a height of 6...
[...]                  ...and store in a list Y

Y now contains a list for each output line, but transposed.

for k in zip(*...):...  For all lists k in the transpose of Y...
print(*k,sep='')        Print all elements in k with no separating space

Try it on Ideone

SpecaBAS - 76 bytes
1 FOR x=1 TO 33: r=1+INT(RND*6): FOR y=7-r TO 6: ?AT y,x;"=": NEXT y: NEXT x

Prints an equal sign at the relevant screen coordinate.

with a spot of colour and a GOTO loop it becomes

K4, 18 bytes
Essentially a port of the APL solution (unsurprisingly).
+-6$(33?1+!6)#'"="

Haskell, 164 Bytes
Being a purely functional language, Haskell was doomed from the start. I did it anyway and it turns out, that the necessary overhead is actually not that large.
import System.Random
import Data.List
f r n|r>n=' '|0<1='='
s=do
g<-newStdGen
mapM_ putStrLn$transpose$map(\n->map(f$mod n 6)[0..5])(take 33(randoms g)::[Int])

Usage:
s

Explanation:
import System.Random

to be able to use newStdGen and randoms
import Data.List

to be able to use transpose
f r n|r>n=' '|0<1='='

defines a function that prints a space if its first argument is larger than the second and a = otherwise. It is called with map (f m) [0..5] on a given number m and the list [0,1,2,3,4,5]. (See below)
s=do
g<-newStdGen

Creates a new standard random number generator
(take 33(randoms g)::[Int])

takes 33 random integers.
map(\n->map(f$mod n 6)[0..5])

Calculates m = n % 6 and maps (f m) to the list [0,1,2,3,4,5], which results in one of "======", " =====", ..., "     =". These lines are mapped to the list of the 33 random integers resulting in a table. (A table in Haskell is a list of lists)
transpose$

switches columns and rows of the table
mapM_ putStrLn$

prints every line in the table

C#, 200 117 bytes
()=>{var s="";int x,y=6;for(;y-->0;){var r=new Random();for(x=33;x-->0;)s+="= "[r.Next(6)<y?1:0];s+='\n';}return s;};

I move to @Lynn algorithm and save 83 bytes!
C# lambda without input and where output is a string. Try it online.
Code:
()=>{
    var s="";int x,y=6;
    for(;y-->0;){
        var r=new Random();
        for(x=33;x-->0;)
            s+="= "[r.Next(6)<y?1:0];
        s+='\n';
    }return s;
};

CJam, 19 bytes
{5mrS*6'=e]}33*]zN*

Try it online!
Explanation
{       e# 33 times...
  5mr   e#   Push a random number in [0 1 2 3 4 5].
  S*    e#   Create a string with that many spaces.
  6'=e] e#   Pad to length 6 with =.
}33*
]       e# Wrap all 33 strings in a list.
z       e# Transpose that list.
N*      e# Join the lines with linefeeds.

Ruby, 102 99 84 83 bytes
s='
'*203;33.times{|j|a=(' '*rand(6)).ljust 6,'=';6.times{|i|s[i*34+j]=a[i]}};$><<s

New and significantly shorter approach, where I start with string full of newlines.
Older version...
s='';204.times do|i|s+=->i{i%34==0?"\n":i>170?'=':s[i-34]=='='?'=':rand(2)==1?'=':' '}[i]end;puts s

...gave output with leading new line. My first submission in Ruby, using similar approach to @Barbarossa's one, but in single loop.
What I liked in Ruby while working on this program:

.times loop
rand() which is pretty short
stacking ternary operators without parentheses

I didn't like (mainly in terms of golfing):

mandatory $ for global variables not so mandatory in .times loop
do and end keywords which can be replaced with single-line block
0 is not falsy

Mathematica, 78 bytes
StringRiffle[(PadLeft[Array["="&,#+1],6," "]&/@5~RandomInteger~33),"
",""]&

Anonymous function. Takes no input and returns a string as output. The Unicode character is U+F3C7, representing \[Transpose].

J, 18 bytes
|.|:'='#~"0>:?33#6

Very simple stuff. With a bugfix from miles!

This picks random integers in the range [0, 6] whereas the OP wanted [1, 6]. You could do >:?33#6 to get random integers in the range [1, 6]. Also, a rank 0 copy would be shorter using '='#~"0. This results in |.|:'='#~"0>:?33#6 but unfortunately, the 2 byte savings end up being mitigated by the inclusion of the increment operator.

@miles Whoa, thanks! Very cool.

PHP, 95 92 89 bytes
<?php for(;++$i<34;)for($j=6,$e=' ';$j--;)$a[$j].=$e=rand(0,$j)?$e:'=';echo join("
",$a);

Pretty happy with this one actually. For a while I had a version that in theory could generate any input but in practise would generate only solid blocks of = but this is both shorter and equally distributed!
Generates 7 undefined something notices whenever you run it but that's fine.
edit: well I just learned that join is an alias of implode, so that's nice.

R, 102 bytes
m=rep(" ",33);for(i in 1:6){n=ifelse(m=="=",m,sample(c(" ","="),33,T,c(6-i,i)));m=n;cat(n,"\n",sep="")}

Explanation
m=rep(" ",33) init an empty vector for the upcoming loop
n=ifelse(m=="=",m,sample(c(" ","="),33,T,c(6-i,i))) If there's an = in the row above, then make sure the spot below also has an =; otherwise randomly pick. Random picks are weighted to make sure that a) the bottom row is all = and b) you get a neat shape to the whole thing.
cat(n,"\n",sep="") output that row to the console with a newline at the end and no spaces between elements!

Perl, 64 bytes
@f=$_="="x33;s/=/rand>.4?$&:$"/ge,@f=($_.$/,@f)while@f<6;print@f

Usage
perl -e '@f=$_="="x33;s/=/rand>.3?$&:$"/ge,@f=($_.$/,@f)while@f<6;print@f'
  = =           =  ==      =    =
  = =         ===  ==      =    =
= = =         ===  ==      =    =
= = =   = =   ===  ===   = =    =
= = == =====  === ====   ===  = =
=================================

Perl, 68 bytes
Alternative version that relies on ANSI escape codes to move the cursor around, first dropping down 6 lines, then writing the original line (all the =s), moving up a line and printing the replaced string (s/=/rand>.4?$&:$"/ge) repeatedly until it makes no more substitutions. This can end up writing more than six lines, but it is eventually replaced with an empty line.
Note: \x1bs are actually the ASCII Esc character.
print"\x1bc\x1b[6B",$_="="x33;print"\x1b[1A\x1b[33D$_"while s/=/rand>.4?$&:$"/ge

Charcoal, 12 bytes
Ｆ³³⁺×=⁺¹‽⁶¶⟲

Beats Pyth by 1 byte!
Link is to verbose version of code.
Try it online!

JavaScript, 179 bytes
Still working on golfing this a bit. I like this since it's straightforward.
n=>{a=Array(33).fill(0).map(n=>Math.floor(Math.random()*6)+1);r=Array(6).fill("");r.map((e,m)=>{a.map(n=>{if (n<=m+1){r[m]+="="}else r[m]+=" "})});return r.join('\n');}

Usage:
>q=n=>{a=Array(33).fill(0).map(n=>{return Math.floor(Math.random() * 6)+1});
r=Array(6).fill("");r.map((e,m)=>{a.map(n=>{if (n<=m+1){r[m]+="="}else r[m]+=" "})});return r.join('\n');}
>q();
           = =  =   =    = =
=   =    = = =  =  == =  = =  =
= = =  = === ====  ====  = = ===
= = =  = === ==========  =======
= === ===========================
=================================

You should be able to replace .map(n=>{return Math.floor(Math.random() * 6)+1}) with .map(n=>Math.floor(Math.random()*6)+1). Lambda are greats :)

if (n<=m+1){r[m]+="="}else may be if(n<=m+1)r[m]+="=" else

I had to make my own PRNG, and my Forth program isn't much longer. :P

Forth, 190 bytes
I had to create my own PRNG, an xor-shift taken from here. The word f is the word you would call multiple times to see the output.
variable S utime S !
: L lshift xor ;
: R S @ dup 13 L dup 17 rshift xor dup 5 L dup S ! 6 mod ;
: f
33 0 DO R LOOP
1 -5 DO
33 0 DO
I PICK J + 0< 1+ IF ." =" ELSE SPACE THEN
LOOP CR
LOOP
; f

Try it online - Note that the system time is one of two values based on which server (or something) is running the code. Other than that, they don't change in the online IDE for some reason. So you'll only see two possible outputs. You can manually set the seed by changing utime to an integer.
Ungolfed
variable seed                   \ seed with time
utime seed !

: RNG                           \ xor-shift PRNG
seed @
dup 13 lshift xor
dup 17 rshift xor
dup 5 lshift xor
dup seed !
6 mod                           \ between 0 and 6, exclusive
;

: f 33 0 DO RNG LOOP            \ push 33 randoms
    1 -5 DO                     \ for (J = -6; J <  0; J++)
        33 0 DO                 \ for (I =  0; I < 33; I++)
            I PICK J + 0< 1+ IF \ if  (stack[I] < J)
                61 EMIT         \ print "="
            ELSE
                32 EMIT         \ print " "
            THEN
        LOOP
        CR                      \ print "\n"
    LOOP
; f

Ungolfed online

JavaScript, 165 Bytes
// function that fills a column with a specified number of = signs
m=l=>Array(6).fill``.map((e,i)=>i<l?"=":" ");
// fill an array of 33 length with columns of random number of = signs
a=Array(33).fill``.map(e=>m(Math.ceil(Math.random()*6)));
// transponse the rows and columns and print to console
a[0].map((c,i)=>a.map(r=>r[5-i])).map(r=>console.log(r.join``))

The newlines are unnecessary but they make it easier to see what's going on. Not the most optimal solution, but it makes sense to me at least.

all_licenses: 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/


text:
Is it a max-heap?
A heap, also known as a priority-queue, is an abstract data type. Conceptually, it's a binary tree where the children of every node are smaller than or equal to the node itself. (Assuming it's a max-heap.) When an element is pushed or popped, the heap rearranges itself so the the biggest element is the next to be popped. It can easily be implemented as a tree or as an array.
Your challenge, should you choose to accept it, is to determine if an array is a valid heap. An array is in heap form if every element's children are smaller than or equal to the element itself. Take the following array as an example:
[90, 15, 10, 7, 12, 2]

Really, this is a binary tree arranged in the form of an array. This is because every element has children. 90 has two children, 15 and 10.
       15, 10,
[(90),         7, 12, 2]

15 also has children, 7 and 12:
               7, 12,
[90, (15), 10,        2]

10 has children:
                      2
[90, 15, (10), 7, 12,  ]

and the next element would also be a child of 10, except that there isn't room. 7, 12 and 2 would all also have children if the array was long enough. Here is another example of a heap:
[16, 14, 10, 8, 7, 9, 3, 2, 4, 1]

And here is a visualization of the tree the previous array makes:

Just in case this isn't clear enough, here is the explicit formula to get the children of the i'th element
//0-indexing:
child1 = (i * 2) + 1
child2 = (i * 2) + 2

//1-indexing:
child1 = (i * 2)
child2 = (i * 2) + 1

You must take an non-empty array as input and output a truthy value if the array is in heap order, and a falsy value otherwise. This can be a 0-indexed heap, or a 1-indexed heap as long as you specify which format your program/function expects. You may assume that all arrays will only contain positive integers. You may not use any heap-builtins. This includes, but is not limited to

Functions that determine if an array is in heap-form
Functions that convert an array into a heap or into heap-form
Functions that take an array as input and return a heap data-structure

You can use this python script to verify if an array is in heap-form or not (0 indexed):
def is_heap(l):
    for head in range(0, len(l)):
        c1, c2 = head * 2 + 1, head * 2 + 2
        if c1 < len(l) and l[head] < l[c1]:
            return False
        if c2 < len(l) and l[head] < l[c2]:
            return False

    return True

Test IO:
All of these inputs should return True:
[90, 15, 10, 7, 12, 2]
[93, 15, 87, 7, 15, 5]
[16, 14, 10, 8, 7, 9, 3, 2, 4, 1]
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
[100, 19, 36, 17, 3, 25, 1, 2, 7]
[5, 5, 5, 5, 5, 5, 5, 5]

And all of these inputs should return False:
[4, 5, 5, 5, 5, 5, 5, 5]
[90, 15, 10, 7, 12, 11]
[1, 2, 3, 4, 5]
[4, 8, 15, 16, 23, 42]
[2, 1, 3]

As usual, this is code-golf, so standard loopholes apply and the shortest answer in bytes wins!

Related

Is it correct that if there are repeated elements, it may be impossible to form a heap according to this definition?

@feersum What about [3, 2, 1, 1] ?

@feersum That's a great point, I hadn't thought of that. I updated the description of a heap and added some example with duplicate elements. Thank you!

A heap is not also known as a priority queue.
A priority queue is abstract data type.
A heap is  data structure sometimes used to implement a priority queue (The heap itself is implemented on top of even more fundermental data structures, but that is beside the point). Priority queues can be implemented on top of other data structures -- like linked lists.

Jelly, 11 9 5 bytes
x2:ḊṂ

4 bytes removed thanks to Dennis!
Try it here.
Explanation
x2          Duplicate each element.
:Ḋ          Each element divided by the input with the first element removed,
            as integer, so there is a 0 only if some element in the duplicated
            list is less than the corresponding element in the other.
            There are also elements left unchanged, but it doesn't matter as
            the input is all positive.
Ṃ           Minimum in the list.

JavaScript (ES6), 34 30 bytes
a=>!a.some((e,i)=>e>a[i-1>>1])

Edit: Fixing my code for the spec clarification cost 1 byte, so thanks to @edc65 for saving 4 bytes.

It fails testcase 2 [93, 15, 87, 7, 15, 5] and 6 [5, 5, 5, 5, 5, 5, 5, 5]

This works better and is 3 char shorter a=>!a.some((e,i)=>e>a[i-1>>1])

@edc65 Those testcases were added after I wrote my answer.

Haskell, 33 bytes
f(a:b)=and$zipWith(<=)b$a:b<*"xx"

or
and.(zipWith(<=).tail<*>(<*"xx"))

J, 24 bytes
*/@:<:]{~0}:@,<.@-:@i.@#

Explanation
*/@:<:]{~0}:@,<.@-:@i.@#  Input: s
                       #  Count of s
                    i.@   Create range [0, 1, ..., len(s)-1]
                 -:@      Halve each
              <.@         Floor each
         0   ,            Prepend a zero to it
          }:@             Remove the last value to get the parent indices of each
      ]                   Identity function to get s
       {~                 Take the values from s at the parent indices
    <:                    For each, 1 if it is less than or equal to its parent else 0
*/@:                      Reduce using multiplication and return

MATL, 13 12 bytes
ttf2/k)>~4L)

Try it online! Or verify all test cases.
An array is truthy if it is non-empty and all its entries are nonzero. Otherwise it's falsy. Here are some examples.
Explanation
t     % Take input implicitly. Duplicate
tf    % Duplicate and push indices of nonzero entries. This gives [1 2 ... n] where n
      % is input size
2/k   % Divide by 2 and round down
)     % Index into input. Gives array of parents, except for the first entry
>~    % True for entries of the input that don't exceed those in the array of parents
4L)   % Discard first entry

Python 2, 45 bytes
f=lambda l:l==[]or l[len(l)/2-1]/l.pop()*f(l)

Outputs 0 for Falsy, nonzero for Truthy.
Checks that the last element is less than or equal to its parent at index len(l)/2-1. Then, recurses to check that the same is True with the last element of the list removed, and so on until the list is empty.

48 bytes:
f=lambda l,i=1:l==l[:i]or l[~-i/2]/l[i]*f(l,i+1)

Checks that at each index i, the element is at most its parent at index (i-1)/2. The floor-division produces 0 if this is not the case.
Doing the base case as i/len(l)or gives the same length. I had tried zipping at first, but got longer code (57 bytes).
lambda l:all(map(lambda a,b,c:b<=a>=c,l,l[1::2],l[2::2]))

Vyxal r, 5 bytes
hJY≥A

Try it Online!

Pyth, 8 bytes
.AgV.i+h

       hQ      first element of input
      +  Q     plus input
    .i    Q    interleaved with input
  gV       Q   vectorized greater-than-or-equal comparison with input
.A             check if all results are true

Try it online

R, 97 88 82 bytes
Hopefully I've understood this correctly.  Now to see if I can get rid of some more bytes. Ditched the rbind and put in an sapply and deal with 1-based vector properly.
Implemented as an unnamed function
function(Y)all(sapply(1:length(Y),function(X)Y[X]>=Y[X*2]&Y[X]>=Y[X*2+1]),na.rm=T)

With a few of the test cases
> f=
+ function(Y)all(sapply(1:length(Y),function(X)Y[X]>=Y[X*2]&Y[X]>=Y[X*2+1]),na.rm=T)
> f(c(90, 15, 10, 7, 12, 2))
[1] TRUE
> f(c(93, 15, 87, 7, 15, 5))
[1] TRUE
> f(c(10, 9, 8, 7, 6, 5, 4, 3, 2, 1))
[1] TRUE
> f(c(5, 5, 5, 5, 5, 5, 5, 5))
[1] TRUE
> f(c(4, 5, 5, 5, 5, 5, 5, 5))
[1] FALSE
> f(c(90, 15, 10, 7, 12, 11))
[1] FALSE
> f(c(4, 8, 15, 16, 23, 42))
[1] FALSE

You can use seq(Y) instead of 1:length(Y).

CJam, 19 16 13 12 bytes
q~_:_\(;./:*

Golfed off 3 bytes thanks to Dennis.
Try it here.

Retina, 51 bytes
\d+
$*
^(?!(1+ )*(1+) 1* ?(?<-1>1+ )*(?(1)(?!))1\2)

Try it online!

Takes a space-separated list of numbers as input. Outputs 1/0 for truthy/false

C (GCC), 63 60 bytes
-3 bytes thanks to @Juan Ignacio Díaz
f(v,n,b,j)int*v;{for(b=j=0;n+~j;)b|=v[j/2]<v[++j];return!b;}
Attempt This Online!
Original note of the 63 bytes version:

I know 2 bytes can be saved by inverting the meaning of the values 0
and 1, but I prefer to keep it this way.

C++14, 134 105 bytes
#define M(d) (2*i+d<c.size()&&(c[i]<c[2*i+d]||f(c,2*i+d)==0))
int f(auto&c,int i=0){return!(M(1)||M(2));}

Requires c to be a container supporting .operator[](int) and .size(), like std::vector<int>.
Ungolfed:
int f(auto& c, int i=0) {
    if (2*i+1<c.size() && c[i] < c[2*i+1]) return 0;
    if (2*i+2<c.size() && c[i] < c[2*i+2]) return 0;
    if (2*i+1<c.size() && (f(c,2*i+1) == 0)) return 0;
    if (2*i+2<c.size() && (f(c,2*i+2) == 0)) return 0;
    return 1;
}

Could be smaller if truthy=0 and falsy=1 would be allowed.

100 bytes

R, 72 bytes
A slightly different approach from the other R answer.
x=scan();all(diff(x[c(a<-1:(N<-sum(1|x)),a,a*2,a*2+1)],l=N*2)<1,na.rm=T)

Reads input from stdin, creates a vector of all of the comparison pairs, subtracts them from each other, and checks that the result is a negative number or zero.
Explanation
Read input from stdin:
x=scan();

Create our pairs. We create indices of 1...N (where N is the length of x) for the parent nodes. We take this twice as each parent has (maximally) two children. We also take the children, (1...N)*2 and (1...N)*2+1. For indices beyond the length of x, R returns NA, 'not available'. For input 90 15 10 7 12 2, this code gives us 90 15 10  7 12  2 90 15 10  7 12  2 15  7  2 NA NA NA 10 12 NA NA NA NA.
                  x[c(a<-1:(N<-sum(1|x)),a,a*2,a*2+1)]

In this vector of pairs, each element has its partner at a distance of N*2 away. For example, item 1's partner is located at position 12 (6*2). We use diff to calculate the difference between these pairs, specifying lag=N*2 to compare the items to their correct partners. Any operations on NA elements simply return NA.
             diff(x[c(a<-1:(N<-sum(1|x)),a,a*2,a*2+1)],l=N*2)

Finally, we check that all of these returned values are less than 1 (i.e. that the first number, the parent, was bigger than the second number, the child), excluding NA values from consideration.
         all(diff(x[c(a<-1:(N<-sum(1|x)),a,a*2,a*2+1)],l=N*2)<1,na.rm=T)

Actually, 16 bytes
This answer is largely based on jimmy23013's Jelly answer. Golfing suggestions welcome! Try it online!
;;2╟┬Σ1(tZ`i<`Mm

Ungolfing
         Implicit input a.
;;       Duplicate a twice.
2╟       Wrap two of the duplicates into a list.
┬        Transpose the duplicates.
Σ        Sum all of the columns to get a flat list like this:
           [a_0, a_0, a_1, a_1, ..., a_n, a_n]
         This gets the parent nodes of the heap.
1(t      Get a[1:] using the remaining duplicate of a.
         This is a list of the child nodes of the heap.
Z`i<`M   Check if every child node is less than its parent node.
m        Get the minimum. This returns 1 if a is a max-heap, else 0.
         Implicit return.


text:
Calculate Swatch Internet Time
Output the current time of day as Swatch Internet Time.
Specifically, output a three-digit (zero-padded) number of ".beats" (1000ths of a day) which represent the current time of day in the Swatch Internet Time time zone of UTC+01:00 ("Biel Meantime").
For example, if the current time in UTC is 23:47, then it is 00:47 in UTC+1 ("Biel Meantime"), and the output would be 032.
Examples:
UTC Current Time  ->  SIT Output
23:47             ->  032
23:00             ->  000
11:00             ->  500
14:37             ->  651

The program should produce this output then immediately exit.
Output is to standard output (or equivalent). Must be a complete, runnable program, not a function. The program takes no input; it outputs the current time.

Possible dupe? From reading the article it looks like doing a minor amount of arithmetic on the output to that challenge. Perhaps if you described the intricacies of Swatch Internet Time within the post, it would be clearer whether or not this is a duplicate. That said, welcome to PPCG, I hope your first question goes well, but note we have a sandbox where challenges can be posted for review.

@FryAmTheEggman Hmm, yes, you're right, it's not that far from that challenge. It differs in that Swatch Internet Time has a fixed time zone, different formatting, and that I've only required the program output the time once.

@FryAmTheEggman Though note that unlike that challenge, you can't usually use date() or equivalent here, but PHP is an exception.

SE policy is that I should not need to visit external sites to understand and answer your question and the same goes for challenges. I don't know what SIT is, and when the thing hosting your link blows up, neither will anyone else.

Some more sample inputs and outputs would be nice. This challenge might have been better were it steeped in the Sandbox

What sort of precision is required?  Minute, hour, second ... for example if it is second, I need a factor of 0.69444 while for minutes 0.694 is sufficient (assuming a floored int as output)

032 does not seem to be the right SIT output for UTC 23:47. Presuming that the number of seconds is 0, the correct output should be 990.

I am voting to close this as "unclear what you're asking" because (a) we don't know what the format of the output should be, (b) neither do we know what the precision should be (up to hours, minutes, seconds, milliseconds, etc.), and (c) the SIT example output given for the example input 23:47 seems to be completely wrong, so people would be immensely confused unless they were to go to the SIT Wikipedia page linked, which, as @cat said, could, and probably will, blow up sometime in the future.

@R.Kap Swatch Internet Time does not use UTC, it uses UTC+1. 23:47 UTC is 00:47 UTC+1, no?

@Andrea Well, I assumed that you were using UTC+1 by just saying UTC without any reference to any other time zone. You should have been more clear about what time zone you were using in the example, because I, and nor will a lot of other people, know if the time in it is using UTC-1, UTC-2, UTC-3, etc. and therefore will get very confused.

@R.Kap I agree with your points a) and b), but it's obvious that if SIT is based on UTC+1 and it's currently 23:47 UTC(+0), it's 00:47 UTC+1, which agrees with Andrea's example. Hopefully we can get the question clarified, because I don't think it's a duplicate of the Current Time question.

@R.Kap “UTC” is the reference point from which other time zones are defined, it's no more ambiguous than GMT. Nonetheless, the updated post is clearer.

I've edited the post to provide more clarity. It now specifies the time zone (even if this is redundant), the formatting of the output (three digits, zero-padded), and that the program does not run continuously.

I've also now summarised what a “.beat” is.

Looks good, I've voted to reopen, but could we have more test cases?

@cat Okay, I've added three more examples. Turns out the first example I gave was a good choice, because it catches out code that does the time zone conversion incorrectly, and it demonstrates zero-padding.

@Andrea Awesome! I made the content a little more to the point and easier to read, and I made the test cases parsable by regex, which is important to me.

@Andrea Why did you disallow function answer?

@aloisdg because requiring output means the program has to do more, and that interests me

PHP, 12 bytes
<?=@date(B);

But it can only be so short because PHP has built-in Swatch Internet Time support. So this answer isn't much fun.

<?= exits HTML mode and evaluates an expression, then echoes it.
@ silences an error.
date() outputs the current time, formatting it with a given format string.
B is an undefined constant. In PHP, if you reference a constant that doesn't exist, you get back a string containing its name, and it also produces a “notice”-level error. Here, the @ suppresses that error. B is the date() format code for Swatch Internet Time.
; terminates the expression.

If we assume PHP is being run with the default error-reporting settings, where “notices” are silenced, we could skip the @, and it would only be 11 bytes.

I'm pretty sure supresssing notices is actually the default for PHP golfing on this site

@SuperJedi224 It's PHP's default configuration, too, but I have it set to show notices on my machine, so…

C, 56 bytes
main(){printf("%03d",(int)((time(0)+3600)%86400/86.4));}

Explanation:

%03d - tells printf to zero-pad up to 3 digits.
time(NULL)+3600 - gets amount of seconds (UTC) elapsed since epoch and adds an hour to it (UTC+1).
%86400 - divides epoch by the amount of seconds in a 24hr day and gets the remainder (representing seconds elapsed, so far, "today").
/86.4 - divide remaining seconds by 86.4 to get the ".beat" count since midnight (UTC+1).

Compile (MSVC):
C:> cl swatch.c
Compile (GCC):
$ gcc swatch.c

For future reference: you should post the golfed version of the code, and, at your option, an ungolfed version or test program below.

This contains a bug. It doesn't do a modulo after correcting the time-zone, it does it before, which means between 23:00–0:00 UTC (i.e. 0:00–1:00 UTC+1), it incorrectly produces a four-digit number. You could fix this by changing time(NULL)%86400+3600 to (time(NULL)+3600)%86400.

Also, you could save space by omitting the two includes, and replacing the NULL with 0.

Hmm, doesn't %03.f round up? That would give inaccurate results.

@Andrea Thank you.  Edited.

PHP, 48 46 bytes
<?=sprintf("%03d",((time()+3600)%86400)/86.4);

I have another PHP answer above, but this one avoids using PHP's built-in Swatch Internet Time support, so it's more interesting, if longer.
This is largely self-explanatory if you're familiar with UNIX time and sprintf, though note I'm using |0 as a short way to truncate a float to an integer (actually I realised this is unnecessary in PHP, oops!)

Java 8, 143 bytes
import java.time.*;interface A{static void main(String[]a){System.out.format("%03.0f",LocalTime.now(ZoneId.of("UT+1")).toSecondOfDay()/86.4);}}

this uses Java 8's java.time package to get current time, convert it to UTC+1, and then get the number of seconds. At the end it divides by the number of 1000s of seconds in a day, which turns out to be 86.4.
Funny how the function that actually calculates the time is only about a third of the overall program size.

05AB1E, 29 21 bytes
ža>60©%®*žb+₄*1440÷Dg3s-Å0š˜J

After compressing integers thanks to @KevinCruijssen (-8 bytes) :
ža>60©%®*žb+₄*Ž5¦÷₄+¦

Explanation:
ža>60©%®*žb+₄*1440÷Dg3s-Å0š˜J
ža                               push current hours in UT
  >                              increment
   60©                           push 60 and save in register c
      %                          hours mod 60
       ®*                        push from register c and Multiply
         žb+                     add current minutes
            ₄*                   multiply by 1000
              1440÷              Integer division with 1440
                   D             Duplicate
                    g            Length
                     3s-         3-length
                        Å0       create list of a 0s
                          š      Prepand
                           ˜J    Flat and joon

I didn't find a better idea for prepanding Zeros, so if anyone got a better idea I'll be glad to know :)
Try it online!
Try the 21 bytes online!

The output of this is not three padded digits, no?

Also, is 694 accurate enough? (I don't know.)

You're right on both comments.. will fix it :)

I've edited my answer

Are you sure this is using the correct timezone (UTC+1)?

Yes :) it prints the current swatch time, I pushed the current hours in UTC and Incremented it (mod 24).

The “tio.run” output I was looking at was outdated and just so happened to be exactly an hour behind! Clicking the big ▶ button re-ran it and I see your code is correct, sorry!

1440 can be compressed to Ž5¦ (see section How to compress large integers? in this 05AB1E tip of mine). As for the Dg3s-Å0š˜J, this can be golfed to ₄+¦ (add 1000, remove the first character).

Oh right! cool!

Javascript, 53 52 48 bytes
alert((new Date/864e5%1+1/24+'0000').slice(2,5))

Explanation:
new Date/864e5%1 is the fraction of a day in UTC. +1/24 adds 1/24th of a day (1 hour), moving it to UTC+1.
"0000" is concatenated with this, turning it into a string. Then the 3rd through 5th characters are taken. The reason "0000" is concatenated instead of an empty string is for the cases in which there are fewer than 3 decimal places:

"0.XXX(any number of digits here)0000" Swatch time is XXX
"0.XX0000" Swatch time is XX0
"0.X0000" Swatch time is X00
"00000" Swatch time is 000

(the first character is 1 instead of 0 from 23:00 UTC to 24:00 UTC, but the first character is ignored.)

JavaScript, 98 bytes
d=new Date();t=;console.log(Math.floor((360*d.getHours()+60*d.getMinutes()+d.getSeconds())/86.4));

Definitely could be optimized, I had some problems with the Date object so I'm looking into shorter ways to do that.

Hmm. You could probably be more efficient by using the UNIX timestamp feature (Date.prototype.getTime), instead of summing the hours, minutes and seconds. Also, though I didn't make this clear before, I think the output should be zero-padded.

Octave, 64 bytes
t=gmtime(time);sprintf("%03.f",(mod(++t.hour,24)*60+t.min)/1.44)

Uses veganaiZe's printf formatting.
I'm having a bit of difficulty with the time that ideone is returning, so here's a sample run with the time struct returned by gmtime for reference. I'll look around and see if I can get any of the other online Octave compilers to give me proper time.
t =
  scalar structure containing the fields:
    usec =  528182
    sec =  17
    min =  24
    hour =  21
    mday =  15
    mon =  6
    year =  116
    wday =  5
    yday =  196
    isdst = 0
    zone = UTC

ans = 933

Python 2.7, 131 128 121 bytes:
from datetime import*;S=lambda f:int(datetime.utcnow().strftime(f));print'%03.0f'%(((S('%H')+1%24)*3600+S('%M')*60)/86.4)

A full program that outputs the Swatch Internet Time.
Simply uses Python's built in datetime module to first get the UTC+0 time in hours and minutes using datetime.utfnow().strftime('%H') and datetime.utfnow().strftime('%M'), respectively. Then, the time is converted into UTC+1 by adding 1 to the hours and then modding the sum by 24 to ensure the result is in the 24-hour range. Finally, the hour is turned into its equivalent in seconds, which is added to the minute's equivalent in seconds, and the resulting sum is divided by 86.4, as there are 86.4 seconds or 1 min. 24 sec. in 1 ".beat", after which,  using string formatting, the quotient is rounded to the nearest integer and padded with zeroes until the length is 3.

However, I am not the one to stop here. In the above solution, I used a more direct method to convert the time to UTC+1. However, wanted to add a bit of a bigger challenge for myself and implement this using only Python's built in time module, which apparently does not have any built-in method that I know of to convert local time into UTC+0 time. So now, without further ado, here is the perfectly working version using only the time module, currently standing at 125 bytes:
from time import*;I=lambda g:int(strftime(g));print'%03.0f'%((((I('%H')+1-daylight)%24*3600+timezone)%86400+I('%M')*60)/86.4)

This can output the correct Swatch Internet Time for any and all time zones, and basically does pretty much everything the same as in the first solution, except this time converts the local time into UTC+1 by first adding 1 to the hour, and then subtracting 1 if daylight-savings time is currently, locally observed, or 0 otherwise. Then, this difference is modded by 24 to ensure that the result stays within the 24 hour range, after which it is multiplied by 3600 for conversion into seconds. This product is then added to the result from the built-in timezone method, which returns the local offset from UTC+0. After this, you finally have your hours in UTC+1. This then continues on from here as in the first solution.

Interesting! Though, it shouldn't be necessary to get this from stdin, given Python knows the current time, right?

@Andrea It is fixed and works perfectly now.

Hmm, intriguing. Might it be shorter using UNIX time?

q/k (21 bytes)
7h$1e3*(.z.n+0D01)%1D

Javascript, 83 bytes
a=(((36e5+(+new Date()))%864e5)/864e2).toFixed(),alert("00".slice(Math.log10(a))+a)

CJam, 34 bytes
Update: I shouldn't code hungry. My previous answer was shorter, but didn't cast to int or left-pad. These are now fixed, with +8 bytes to left-pad (probably improvable), +1 to int cast, and -2 to optimizations. My old comment no longer applies.
r':/~\~)24md60*@~+1.44/i"%03d"e%o;

Try it online
Explanation:
r                   read input
 ':/                split on :
    ~               unwrap array
     \~             evaluate hour to numbers
       )            increment hour
        24md        modulo 24
            60*     multiply by 60
               @~   switch to minute and eval to num
+                   add hour*60 and minute
 1.44/              divide by 1.44 to get SIT
      i             cast to int
       "%03d"e%     format as 3 leading 0s
               o;   output and discard spare 0 from modulo

I suppose the first three digits are correct, so maybe it's a valid entry in that way (I never said a newline was required…) but it's not supposed to have a decimal point or any fractional digits.

Oops, I missed that no decimal requirement. I have other optimizations I thought of in the last half-hour, so I'll just add a cast to int along with those.

@Andrea I missed the leading 0s requirement, so that's fixed as well. There may be a better way but I'm not very familiar with that part of CJam.

Japt, 27 23 19  15 bytes
Kj z86400 s t3n

Test it
Javascript port.
I hope I've done it correctly.
-4 bytes from Shaggy.
-4 more bytes from Shaggy.
-4 more more bytes from Shaggy.

I'm not entirely sure I've understood the challenge but this definitely isn't right; you need a space before the / and the t2,3 should be at the end, with a space before it, giving Kj +36e5 /864e5%1+"0000" t2,3. And, from there, you can get down to 23 bytes with 36e5+Kj)/864e5%1 x4 ¤¯3. When I figure the challenge out, I'll see if any more can be saved.

OK, think I've figured it out and you should be able to get down to at least 21 bytes by: claiming locale dependency (i.e., a UTC+1 timezone), getting the current hour, multiplying by 60, adding the minutes, floor dividing by 1.44, converting to a string and then left padding with 0s.

Oh, and welcome to Japt :)

Actually, feck that, just knock the first 5 bytes off the current version for 18 bytes. Dunno why I was trying to overcomplicate it!

@Shaggy wait, knocking that off is to claim locale dependency, correct?

Yup. [padding to 15]

Note to self: Atleast look at the tutorial before using a language.

16: K/864e5%1 x4 ¤¯3

15: Kj z86400 s t3n

14: K°z86400 s t3n - think that's as good as it's gonna get.

Python 3, 64 bytes
import time
t=time.gmtime()
print(int(-~t[3]%24/.024+t[4]/1.44))

Try it online!

This seems to be rounded differently than PHP's date("B"); but I guess it's close enough? (I don't know what the PHP code does, I'm guessing this is a ceil versus floor difference, or your constants aren't precise enough)

@Andrea the difference is probably that I'm using only the hour and minute specifiers, whereas I'm guessing the php implementation uses a more precise value. My approach is rounded down to the minute, as per all the test cases.

Fair enough! Swatch Internet Time is not very precise so I won't be pedantic over precision if it's only off by ±1.

C#, 112 bytes
class P{static void M(){System.Console.Write((int)((DateTime.UtcNow.TimeOfDay.TotalSeconds%86400+3600)/86.4));}}

C#, 68 bytes
()=>(int)((DateTime.UtcNow.TimeOfDay.TotalSeconds%86400+3600)/86.4);

A simple port of @veganaiZe's code. Thanks to him :)
Try it online!

Is this a "complete and runnable program"? I don't know much C#, but this looks like a lambda than a full program.

@YakovLipkovich Lambda are allowed on PPCG. Well I saw that here, in this specific question, they aren't. I asked why.

Since this adds 3600 after doing the modulo, won't it return the wrong result after 23:00 UTC?

@Andrea Maybe indeed. Did you try it after 23h?

@aloisdg I haven't tried your code yet, but it should be clear this will happen without running it.

Common Lisp (Lispworks), 144 bytes
(defun f(s)(let*((d(split-sequence":"s))(h(parse-integer(first d)))(m(parse-integer(second d))))(round(/(+(*(mod(1+ h) 24)3600)(* m 60))86.4))))

ungolfed:
    (defun f (s)
      (let* ((d (split-sequence ":" s))
             (h (parse-integer (first d)))
             (m (parse-integer (second d))))
        (round
         (/
          (+
           (*
            (mod (1+ h) 24)
            3600)
           (* m 60))
          86.4))))

usage:
CL-USER 2759 > (f "23:47")
33
-0.36111111111111427


text:
Print the ASCII printable character set
Challenge: Print the entire printable ASCII charset (not just a range!) in order.
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

Rules: read closely

No other characters allowed in the output.

Program/function does not accept input.

Try not to hardcode/embed the output.

This is code golf, shortest answer wins.

Well they are a couple main things about this challenge that are why it's getting downvoted. A) the community really doesn't like it when you ban golfing language (whether or not I agree with this is a different matter) B) it's rather simple but I wouldn't say it's exactly trivial (kinda on the edge). Also saying "Try not to ..." usually isn't a good sign because it's not actually enforcing it (because it's hard to enforce this objectively), and it might mean your challenge may not be found that interesting (therefore getting downvotes).

I'm not sure how to interpret try not to hardcode the output here. For a constant output challenge, that's the only way...

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

Do we have to print the output from a function or is returning a string acceptable?

Are built-ins accepted or not? The rule about hardcoding is not clear on that. The MATL answer form @Suever seems to use built-in that contains the printable ASCII.

Does "no other characters" include embedded newlines?

:( unfortunately the Brainfuck code +[+.] (5 bytes) doesn't count as it fails the first rule...

This is NOT a duplicate of that challenge! Programs there had to accept input and print only part of the table. This challenge is easier and different.

MATL, 3 bytes
6Y2

Try it Online
And for the sake of a non-built-in (7 bytes)
32:127c

Non-builtin: '~':.

@StewieGriffin Unfortunately that didn't work until 18.5.0. Here's what it looked like at the time of this challenge.

Brainfuck, 30 27 bytes
+[[>++<<+>-]>]<<<++[<.+>++]

Try it online!
How it works
+ changes the initial cell to 1. After this step, we enter the following, nested loop.
[        While the current cell is non-zero:
  [        While the current cell (C) is non-zero:
    >++      Increment the cell to C's right twice.
    <<+      Increment the cell to C's left.
    >-       Decrement C.
  ]
  >        Advance to the cell to C's right.
]

This computes consecutive powers of 2 until the the value 256 = 0 (mod 256) is reached. When the outer loop finishes, the tape is in the following state.
                                     v
001 002 004 008 016 032 064 128 000 000 000

<<<++ retrocedes three cells and increments twice, leaving the tape as follows.
                         v
001 002 004 008 016 032 066 128 000 000 000

Now we're ready to print the actual output. As a stop condition, we increment the cell above twice each time we print and increment the cell to its left. Since 66 + 95 × 2 = 256 = 0 (mod 256), we stop after printing all 95 printable ASCII characters. We achieve this as follows.
[      While the current cell (C) is non-zero:
  <      Retrocede to the cell to C's left.
  .+     Print its content and increment.
  >++    Increment C twice.
]

with Dennis brainfuck outgolfs procedual programming languages!

@Dennis - You may want to add a leading >. Your implementation runs off the tape to the left, which few interpreters support.

@owacoder On PPCG, languages are defined by their implementations. As long as there is one interpreter that behaves as desired (and the one on Try it Online! does), it's considered valid.

@owacoder Well actually a lot of interpreters support negative tape indices nowadays

Brainfuck, 40 39 bytes
++++[->++++[->++>++++++<<]<]>>>-[-<.+>]

Try it online.
Explanation
++++[->++++[->++>++++++<<]<]

The nested loops basically mean you multiply the number of plusses together, so 4 × 4 × 2 = 32 in one cell and 4 × 4 × 6 = 96. Here is the tape after running this:
00 00 32 96
 ^

>>>- moves the pointer to the fourth cell and decrements it. Now we're done with the setup. 32 is the code for space, the first printable ASCII character. 95 is the number of characters we have to print. Here is the tape now:
00 00 32 95
          ^

[-<.+>] runs until the current cell (the fourth one) is zero. It decrements the counter and prints the character and increments it for the next time.

Cheddar, 29 bytes
->(32:126).map((i)->@"i).fuse

Range from 32-126, loop over it and get the string at the given char code @" and the fuse together (join)
Cheddar, 7 bytes
32@"126

Unfortunately this is broken as of the current release but I'm sure you can go back some versions where this works

eyyy my @" operator!

@CᴏɴᴏʀO'Bʀɪᴇɴ it's a very useful operator 10/10

Retina, 18 bytes

~
{2`
$`
T01`p`_p
The leading linefeed is significant.
Try it online!
Explanation
Stage 1: Substitution

~
We start by replacing the empty (non-existent) input with a single ~.
Stage 2: Substitution
{2`
$`

The regex of this substitution is still empty, since the ` separates configuration from regex and {2 is therefore just the configuration. The { indicates that the remaining two stages should be run in a loop until they stop changing the output. The 2 indicates that this specific stage has a limit of 2, meaning that only the first two matches of the regex will be replaced. Since the regex is empty, that means we get an empty match in front of the string and an empty match after the first character.
This match is replaced with the prefix $` which refers to everything in front of the match. For the first match, there is nothing in front of it, so this doesn't insert anything, but for the second match, there is the leading character in front of it, which therefore gets duplicated.
Stage 3: Transliteration
T01`p`_p

Here, T activates transliteration mode, and 0 and 1 are limits (where 0 just means "don't set this limit"). Together, they mean "transliterate only the first character in the string". The actual transliteration maps from p to _p. Here, p expands to the printable ASCII characters and _ means "remove" this character, so the expanded lists look like this:
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
_ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

That means spaces get removed and all other characters get decremented by one.
To see how the last two stages act together here is the string after each of the first few and last stages:
~
~~
}~
}}~
|}~
||}~
{|}~

...

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

Since the state of the string is only checked after every other stage to determine whether to end the loop, and the two stages cancel each other once we reach the leading space (since Stage 2 adds a space and Stage 3 removes it), this terminates the loop and therefore the program.

Python 2.7, 36 bytes:
print''.join(map(chr,range(32,127)))

Simple enough. A full program that prints out the entire ASCII sequence in order.

Octave, 13 bytes
disp(' ':'~')

Try it on ideone.

Bash, 54 bytes
man ascii|fold -w1|LC_ALL=C sort -u|tr -cd '[:print:]'

Try it online!
I like that this uses the ASCII man page (which contains an ASCII table) to extract the characters.

Python 2, 30 bytes
print bytearray(range(32,127))

Try it online!

Pyth, 5 bytes
srd\

Try it here.
 r         range from
  d        space
   \<del>  to the delete character, 0x7F (included literally in the program)
s          sum (concatenate all)

JavaScript, 54 bytes
for(i=32;i<128;i++)console.log(String.fromCharCode(i))

Wasted quite a few bytes printing it... Also prints each char on a new line.

If you start the loop in 31, you can save one byte removing i++ and using String.fromCharCode(++i).

console.log can become alert if you don't mind clicking through 97 boxes

Java 8, 48 bytes
v->{for(char i=31;++i<127;)System.out.print(i);}

Try it online.
Explanation:
v->{                       // Method with empty unused parameter and no return-type
  for(char i=31;++i<127;)  //  Loop characters from ' ' to '~'
    System.out.print(i);}  //   And print it

CJam, 6 bytes
',32>

The second byte is a DEL character. Try it online!

Perl 6, 17 bytes
print |(' '..'~')

print chrs ^95+32

C, 40 bytes
f(){for(char i=32;i<128;i++)putchar(i);}

New here, but do you have to declare a func? (without the f(){ is not ok?)

@RingØ In C, you can't just write code without a function. each submission has to compile or run, so in JS for example it would be ok to not put the f() but it's required for C.

Bash + general Linux utilities, 18
jot -s '' -c 95 32

Brachylog, 3 bytes
@Pw

@P is the string that contains the printable ASCII characters so… yeah, not very interesting.
It's not clear whether OP accepts built-ins or not, and since others have posted answers that use built-ins, I'll use the 3 bytes version until OP clarifies this point.
With no built-in, 14 bytes
32:126e          Get a number between 32 and 126
       :"~c"w    Format that number to STDOUT as a char code
             \   Backtrack

TSQL, 53 bytes - Vertical solution
DECLARE @ int=32x:PRINT char(@)SET @+=1IF @<127GOTO x

Fiddle
TSQL, 75 71 68 bytes - Horizontal solution
DECLARE @ char(95)=''WHILE 95>LEN(@)SET @=char(126-LEN(@))+@ PRINT @

Fiddle

this can be executed on any version of sqlserver from this millennium

Horisontal=>Horizontal ;)

The second solution appears to be missing the leading space. You can save 3 bytes by changing SELECT to SET.

@BradC you are absolutely right, thanks. Fixed - considering my more complex answers, I can't believe i missed something this obvious.

Vertical solution isn't valid

@ASCII-only does it give incorrect result ? It executes fine in the fiddle

@t-clausen.dk Yeah, but IMO the newlines count as "other characters"

@ASCII-only I agree. It could very well be interpreted that way, which is why I provided both answers

Here's a varchar version that fixes the leading space, also builds from the left instead of the right: DECLARE @ varchar(94)=' 'WHILE 94>LEN(@)SET @+=char(LEN(@)+33)PRINT @

@BradC I tried with the varchar first. But saved 1 bytes building it from the right

@t-clausen.dk But I still don't get a leading space from your latest code, looks like all you did was change the SELECT to SET. If you change both 94s to 95 that seems to fix it.

Ruby, 17 bytes
$><<[*' '..?~]*''

or
print *[*' '..?~]

Canvas, 1 byte
Ｃ

Try it here!

Without builtin:
15 14 bytes
９⁵×４－｛⁷⁷＋＋╷ｃ］∑

Try it here!

:| that's really long without builtin

@ASCII-only yeah. ⁴⁷⁷＋＋╷ is the shortest way i could find to make the number 95 (Canvas only has literals for 0-9, and predefined variables for 10, Infinity, 256, 13, 64, 11, 12, 16, and 128.)

lol nvm found a shorter one

10 bytes

Elixir, 24 bytes
IO.puts Enum.uniq 32..?~

Try it online!
Prints a trailing newline. If that's not acceptable, it's +1 byte for write instead of puts.
uniq is the cheapest operation I managed to find for converting range to list. As a bonus, here are 4 different programs that all accomplish the task in 27 bytes:
IO.puts Enum.to_list 32..?~
IO.puts Enum.into 32..?~,[]
IO.puts Enum.take 32..?~,95
IO.puts for n<-32..?~,do: n

x86_16 machine code - 21 15 bytes
-6 bytes, thanks @anna328p
B8 20 0E        MOV AX, 0E20H
            .LOOP:
CD 10           INT 10H
40              INC AX
3C 7E           CMP AL, 7EH
75 F6           JNE .LOOP
B8 4C00         MOV AX, 4C00H
CD 21           INT 21H

Running on DOSBox :

Is line 17 needed?

@anna328p of course, The program will hang if there is no exit function after the loop

I got it down to 15 bytes: uCAOzRBAPH91+bhMAM0h (base64)

cool ! , thank you

APL (Dyalog Extended), 7 bytes (SBCS)
Full program.
' '…'~'

Try it online!
Do I need to explain?

Perl 5 using only keywords with lowercase alphabets only separating each of them only a space, 227 129 bytes
eval q y print chr length xor s qq q while uc le q q q x length q q truncate tie q x length q q foreach q y for q q q x ord q q q

Try it online!
How it works
eval q y
      print chr length
      xor s qq q
   while
      # default variable has spaces only; equibalent to $_
      uc
      # instead of <=126
      le q q q
         # 126==14*9
         x length q q truncate tie q
         x length q q foreach q
# just noticed i could golf the word
y for q q q x ord q q q

Previous: 227 bytes.
eval q y print chr length xor s qq q while chr length lt chr length q q length length length length length length length length length length length length length length length length length length q y foreach q q q x ord q q q

Try it online!
How it works
Using length of default variable to be accumulator.
eval q y
      # print chr($accumulator)
      print chr length xor
      # increment it
      s qq q
   while
      # instead of <
      chr length lt
      # 127 is unfortunately a prime; any efficient ideas within the restrictions?
      chr length q q length length length length length length length length length length length length length length length length length length q
# $accumulator=32
y foreach q q q x ord q q q

Vyxal, 5 bytes
kPs5ȯ

Try it Online!
-2 byte thanks to @AaronMiller

5 bytes

@AaronMiller thanks! Nice trick of slicing ascii characters

Python 3, 20 bytes
lambda:range(32,127)

Try it online! Returns a range of codepoints.
lambda:range(32,127)  # full program
lambda:               # return function taking no arguments that returns...
       range(  ,   )  # range object of all integers between...
             32       # literal...
       range(  ,   )  # minus 1 and...
                127   # literal

SQL, 76 75 bytes
(Microsoft SQL Server 2012+)
declare @ int=32;while(@<127)begin;print char(@);set @+=1;end

Demo

Not sure outputting on separate lines satisfies the challenge. Also, can save a few bytes with a label/and GOTO instead of while.

PHP, 40 30 29 26 24 bytes
Thanks to Mego, manatwork and Titus for helping me golf this down.
<?=join(range(' ','~'));

I think #128 is out of printable ASCII. Anyway, range() can generate character sequence directly, no need to chr() them one by one.

range is inclusive (unlike Python's range, which includes the start but not the end), so it should be range(32,127).

join()'s first parameter “Defaults to an empty string.” Then you have an unnecessary space after the second ,.

Yepp, my explanation officially sucks. :( To translate my previous comment: join()'s first parameter is optional.

I'm pretty sure you can replace echo with <?= and then save a byte.

@Midnightas: 2 bytes. also drop the blank behind the echo

Dyalog APL, 11 bytes
⎕UCS 31+⍳99

⍳99 integers 1 through 99
31+ add 31 to them
⎕UCS pick those from the Unicode Character Set

Julia 0.4, 18 bytes
map(print,' ':'~')

Try it online!
If returning a string from a function is acceptable, a further byte can be saved.
f()=' ':'~'|>join

Haskell, 16 bytes
putStr[' '..'~']

C#, 51 45 40 bytes
for(char x=' ';x<=128;)Debug.Write(x++);

I think that this doesn't qualify just yet, since it isn't a full program or a function. Also, why do you cast the x to a char when giving x a value?

Yeah, but there is 2 casts in your code...?

You can rewrite your for to be shorter ()=>{for(int x=31;x<126;)Debug.Write((char)++x);}; (I also use a lambda to be pendatic with PPCG will. Here we use an Action instead of a Func)

You can remove your cast by incrementing your char. ()=>for(char x=' ';x<127;)Debug.Write(x++);};

Also nice first answer! Feel free to step by the Tips for code-golfing in C# page for more tips! I just referenced this post in it ;)

Pyke, 5 bytes
~KS4>

Try it here!
Pyke's printable variable isn't sorted and it contains tabs and newlines etc... :(

C - 35 bytes
f(i){for(i=31;++i<128;putchar(i));}

Call:
int main() {
    f();
}

Uses the horrible int-as-a-string trick I learnt from Lynn. (Will again if OP confirms that a vertical output is OK).

That only works on little-endian machines though. putchar(i) is the same length.

@owacoder mmh, I had puts there originally, but then I changed it because of the newlines and didn't question it further. Thanks!

i;f(){for(;++i<96;putchar(i+32));} also works, and saves a byte.

34 bytes

Mathematica, 22 bytes
32~CharacterRange~126&

Pretty simple. & creates an anonymous function and 32~CharacterRange~126 outputs a list of characters from 32 () to 126 (~). Actually, I'm pretty sure this is optimal this time.

Excel VBA, 57 bytes:
Prints individual characters
Sub a()
For i = 32 To 126
Debug.Print Chr(i)
Next
End Sub

Prints out joined string, 68 bytes
Sub a()
For i = 32 To 126
b = b & Chr(i)
Next
Debug.Print b
End Sub

27 bytes in VBA Immediate Window: For i=32To 126:?Chr(i):Next or, for all one string with no line breaks, 28 bytes: For i=32To 126:?Chr(i);:Next

Majc (formely hashmap), 6 bytes
r af

The delete character is unprintable so here's the hex code (xxd):
0000000: 7220 7f61 660a                           r .af.

C, 33 bytes
i;f(){++i<96&&putchar(i+31)|f();}

Chip -w -gii -c127, 19 bytes
aABbcC,~S
dDEefF^Gg

Try it online!
Flags:

-w Don't attempt to read stdin
-gii Generate incrementing bytes for input
-c127 Cut off execution at 127 cycles

Code:
This is a cat program suitable for ASCII (only handles 7 bits):
aABbcC
dDEefF Gg

And this suppresses output for values outside the range 0x20-0x7f. (More accurately, it requires that at least one of the bits 0x20 or 0x40 to be true):
      ,~S
     F^G

Retina, 12 bytes
The  is the Unit Separator character \x1F (31)

+;T`p`p_

Try it online!

Retina 0.8.2, 18 bytes
Same method as above, but requires some extra bytes for printing and not having a trailing newline.

+*\T`p`p_
\`.

Try it online!

If, like in Martin's answer, a trailing newline is acceptable, then this is possible, beating him by 5 bytes:
Retina 0.8.2, 13 bytes

+*\T`p`p_

Try it online!

Gol><>, 9 bytes
`_FLss|rH

Try it online!
How it works
`_FLss|rH

`_F...|    Run the following 95 times:
   Lss       Push the loop counter + 32
       rH  Print all the chars in the pushed order and halt

F# (.NET Core), 30 bytes
Seq.iter(printf"%c")[' '..'~']

Try it online!

Tcl, 55 bytes
set i 31
time {puts -nonewline [format %c [incr i]]} 95

Try it online!

Common Lisp, 41 bytes
(dotimes(i 95)(princ(code-char(+ i 32))))

Try it online!

Charcoal, 1 byte
γ

Try it online!
No builtin, 7 bytes:
⪫…· ¦~ω

Try it online!
Explanation
⪫     ω  Join by empty string
 …· ¦~    Inclusive range from " " to "~"

Add++, 12 bytes
L^,126 32rBF

Try it online!
Explanation
L^,          Lambda returning stack cast to string (takes character code of numbers)
   126 32r   Inclusive range from 32 to 126
          BF Flatten stack

><>, 21 19 bytes
48*v
)?;>:o1+:763**

Try it online!
Explanation
48*v               Push 32 and move down
                   Print character, increment, stop if greater than 126
)?;>:o1+:763**

05AB1E, 2 bytes
žQ

Try it online!
No builtin, 8 bytes:
95Ý32+çJ

Try it online!
Explanation
95Ý       Push [0..95]
   32+    Add 32 (vectorizes)
      ç   chr (vectorizes)
       J  Join by empty string

No built-in, 5 bytes: žwƵQŸ

Another: ₃Ýžw+

Japt, 2 bytes
;E

Test it
Or, without a built-in:
Japt -P, 5 bytes
95odH

Test it
95o       :Range [0,95)
   d      :Get the characters at those codepoints
    H     :After adding 32

Ruby, 14 bytes
print *?\s..?~

Try it online!

Whitespace, 52 bytes
[S S S T    S S S S S N
_Push_32][N
S S N
_Create_Label_LOOP][S N
S _Duplicate][T N
S S _Print_as_character][S S S T    N
_Push_1][T  S S S _Add][S N
S _Duplicate][S S S T   T   T   T   T   T   T   N
_Push_127][T    S S T   _Subtract][N
T   T   N
_If_negative_Jump_to_Label_LOOP]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.
Try it online (with raw spaces, tabs, and new-lines).
Program stops with error: No exit defined.
Pseudo-code:
Integer c = 32
Start LOOP:
  Print c as character
  c = c + 1
  If c - 127 is negative:
    Go to next iteration of LOOP

Forth (gforth), 27 bytes
: f 127 32 do i emit loop ;

Try it online!
Explanation
127 32 do  \ loop from 32 to 126 (127 is not printable)
  i emit   \ get the index of the loop, then print it as its ascii representation
loop       \ end the loop

PowerShell 5.1, 22 Bytes
-join[char[]](32..126)

Or 17 bytes if newlines are allowed and we can ditch the join.

A similar approach for PowerShell Core Try it online - 15 bytes!

Rattle, 10 bytes
32|![,+]96

Try it Online!
Explanation
This is reasonably simple:
32|            sets the top of the stack to 32
   !           disables implicit output of the top of the stack
    [  ]96     loops 96 times
     ,         prints the ASCII character of the int value on top of the stack
      +        increments the top of the stack

Julia 1.0, 15 bytes
print.(' ':'~')

Try it online!

AMD64 Bare Metal, 512 bytes
mov ah, 0x0e
mov al, 0x20
for_1:
int 0x10
add al, 1
cmp al, 0x7f
je for_1_end
jmp for_1
for_1_end:
jmp $
times 510-($-$$) db 0
db 0x55
db 0xaa

nasm asciiprintable.asm -f bin
qemu-system-x86_64 -drive format=raw,file=asciiprintable

Zsh builtins only, 25 bytes
Using "builtins only" to avoid competing with the jot solution (18 bytes).
25 bytes: try it online
for a ({\ ..~})echo -n $a

32 bytes: try it online
for a ({32..126})echo -n ${(#)a}

q, 13 bytes
10h$32+til 95

k, 10 bytes
10h$32+!95

Generate 32, 33, ..., 126, 127 and convert these to their ASCII character representations.

GolfScript, 15 14 bytes
-1 byte thanks to Steffan
95,{[32+]''+}/

Try it online!
Explanation
     {...}/ # for each item in
95,         # 0-95
      [32+] # add 32 to that number and put it in an array
      ''+   # output that value as ascii

-1 byte: 95,{[32+]''+}/

Lua, 38 bytes
for i=32,126 do print(('').char(i))end

Try it online!
or, if newlines are not allowed, 41 bytes:
for i=32,126 do io.write(('').char(i))end

Try it online!

I think you've misread the question. The output is supposed to be all the printable ASCII characters, not the program.

Oh, you're right. I meant to post this on Print every character your program doesn't have. Will correct this in a second

This has been corrected.

Scala, 25 bytes
()=>' 'to'~'foreach print

Anonymous function with no args which prints given range
See it online: https://ideone.com/fX2rwf

Lua - 41 bytes
for i=32,127 do io.write(("").char(i))end

You also have to print #127. Not collecting everything in a variable seems to be shorter: for i=32,127 do io.write(("").char(i))end

Stax, 2 bytes
Vp

Run and debug it

Perl 5, 21 bytes
print map{chr}32..127

Try it online!

2sable, 8 bytes
95Ý32+çJ

Try it online!
Same as for 05AB1E
Explanation
95Ý       Push [0..95]
   32+    Add 32 (vectorizes)
      ç   chr (vectorizes)
       J  Join by empty string

3var, 20 bytes
iiss+<+<>+<+<kkF[Pi]

Try it online!
Explanation
iiss                 Increment A twice, square A twice (set a to 16)
    +                Add A to B (set R to 16)
     <               Set B to R
      +<>            Add A and B (16 + 16 = 32), store to A and B
         +<+<        Add 32 to B twice more (B = 96)
             kk      Decrement B twice (B = 94)
               F[  ] Do B times
                 Pi  Print A as character and increment A

Actually, 12 bytes
:95r:32+♂┌εj

Try it online!
Explanation
:95r          Push [0 .. 95]
    :32+      Add 32
        ♂┌    Map chr over TOS
          εj  Join by empty string

VBA (Excel), 28 bytes
using immediate window.
for i=32to 126:?chr(i);:next

Prolog (SWI), 80 68 67 62 45 bytes
?-between(32,126,I),writef('%n',[I]),1=0;1=1.

Try it online!

Swift 4, 57 bytes
for i in 32...126{print(UnicodeScalar(i)!,terminator:"")}

Try it online!

Jelly, 2 bytes
ØṖ

Try it online!
Yep, it's included, but here's an answer without the builtin:
Jelly, 7 bytes
95Ḷ+32Ọ

Try it online!
95Ḷ        create lowered range, from 0 to 94 inclusive
   +32     add 32 to every element in the range
      Ọ    cast the entire list to characters and implicitly print

Yabasic/VBA, 29 bytes
An anonymous function that takes no input and outputs to the console.
Note that the VBA answer could be 1 byte shorter by using Chr instead of Chr$.
For i=32To 126:?Chr$(i);:Next

Yabasic: Try it online!
VBA:      There is no TIO for VBA :(

JavaScript (Node.js), 47 bytes
for(i=31;++i<127;)alert(String.fromCharCode(i))

Try it online!

I'm pretty sure Node.js doesn't have alert.

Befunge-93, 18 bytes
 g:"~"`#@_:,1+00p#

You can try it here. The leading space is important!
                     The current character to be printed/checked, starts loop with a space
  g                  Push character from (0|0) onto stack(using the implicit 0s on the empty stack)
   :"~"`#@_          Check whether the char on (0|0) is over ~, if yes then end
           :,1+00p   Duplicate current char for output and incrementation
                  #  Since the code is a torus, it would continue at (0|0) so we skip it, since it could break the code.

naz, 32 bytes
4a5m6m6a2x1v1x1f1a1o3x1v1l0x4d1f

Try it online!
Explanation (with 0x instructions removed)
4a5m6m6a2x1v   # Set variable 1 equal to 126
1x1f           # Function 1
    1a1o       # Add 1 to the register, then output
        3x1v1l # Goto the start of the function if the register is less than variable 1
4d             # Integer divide by 4, setting the register to a value of 31
1f             # Call function 1

Python - 41 bytes
for i in range(32, 127, 1):
 print(chr(i))

Python has a built-in ASCII function, so we can use that and print all 95 characters in a loop, one at a time.
No newlines - 50 bytes
for i in range(32, 127, 1):
 x = x + chr(i)
print(x)

This is just in case newlines aren't allowed, so this entry still gets in.

Pxem, 17 bytes (filename) + 0 bytes (content) = 17 bytes.

Filename (some unprintables are escaped): ~.z.c\001.-.c\037.a.s.p
Content: empty.

Try it online!
With comments
XX.z
.a~.zXX.z # push 127; while size<2 || (pop!=pop); do
  .a.cXX.z # dup
  .a\001.-XX.z # push 1; push abs(pop-pop) iff size>=2
  .a.cXX.z # dup
.a\037.aXX.z # push 31; done
.a.s.pXX.z # pop (* to remove 31 *); while size>0; do printf "%c", pop; done
.a

Factor, 18 bytes
32 126 [a,b] write

Works in any modern version of Factor that supports printing non-string sequences directly. (i.e. not TIO.)

Kotlin, 27 bytes
(' '..'~').joinToString("")

Try it online!

Knight, 23 bytes
;=a 31W>127=a+1aO+Aa"\"

Try it online!
Unminified:
; = a 31
: WHILE (> 127 (= a (+ 1 a)))
    : OUTPUT (+ (ASCII a) "\")

Ly, 7 bytes
' '~R&o

Try it online!
' '~     - push first (" ") and last ("~") printable characters
    R    - generate a rage of codepoints
     &o  - print the stack as characters

Z80Golf, 9 bytes
00000000: 3e 20 06 5f ff 3c 10 fc 76                     > ._.<..v

Try it online!
Assembler source (z80asm):
start:
    ; start at space
    ld      a, ' '
    ; loop counter
    ; I could also cp 0x7f; jr nz, .loop but this is faster to TOTALLY make up for below
    ld      b, 0x7F - ' '
.loop:
    ; Call 0x38, then nop slide to 0x8000 to print A to stdout
    ; only has a 130842 cycle overhead, which is worth the 2 bytes it saves
    rst     0x38
    ; set A to the next char
    inc     a
    ; Decrement b, then loop if non-zero
    djnz    .loop
    ; Exit
    halt

Pretty straightforward loop approach.

Knight (v2), 23 bytes
;;=s@W>95s=s+sA+32sO^sN

Try it online!
Another Alternative is
;=a@W>95=a+1aO+A+31a"\"

Pascal, 66 B
This program requires to be run on a processor using the ASCII character set (or a binary-compatible superset).
The output will look quite different for instance on an IBM mainframe using EBCDIC.
program p(output);var c:char;begin for c:=' 'to'~'do write(c)end.

Note, in Pascal for-loop limits are inclusive.
During the final iteration c assumes the specified value '~'.

Alice, 14 bytes
' w.oh.'~h-$K@

Try it online!
Explanation
' w.oh.'~h-$K@   Full program
'                Adds 32 (space) on the stack
  w        $K@   Repeat until...
      .'~h-      ...we reach 126 (~)
   .oh           Print and increase the current character

Go, 45 bytes
func(){for i:=32;i<127;i++{print(string(i))}}

Attempt This Online!
Prints to STDERR.

International Phonetic Esoteric Language, 21 bytes
{3j}{w}ɑeχue1søɒ

Ungolfed
{3j}{w}   ( loop bounds: 32 w <= e < 127 3j )
ɑ         ( loop )
 e        ( push index )
  χ       ( ord index )
   u      ( pop-output without newline )
    e1sø  ( increment index )
        ɒ ( end loop )

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