title: Make it look like I'm working

text:
# Question
Title: Make it look like I'm working
Often, I find myself running a script or query that will take a significant amount of time to run. I can leave that script open and enjoy some guilt-free procrastination.

Now, what if I could write a script that *seems* to be one of the above scripts to any onlookers, but in looks only? I could put it up on a screen and enjoy *days* of kitten livestreams before anyone realised that all the complicated rigmarole on the screen didn't have anything to do with my actual job.

Your challenge is to write this script for me (yes, I'm that lazy).

### A *good* answer will:

* Make something appear on the screen that looks like a script is doing work. "Screen" can be terminal, browser, etc.
* Be fairly original (yes, we've all seen the neverending progress bar programs)
* Survive cursory examination by a technical person

### A *bad* answer will:

* Get me fired
* Rehash something we all were forwarded in the 90's

### A *stellar* answer might:

* Transcend one of the bad bullet points above (for instance)
* Survive critical examination
* \*gasp\* actually **do** something that's useful or aids in my work shirking

Acceptance will be based on votes, with bonus from real-life results. I will actually run these scripts (Linux Mint 16) at work when my screen is visible (meetings and the like) to determine detection. If anyone notices that it's faking, you're out of the running. If someone comments on how hard I'm working, +5 bonus upvotes for you.

"Useful" in this case can apply to any coder, but if you're looking for that extra shine on your teacher-bound apple, I'm a full-stack webdev who works in code roughly according to my tags.

Question partially inspired by this.

## Results

Disappointingly, I didn't get any comments either way on these entries. They're all awesome, so you're all winners in my heart. However, Loktar has the most votes by a long shot, so he gets the +15 from the accept. Congrats!

# Answer
# JavaScript

So I went a little crazy with this. I did it between breaks from working on my GUI to track IP's using Visual Basic.

You can access it by going to the super serious domain I made for it tonight as well so you can look busy anywhere **Gui Hacker** and fork and create your own from the following sources

Basically, if you have this running no one will bother you because they know you are doing some serious stuff.

```
var canvas = document.querySelector(".hacker-3d-shiz"),
  ctx = canvas.getContext("2d"),
  canvasBars = document.querySelector(".bars-and-stuff"),
  ctxBars = canvasBars.getContext("2d"),
  outputConsole = document.querySelector(".output-console");

canvas.width = (window.innerWidth / 3) * 2;
canvas.height = window.innerHeight / 3;

canvasBars.width = window.innerWidth / 3;
canvasBars.height = canvas.height;

outputConsole.style.height = (window.innerHeight / 3) * 2 + 'px';
outputConsole.style.top = window.innerHeight / 3 + 'px'

/* Graphics stuff */
function Square(z) {
  this.width = canvas.width / 2;
  this.height = canvas.height;
  z = z || 0;

  this.points = [
    new Point({
      x: (canvas.width / 2) - this.width,
      y: (canvas.height / 2) - this.height,
      z: z
    }),
    new Point({
      x: (canvas.width / 2) + this.width,
      y: (canvas.height / 2) - this.height,
      z: z
    }),
    new Point({
      x: (canvas.width / 2) + this.width,
      y: (canvas.height / 2) + this.height,
      z: z
    }),
    new Point({
      x: (canvas.width / 2) - this.width,
      y: (canvas.height / 2) + this.height,
      z: z
    })
  ];
  this.dist = 0;
}

Square.prototype.update = function() {
  for (var p = 0; p < this.points.length; p++) {
    this.points[p].rotateZ(0.001);
    this.points[p].z -= 3;
    if (this.points[p].z < -300) {
      this.points[p].z = 2700;
    }
    this.points[p].map2D();
  }
}

Square.prototype.render = function() {
  ctx.beginPath();
  ctx.moveTo(this.points[0].xPos, this.points[0].yPos);
  for (var p = 1; p < this.points.length; p++) {
    if (this.points[p].z > -(focal - 50)) {
      ctx.lineTo(this.points[p].xPos, this.points[p].yPos);
    }
  }

  ctx.closePath();
  ctx.stroke();

  this.dist = this.points[this.points.length - 1].z;

};

function Point(pos) {
  this.x = pos.x - canvas.width / 2 || 0;
  this.y = pos.y - canvas.height / 2 || 0;
  this.z = pos.z || 0;

  this.cX = 0;
  this.cY = 0;
  this.cZ = 0;

  this.xPos = 0;
  this.yPos = 0;
  this.map2D();
}

Point.prototype.rotateZ = function(angleZ) {
  var cosZ = Math.cos(angleZ),
    sinZ = Math.sin(angleZ),
    x1 = this.x * cosZ - this.y * sinZ,
    y1 = this.y * cosZ + this.x * sinZ;

  this.x = x1;
  this.y = y1;
}

Point.prototype.map2D = function() {
  var scaleX = focal / (focal + this.z + this.cZ),
    scaleY = focal / (focal + this.z + this.cZ);

  this.xPos = vpx + (this.cX + this.x) * scaleX;
  this.yPos = vpy + (this.cY + this.y) * scaleY;
};

// Init graphics stuff
var squares = [],
  focal = canvas.width / 2,
  vpx = canvas.width / 2,
  vpy = canvas.height / 2,
  barVals = [],
  sineVal = 0;

for (var i = 0; i < 15; i++) {
  squares.push(new Square(-300 + (i * 200)));
}

//ctx.lineWidth = 2;
ctx.strokeStyle = ctxBars.strokeStyle = ctxBars.fillStyle = '#00FF00';

/* fake console stuff */
var commandStart = ['Performing DNS Lookups for',
    'Searching ',
    'Analyzing ',
    'Estimating Approximate Location of ',
    'Compressing ',
    'Requesting Authorization From : ',
    'wget -a -t ',
    'tar -xzf ',
    'Entering Location ',
    'Compilation Started of ',
    'Downloading '
  ],
  commandParts = ['Data Structure',
    'http://wwjd.com?au&2',
    'Texture',
    'TPS Reports',
    ' .... Searching ... ',
    'http://zanb.se/?23&88&far=2',
    'http://ab.ret45-33/?timing=1ww'
  ],
  commandResponses = ['Authorizing ',
    'Authorized...',
    'Access Granted..',
    'Going Deeper....',
    'Compression Complete.',
    'Compilation of Data Structures Complete..',
    'Entering Security Console...',
    'Encryption Unsuccesful Attempting Retry...',
    'Waiting for response...',
    '....Searching...',
    'Calculating Space Requirements '
  ],
  isProcessing = false,
  processTime = 0,
  lastProcess = 0;

function render() {
  ctx.clearRect(0, 0, canvas.width, canvas.height);

  squares.sort(function(a, b) {
    return b.dist - a.dist;
  });
  for (var i = 0, len = squares.length; i < len; i++) {
    squares[i].update();
    squares[i].render();
  }

  ctxBars.clearRect(0, 0, canvasBars.width, canvasBars.height);

  ctxBars.beginPath();
  var y = canvasBars.height / 6;
  ctxBars.moveTo(0, y);

  for (i = 0; i < canvasBars.width; i++) {
    var ran = (Math.random() * 20) - 10;
    if (Math.random() > 0.98) {
      ran = (Math.random() * 50) - 25
    }
    ctxBars.lineTo(i, y + ran);
  }

  ctxBars.stroke();

  for (i = 0; i < canvasBars.width; i += 20) {
    if (!barVals[i]) {
      barVals[i] = {
        val: Math.random() * (canvasBars.height / 2),
        freq: 0.1,
        sineVal: Math.random() * 100
      };
    }

    barVals[i].sineVal += barVals[i].freq;
    barVals[i].val += Math.sin(barVals[i].sineVal * Math.PI / 2) * 5;
    ctxBars.fillRect(i + 5, canvasBars.height, 15, -barVals[i].val);
  }

  requestAnimationFrame(render);
}

function consoleOutput() {
  var textEl = document.createElement('p');

  if (isProcessing) {
    textEl = document.createElement('span');
    textEl.textContent += Math.random() + " ";
    if (Date.now() > lastProcess + processTime) {
      isProcessing = false;
    }
  } else {
    var commandType = ~~(Math.random() * 4);
    switch (commandType) {
      case 0:
        textEl.textContent = commandStart[~~(Math.random() * commandStart.length)] + commandParts[~~(Math.random() * commandParts.length)];
        break;
      case 3:
        isProcessing = true;
        processTime = ~~(Math.random() * 5000);
        lastProcess = Date.now();
      default:
        textEl.textContent = commandResponses[~~(Math.random() * commandResponses.length)];
        break;
    }
  }

  outputConsole.scrollTop = outputConsole.scrollHeight;
  outputConsole.appendChild(textEl);

  if (outputConsole.scrollHeight > window.innerHeight) {
    var removeNodes = outputConsole.querySelectorAll('*');
    for (var n = 0; n < ~~(removeNodes.length / 3); n++) {
      outputConsole.removeChild(removeNodes[n]);
    }
  }

  setTimeout(consoleOutput, ~~(Math.random() * 200));
}

render();
consoleOutput();

window.addEventListener('resize', function() {
  canvas.width = (window.innerWidth / 3) * 2;
  canvas.height = window.innerHeight / 3;

  canvasBars.width = window.innerWidth / 3;
  canvasBars.height = canvas.height;

  outputConsole.style.height = (window.innerHeight / 3) * 2 + 'px';
  outputConsole.style.top = window.innerHeight / 3 + 'px';

  focal = canvas.width / 2;
  vpx = canvas.width / 2;
  vpy = canvas.height / 2;
  ctx.strokeStyle = ctxBars.strokeStyle = ctxBars.fillStyle = '#00FF00';
});
```

```
@font-face {
  font-family: 'Source Code Pro';
  font-style: normal;
  font-weight: 400;
  src: local('Source Code Pro'), local('SourceCodePro-Regular'), url(http://themes.googleusercontent.com/static/fonts/sourcecodepro/v4/mrl8jkM18OlOQN8JLgasDxM0YzuT7MdOe03otPbuUS0.woff) format('woff');
}
body {
  font-family: 'Source Code Pro';
  background: #000;
  color: #00FF00;
  margin: 0;
  font-size: 13px;
}
canvas {
  position: absolute;
  top: 0;
  left: 0;
}
.bars-and-stuff {
  left: 66.6%;
}
.output-console {
  position: fixed;
  overflow: hidden;
}
p {
  margin: 0
}
```

```
<canvas class='hacker-3d-shiz'></canvas>
<canvas class='bars-and-stuff'></canvas>
<div class="output-console"></div>
```
> 289 votes

# Answer
# Bash / coreutils

Introducing the first ever... **compilation emulator**. With this program, you can have epic office chair sword battles any time you like, without even writing any code!

```
#!/bin/bash
collect()
{
    while read line;do
        if [ -d "$line" ];then
            (for i in "$line"/*;do echo $i;done)|sort -R|collect
            echo $line
        elif [[ "$line" == *".h" ]];then
            echo $line
        fi
    done
}

sse="$(awk '/flags/{print;exit}' </proc/cpuinfo|grep -o 'sse\S*'|sed 's/^/-m/'|xargs)"

flags=""
pd="\\"

while true;do
    collect <<< /usr/include|cut -d/ -f4-|
    (
        while read line;do
            if [ "$(dirname "$line")" != "$pd" ];then
                x=$((RANDOM%8-3))
                if [[ "$x" != "-"* ]];then
                    ssef="$(sed 's/\( *\S\S*\)\{'"$x,$x"'\}$//' <<< "$sse")"
                fi
                pd="$(dirname "$line")"
                opt="-O$((RANDOM%4))"
                if [[ "$((RANDOM%2))" == 0 ]];then
                    pipe=-pipe
                fi
                case $((RANDOM%4)) in
                    0) arch=-m32;;
                    1) arch="";;
                    *) arch=-m64;;
                esac
                if [[ "$((RANDOM%3))" == 0 ]];then
                    gnu="-D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L "
                fi
                flags="gcc -w $(xargs -n1 <<< "opt pipe gnu ssef arch"|sort -R|(while read line;do eval echo \$$line;done))"
            fi
            if [ -d "/usr/include/$line" ];then
                echo $flags -shared $(for i in /usr/include/$line/*.h;do cut -d/ -f4- <<< "$i"|sed 's/h$/o/';done) -o "$line"".so"
                sleep $((RANDOM%2+1))
            else
                line=$(sed 's/h$//' <<< "$line")
                echo $flags -c $line"c" -o $line"o"
                sleep 0.$((RANDOM%4))
            fi
        done
    )
done

```

It uses data from `/usr/include` to create a realistic-looking compilation log. I was too lazy to throw random warnings in, so there's just a `-w` flag.

### Random sample:

```
gcc -w -m64 -pipe -msse -msse2 -msse3 -O1 -c libiptc/xtcshared.c -o libiptc/xtcshared.o
gcc -w -m64 -pipe -msse -msse2 -msse3 -O1 -c libiptc/libip6tc.c -o libiptc/libip6tc.o
gcc -w -m64 -pipe -msse -msse2 -msse3 -O1 -c libiptc/libxtc.c -o libiptc/libxtc.o
gcc -w -m64 -pipe -msse -msse2 -msse3 -O1 -c libiptc/ipt_kernel_headers.c -o libiptc/ipt_kernel_headers.o
gcc -w -m64 -pipe -msse -msse2 -msse3 -O1 -c libiptc/libiptc.c -o libiptc/libiptc.o
gcc -w -O2 -m64 -pipe -msse -msse2 -msse3 -msse4_1 -msse4_2 -shared libiptc/ipt_kernel_headers.o libiptc/libip6tc.o libiptc/libiptc.o libiptc/libxtc.o libiptc/xtcshared.o -o libiptc.so
gcc -w -m64 -pipe -O0 -msse -msse2 -msse3 -msse4_1 -c e2p/e2p.c -o e2p/e2p.o
gcc -w -msse -msse2 -msse3 -msse4_1 -m64 -pipe -O1 -shared e2p/e2p.o -o e2p.so
gcc -w -pipe -O0 -msse -msse2 -m64 -c spice-client-gtk-2.0/spice-widget-enums.c -o spice-client-gtk-2.0/spice-widget-enums.o
gcc -w -pipe -O0 -msse -msse2 -m64 -c spice-client-gtk-2.0/spice-grabsequence.c -o spice-client-gtk-2.0/spice-grabsequence.o
gcc -w -pipe -O0 -msse -msse2 -m64 -c spice-client-gtk-2.0/spice-gtk-session.c -o spice-client-gtk-2.0/spice-gtk-session.o
gcc -w -pipe -O0 -msse -msse2 -m64 -c spice-client-gtk-2.0/spice-widget.c -o spice-client-gtk-2.0/spice-widget.o
gcc -w -pipe -O0 -msse -msse2 -m64 -c spice-client-gtk-2.0/usb-device-widget.c -o spice-client-gtk-2.0/usb-device-widget.o
gcc -w -pipe -m64 -msse -msse2 -O1 -shared spice-client-gtk-2.0/spice-grabsequence.o spice-client-gtk-2.0/spice-gtk-session.o spice-client-gtk-2.0/spice-widget-enums.o spice-client-gtk-2.0/spice-widget.o spice-client-gtk-2.0/usb-device-widget.o -o spice-client-gtk-2.0.so
gcc -w -pipe -m64 -msse -msse2 -O1 -c search.c -o search.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/path.c -o cairomm-1.0/cairomm/path.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/scaledfont.c -o cairomm-1.0/cairomm/scaledfont.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/fontface.c -o cairomm-1.0/cairomm/fontface.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/quartz_font.c -o cairomm-1.0/cairomm/quartz_font.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/win32_font.c -o cairomm-1.0/cairomm/win32_font.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/refptr.c -o cairomm-1.0/cairomm/refptr.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/cairomm.c -o cairomm-1.0/cairomm/cairomm.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/context.c -o cairomm-1.0/cairomm/context.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/enums.c -o cairomm-1.0/cairomm/enums.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/win32_surface.c -o cairomm-1.0/cairomm/win32_surface.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/pattern.c -o cairomm-1.0/cairomm/pattern.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/types.c -o cairomm-1.0/cairomm/types.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/matrix.c -o cairomm-1.0/cairomm/matrix.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/quartz_surface.c -o cairomm-1.0/cairomm/quartz_surface.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/exception.c -o cairomm-1.0/cairomm/exception.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/device.c -o cairomm-1.0/cairomm/device.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/surface.c -o cairomm-1.0/cairomm/surface.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/xlib_surface.c -o cairomm-1.0/cairomm/xlib_surface.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/fontoptions.c -o cairomm-1.0/cairomm/fontoptions.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -c cairomm-1.0/cairomm/region.c -o cairomm-1.0/cairomm/region.o
gcc -w -O0 -pipe -m64 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -msse -msse2 -msse3 -msse4_1 -shared cairomm-1.0/cairomm/cairomm.o cairomm-1.0/cairomm/context.o cairomm-1.0/cairomm/device.o cairomm-1.0/cairomm/enums.o cairomm-1.0/cairomm/exception.o cairomm-1.0/cairomm/fontface.o cairomm-1.0/cairomm/fontoptions.o cairomm-1.0/cairomm/matrix.o cairomm-1.0/cairomm/path.o cairomm-1.0/cairomm/pattern.o cairomm-1.0/cairomm/quartz_font.o cairomm-1.0/cairomm/quartz_surface.o cairomm-1.0/cairomm/refptr.o cairomm-1.0/cairomm/region.o cairomm-1.0/cairomm/scaledfont.o cairomm-1.0/cairomm/surface.o cairomm-1.0/cairomm/types.o cairomm-1.0/cairomm/win32_font.o cairomm-1.0/cairomm/win32_surface.o cairomm-1.0/cairomm/xlib_surface.o -o cairomm-1.0/cairomm.so
gcc -w -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -m64 -msse -O1 -pipe -shared cairomm-1.0/*.o -o cairomm-1.0.so
gcc -w -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -m64 -msse -O1 -pipe -c ulockmgr.c -o ulockmgr.o
gcc -w -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -m64 -msse -O1 -pipe -c gshadow.c -o gshadow.o
gcc -w -O2 -msse -msse2 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -m64 -pipe -c dpkg/string.c -o dpkg/string.o
gcc -w -O2 -msse -msse2 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -m64 -pipe -c dpkg/fdio.c -o dpkg/fdio.o
gcc -w -O2 -msse -msse2 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -m64 -pipe -c dpkg/namevalue.c -o dpkg/namevalue.o
gcc -w -O2 -msse -msse2 -D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -m64 -pipe -c dpkg/macros.c -o dpkg/macros.o

```
> 111 votes

# Answer
## Bash

Infinitely displays random hexadecimal values, with some of them highlighted to make it feel like you are performing a complicated search in raw data.

```
while true; do head -c200 /dev/urandom | od -An -w50 -x | grep -E --color "([[:alpha:]][[:digit:]]){2}"; sleep 0.5; done

```
> 105 votes

# Answer
A very long build:

```
emerge openoffice

```
> 101 votes

# Answer
# Ruby

This one will:

1. Get a random code from ~~this site.~~ code review (for more readable, well written code)
2. Make it look like you are typing this code.

```
require 'open-uri'
require 'nokogiri'
site = "http://codereview.stackexchange.com/"
system 'cls'
system("color 0a")
5.times do
    begin
        id = rand(1..6000)
        url = "#{site}/a/#{id}"
        page = Nokogiri::HTML(open(url))
        code = page.css('code')[0].text
    end until code

    code.each_char  do |char|
        print char
        sleep rand(10) / 30.0
    end
end

```

---

Here is this script based on a code taken from here:

```
require 'open-uri'
code = open("http://hackertyper.com/code.txt")
system 'cls'
system("color 0a")

code.each_char  do |char|
    print char
    sleep rand(10) / 30.0
 end

```

Here is how it looks:
> 55 votes

# Answer
Lets go with a simple bash script that makes you look hackerish by printing the contents of every file identified as text in /var/log/ line by line, with random delays to make it look like intensive things are happening. Depending on the files it hits, it can give some rather interesting output.

```
#/bin/bash
# this script helps you do hackerish stuff

if [ "$EUID" -ne 0 ]
then
  echo "Please run as root to be hackerish."
  exit
fi

# turn off globbing
set -f
# split on newlines only for for loops
IFS='
'
for log in $(find /var/log -type f); do
  # only use the log if it's a text file; we _will_ encounter some archived logs
  if [ `file $log | grep -e text | wc -l` -ne 0 ]
  then
    echo $log
    for line in $(cat $log); do
      echo $line
      # sleep for a random duration between 0 and 1/4 seconds to indicate hard hackerish work
      bc -l <<< $(bc <<< "$RANDOM % 10")" / 40" | xargs sleep
    done
  fi
done

```

Be sure your terminal theme looks hackerish. Here are some badass examples (no idea what any of this means, but it looks hackerish):
> 52 votes

# Answer
# Bash : The endless git commit

A problem with computers today is that they are quite fast, so even compilation tasks eventually finish. Also, given a script that runs for a long time you might argue that it's actually possible to continue to work on something else while the script runs.

To solve this we have the following program. Just learn to type 'y' or 'n' randomly every now and then.

Of course you need a git repo with some new content but assuming you occasionally do actual work that should not be a problem.

```
#!/bin/bash

while [ 1 ]; do
  git add -p
  git reset
done

```
> 49 votes

# Answer
## Bash

```
#!/bin/bash
function lazy {
    sudo apt-get update
    lazy
    }
lazy

```

This will just keep updating your repos. If some one notices, just say that you added a new repo for a new program, and you are testing different ones. It isn't really like faking a script, but a command.

NOTE: I do not condone being unproductive at work, but I do like experiments. Therefore I recommend this app to be used to be secretly productive.
> 37 votes

# Answer
# C++ Neural Network

**EDIT**

Sadly I optimized this code:( made it 2000x faster... The legacy code is still perfect for wasting time though!

**Original**

I actually started a project in convolutional neural networks perfect for this! The source code and documentation is on github. The first step is to create a new network.

```
std::vector<int> numNeurons = { 500, 500, 2000, 10 };
std::vector<int> numMaps = { 1, 1, 1, 1 };

ConvolutionalNeuralNetwork neuralNetwork(numNeurons, numMaps, numNeurons,
    std::vector<std::vector<int>>(), std::vector<std::vector<int>>());

```

Now that we have a network with 300 neurons and 1,250,000 synapses, lets save it to a file to make sure we don't lose any progress we make with the network.

```
neuralNetwork.SaveToFile("test2.cnn");

```

That generated a 68MB text file and more than a few hours of relaxed work. Now, let's have some fun doing things with it! I'll create a random input and start to discriminate it.

```
std::vector<std::vector<float>> input;
for (int i = 0; i < 2; ++i)
    input.push_back(std::vector<float>{});

for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 3; ++j)
        input[i].push_back(rand() % 100);
neuralNetwork.SetInput(input);

```

That was a pretty small input for an image, but we're only proving the network can do something. Next step is to discriminate with it!

```
Layer output = neuralNetwork.Discriminate();

```

This hasn't even finished yet for me, and it's been running for over 2 days! Then once we get that output, let's run it through again in reverse just for fun.

```
Layer generatedOutput = neuralNetwork.Generate(output);

```

This is all just to prove that the API works, no plans for it yet. This step hasn't been run for me yet, and I've been waiting a while. Good 2+ days burned, and that is a rough estimate off my current testing. This is pretty complicated, and you'll work hard for a day or two making it, but after that you may never have to work again!

Note: If you never, ever wanna work again, try to train the network

```
neuralNetwork.LearnCurrentInput();

```

I don't even have the time to waste for this one!

If you want to show off all the data that's happening, add some calls in the functions just to display what's happening

New constructor

```
ConvolutionalNeuralNetwork::ConvolutionalNeuralNetwork(std::vector<int> neuronCountPerLayer, std::vector<int> featureMapsPerLayer, std::vector<int> featureMapDimensions, std::vector<std::vector<int>> featureMapConnections, std::vector<std::vector<int>> featureMapStartIndex)
{
std::map<SimpleNeuron, std::vector<Synapse>> childrenOf;
for (unsigned int i = 0; i < neuronCountPerLayer.size() - 1; ++i)
{
    Layer currentLayer;

    for (int j = 0; j < neuronCountPerLayer[i]; ++j)
    {
        std::vector<Synapse> parentOf;

        if (featureMapsPerLayer[i] == 1)
        {
            for (int n = 0; n < neuronCountPerLayer[i + 1]; ++n)
            {
                std::cout << "Adding new synapse, data: " << std::endl;

                SimpleNeuron current = SimpleNeuron(i + 1, j + 1);
                SimpleNeuron destination = SimpleNeuron(i + 2, n + 1);

                std::cout << "Origin: " << i + 1 << ", " << j + 1 << "; Destination: " << i + 2 << ", " << n + 1 << std::endl;

                Synapse currentParentSynapse = Synapse(current, current);
                Synapse currentChildSynapse = Synapse(destination, destination);

                currentChildSynapse.SetWeightDiscriminate(currentParentSynapse.GetWeightDiscriminate());
                currentChildSynapse.SetWeightGenerative(currentParentSynapse.GetWeightGenerative());

                std::cout << "Weights: Discriminative: " << currentChildSynapse.GetWeightDiscriminate() << "; Generative: " << currentChildSynapse.GetWeightGenerative() << std::endl;

                parentOf.push_back(currentParentSynapse);

                if (childrenOf.find(destination) != childrenOf.end())
                    childrenOf.at(destination).push_back(currentChildSynapse);
                else
                    childrenOf.insert(std::pair<SimpleNeuron, std::vector<Synapse>>(destination,
                    std::vector<Synapse>{ currentChildSynapse }));
            }
        }

        else
        {
            int featureMapsUp = featureMapsPerLayer[i + 1];
            int inFeatureMap = featureMapsPerLayer[i] / j;
            int connections = featureMapConnections[i][inFeatureMap];
            int startIndex = (neuronCountPerLayer[i + 1] / featureMapsUp) * featureMapStartIndex[i][inFeatureMap];
            int destinationIndex = startIndex + (neuronCountPerLayer[i + 1] / featureMapsUp) * connections;

            for (int n = startIndex; n < destinationIndex; ++n)
            {
                SimpleNeuron current = SimpleNeuron(i + 1, j + 1);
                SimpleNeuron destination = SimpleNeuron(i + 2, n + 1);

                std::cout << "Origin: " << i + 1 << ", " << j + 1 << "; Destination: " << i + 2 << ", " << n + 1 << std::endl;

                Synapse currentParentSynapse = Synapse(current, current);
                Synapse currentChildSynapse = Synapse(destination, destination);

                currentChildSynapse.SetWeightDiscriminate(currentParentSynapse.GetWeightDiscriminate());
                currentChildSynapse.SetWeightGenerative(currentParentSynapse.GetWeightGenerative());

                std::cout << "Weights: Discriminative: " << currentChildSynapse.GetWeightDiscriminate() << "; Generative: " << currentChildSynapse.GetWeightGenerative() << std::endl;

                parentOf.push_back(currentParentSynapse);

                if (childrenOf.find(destination) != childrenOf.end())
                    childrenOf.at(destination).push_back(currentChildSynapse);
                else
                    childrenOf.insert(std::pair<SimpleNeuron, std::vector<Synapse>>(destination,
                    std::vector<Synapse>{ currentChildSynapse }));
            }
        }

        std::cout << "Adding neuron" << std::endl << std::endl;

        if (childrenOf.find(SimpleNeuron(i + 1, j + 1)) != childrenOf.end())
            currentLayer.AddNeuron(Neuron(parentOf, childrenOf.at(SimpleNeuron(i + 1, j + 1))));
        else
            currentLayer.AddNeuron(Neuron(parentOf, std::vector<Synapse>{}));
    }

    std::cout << "Adding layer" << std::endl << std::endl << std::endl;

    AddLayer(currentLayer);
}

Layer output;

std::cout << "Adding final layer" << std::endl;

for (int i = 0; i < neuronCountPerLayer[neuronCountPerLayer.size() - 1]; ++i)
    output.AddNeuron(Neuron(std::vector<Synapse>(), childrenOf.at(SimpleNeuron(neuronCountPerLayer.size(), i + 1))));
AddLayer(output);
}

```

New FireSynapse

```
float Neuron::FireSynapse()
{
float sum = 0.0f;

std::cout << "Firing Synapse!" << std::endl;

for (std::vector<Synapse>::iterator it = m_ChildOfSynapses.begin(); it != m_ChildOfSynapses.end(); ++it)
    sum += ((*it).GetWeightDiscriminate() * (*it).GetParent().GetValue());

std::cout << "Total sum: " << sum << std::endl;

float probability = (1 / (1 + pow(e, -sum)));

std::cout << "Probably of firing: " << probability << std::endl;

if (probability > 0.9f)
    return 1.0f;

else if (probability < 0.1f)
    return 0.0f;

else
{
    std::cout << "Using stochastic processing to determine firing" << std::endl;
    float random = ((rand() % 100) / 100);
    if (random <= probability)
        return 1.0f;
    else
        return 0.0f;
}
}

```

You will get plenty of output on your console now.
> 28 votes

# Answer
# Python 3

```
#!/usr/bin/python3

import random
import time

first_level_dirs = ['main', 'home', 'usr', 'root', 'html', 'assets', 'files']
title_descs = ['page', 'script', 'interface', 'popup']
id_names = ['container', 'main', 'textbox', 'popup']
tag_names = ['div', 'textarea', 'span', 'strong', 'article', 'summary', 'blockquote', 'b']
autoclosing_tags = ['br', 'input']

def random_js_line():
    return random.choice([
        '      $("#%s").html("<b>" + $("#%s").text() + "</b>");' % (random.choice(id_names), random.choice(id_names)),
        '      $.get("t_%i.txt", function(resp) {\n        callback(resp);\n      });' % (int(random.random() * 50)),
        '      $("%s>%s").css({width: %i + "px", height: %i + "px"});' % (random.choice(tag_names), random.choice(tag_names), int(random.random() * 75), int(random.random() * 75)),
        '      for (var i = 0; i < count; i++) {\n        $("<div>").appendTo("#%s");\n      }' % (random.choice(id_names))
    ])

def random_js_lines():
    lines = [random_js_line() for _ in range(int(random.random() * 14) + 1)]
    return '\n'.join(lines)

def random_html_line():
    tag_name = random.choice(tag_names)
    return random.choice([
        '    <%s>id: %i</%s>' % (tag_name, int(random.random() * 1000), tag_name),
        '    <%s class="%s">\n      <%s/>\n    </%s>' % (tag_name, random.choice(first_level_dirs), random.choice(autoclosing_tags), tag_name),
        '    <div id="%s"></div>' % (random.choice(first_level_dirs))
    ])

def random_html_lines():
    lines = [random_html_line() for _ in range(int(random.random() * 9) + 1)]
    return '\n'.join(lines)

while True:
    print('creating /%s/%i.html' % (random.choice(first_level_dirs), int(random.random() * 1000)))
    time.sleep(random.random())
    lines = [
        '<!DOCTYPE html>',
        '<html lang="en">',
        '  <head>',
        '    <title>%s #%i</title>' % (random.choice(title_descs), int(random.random() * 100)),
        '    <script type="text/javascript" src="/js/assets/jquery.min.js"></script>',
        '    <script type="text/javascript">',
        random_js_lines(),
        '    </script>',
        '  </head>',
        '  <body>',
        random_html_lines(),
        '  </body>',
        '</html>'
    ]
    lines = [single_line for linegroup in lines for single_line in linegroup.split('\n')]
    for line in lines:
        print(line)
        time.sleep(random.random() / 10)
    print()
    time.sleep(random.random() / 2)

```

It outputs a bunch of lines of fake JS and HTML, with fake "loading" times (delays) to make it seem more realistic.

This can and will be expanded upon greatly! (the basic program is there; I just have to add more content now)

---

Here's a sample "page" it generates (this is actually from an old version of the code; I'll update it with the new code when I'm finished):

```
creating /assets/809.html
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>script #32</title>
    <script type="text/javascript" src="/js/assets/jquery.min.js"></script>
    <script type="text/javascript">
      $("#main").html("<b>" + $("#main").text() + "</b>");
      $("#textbox").html("<b>" + $("#container").text() + "</b>");
      $("#popup").html("<b>" + $("#textbox").text() + "</b>");
      $("#container").html("<b>" + $("#textbox").text() + "</b>");
      $.get("t_11.txt", function(resp) {
        callback(resp);
      });
      $("#main").html("<b>" + $("#textbox").text() + "</b>");
      $.get("t_14.txt", function(resp) {
        callback(resp);
      });
      $.get("t_1.txt", function(resp) {
        callback(resp);
      });
      $.get("t_34.txt", function(resp) {
        callback(resp);
      });
    </script>
  </head>
  <body>
    <span>id: 462</span>
    <textarea>id: 117</textarea>
  </body>
</html>

```
> 26 votes

# Answer
# Node.js + BDD

Looks like an endless stream of BDD-style tests running. Nobody can blame you for running tests!

```
    "use strict"
var colors = require("colors"),
    features = ["User", "Request", "Response", "Cache", "Preference", "Token", "Profile", "Application", "Security"],
    patterns = ["Factory", "Observer", "Manager", "Repository", "Impl", "Dao", "Service", "Delegate", "Activity"],
    requirements = ["return HTTP 403 to unauthorized users",
                    "accept UTF-8 input",
                    "return HTTP 400 for invalid input",
                    "correctly escape SQL",
                    "validate redirects",
                    "provide online documentation",
                    "select internationalized strings, based on locale",
                    "support localized date formats",
                    "work in IE6",
                    "pass W3C validation",
                    "produce valid JSON",
                    "work with screen readers",
                    "use HTML5 canvas where available",
                    "blink"],
    minTimeout = 100,
    maxTimeout = 1000,
    minRequirements = 2,
    maxRequirements = 6,
    skipThreshold = 0.1,
    failThreshold = 0.2

function randBetween(l, u) {
  return Math.floor(Math.random() * (u - l) + l)
}

function choose(l) {
  return l[randBetween(0, l.length)]
}

function timeout() {
  return randBetween(minTimeout, maxTimeout)
}

function printFeature() {
  console.log("")
  var feature = choose(features) + choose(patterns)
  var article = /^[AEIOU]/.test(feature) ? "An " : "A "
  console.log(article + feature + " should")
  setTimeout(function() {
    var reqs = randBetween(minRequirements, maxRequirements)
    printRequirements(reqs)
  }, timeout())
}

function printRequirements(i) {
  if (i > 0) {
    var skipFailOrPass = Math.random()
    if (skipFailOrPass < skipThreshold) {
      console.log(("- " + choose(requirements) + " (SKIPPED)").cyan)
    } else if (skipFailOrPass < failThreshold) {
      console.log(("x " + choose(requirements) + " (FAILED)").red)
      console.log(("  - Given I am on the " + choose(features) + " page").green)
      console.log(("  - When I click on the " + choose(features) + " link").green)
      console.log(("  x Then the Log Out link should be visible in the top right hand corner").red)
    } else {
      console.log(("+ " + choose(requirements)).green)
    }
    setTimeout(function() {printRequirements(i - 1)}, timeout())
  } else {
    printFeature()
  }
}

printFeature()

```

## Update

It occurred to me that it would look suspicious if all your tests passed, so I've updated it to include some failing tests - complete with Given-When-Thens.

And yes, I know that all the failures have the same message. You really need to fix that logout link!
> 24 votes

# Answer
# C# (Windows)

I present to you, the brand new **Memtest86 Simulator 2014**! (Because running Memtest86 under Windows makes total sense)

Complete with working progress bars and pattern indicator!

This code extensively uses the Console class, which as far as I know, it's only available on Windows. Also, I couldn't find a way to show the real processor name/frequency and available memory, so those are hardcoded.

Screenshot:

**EDIT**

To retrieve the processor information, you can use the Microsoft.Win32 namespace and RegistryKey class.

```
 // Processor information, add 'using Microsoft.Win32';
string processor = "";
RegistryKey processor_name = Registry.LocalMachine.OpenSubKey(@"Hardware\Description\System\CentralProcessor\0", RegistryKeyPermissionCheck.ReadSubTree);
        if (processor_name != null)
        {
            if (processor_name.GetValue("ProcessorNameString") != null)
            {
                processor = (string)processor_name.GetValue("ProcessorNameString");
            }
        }

```

Code (ugly, I know):

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

class MemTestSim
{
    static void Main(string[] args)
    {
        Random r = new Random();
        int seconds = 0;
        int pass = 0;
        int test = 0;
        int testNumber = 0;

        string[] testNames = { "Address test, own Adress", "Moving inversions, ones & zeros", "Moving inversions, 8 bit pattern" };
        string[] pattern = { "80808080", "7f7f7f7f", "40404040", "bfbfbfbf", "20202020", "dfdfdfdf", "10101010", "efefefef", "08080808", "f7f7f7f7", "8f8f8f8f" };

        // Trick to stop the console from scrolling
        Console.SetWindowSize(80, 40);

        Console.Title = "Memtest86+ v2.11";
        Console.CursorVisible = false;

        // Dark Blue Background Color
        Console.BackgroundColor = ConsoleColor.DarkBlue;
        Console.Clear();

        // Green Title Text
        Console.BackgroundColor = ConsoleColor.DarkGreen;
        Console.ForegroundColor = ConsoleColor.Black;
        Console.Write("      Memtest86+ v2.11     ");

        // Gray on Blue Text and main window structure
        Console.BackgroundColor = ConsoleColor.DarkBlue;
        Console.ForegroundColor = ConsoleColor.Gray;
        Console.Write("| Pass " + pass + "%\n");
        Console.WriteLine("Intel Core i5 2290 MHz     | Test ");
        Console.WriteLine("L1 Cache:  128K   1058MB/s | Test #" + testNumber + "  [" + testNames[0] + "]");
        Console.WriteLine("L2 Cache:  512K   1112MB/s | Testing:  132K - 8192M  8192M");
        Console.WriteLine("L3 Cache: 3072K   1034MB/s | Pattern: ");
        Console.WriteLine("Memory  : 8192M            |---------------------------------------------------");
        Console.WriteLine("Chipset :  Intel i440FX");
        Console.WriteLine();
        Console.WriteLine();
        Console.WriteLine(" WallTime   Cached  RsvdMem   MemMap   Cache  ECC  Test  Pass  Errors  ECC Errs");
        Console.WriteLine(" ---------  ------  -------  --------  -----  ---  ----  ----  ------  --------");
        Console.WriteLine("   0:00:26   8192M      64K  e820-Std    on   off   Std     0       0");

        // Bottom Bar
        Console.SetCursorPosition(0, 24);
        Console.BackgroundColor = ConsoleColor.Gray;
        Console.ForegroundColor = ConsoleColor.DarkBlue;
        Console.WriteLine("(ESC)Reboot  (c)configuration  (SP)scroll_lock  (CR)scroll_unlock               ");

        Console.SetWindowSize(80, 25);

        // Reset text color
        Console.BackgroundColor = ConsoleColor.DarkBlue;
        Console.ForegroundColor = ConsoleColor.Gray;

        // FOREVER
        while (true)
        {
            TimeSpan time = TimeSpan.FromSeconds(seconds);

            // Running Time (WallTime)
            Console.SetCursorPosition(3, 11);
            string min = (time.Minutes < 10 ? "0" + time.Minutes : "" + time.Minutes);
            string sec = (time.Seconds < 10 ? "0" + time.Seconds : "" + time.Seconds);
            Console.Write(time.Hours + ":" + min + ":" + sec);

            // Test percentage
            Console.SetCursorPosition(34, 1);
            Console.Write((int)test + "%");

            // Test Progress Bar
            Console.SetCursorPosition(38, 1);
            for (int i = 0; i < test / 3; i++)
                Console.Write("#");

            Console.SetCursorPosition(38, 0);
            for (int i = 0; i < pass / 3; i++)
                Console.Write("#");

            // Test Number
            Console.SetCursorPosition(35, 2);
            Console.Write(testNumber + "  [" + testNames[testNumber] + "]        ");

            if (testNumber != 0)
            {
                Console.SetCursorPosition(38, 4);
                Console.Write(pattern[test / 10]);
            }
            else
            {
                Console.SetCursorPosition(38, 4);
                Console.Write("         ");
            }

            if (test >= 100)
            {
                test = 0;

                Console.SetCursorPosition(34, 0);
                Console.Write(pass + "%");

                Console.SetCursorPosition(34, 1);
                Console.Write("                                      ");
                testNumber++;
                pass += 2;

                if (testNumber == 2)
                    testNumber = 0;
            }

            Thread.Sleep(1000);
            test += r.Next(0, 3);
            seconds++;
        }
    }
}

```
> 23 votes

# Answer
# Python, 36 characters

```
print("Opening Internet Explorer...")

```

# Python, 21 characters

```
print("Opening IE...")

```

*Trying to be funny. :P*
> 22 votes

# Answer
# AHK

You pretend to type while the script generates a bunch of accessors and mutators in JavaScript. Make sure an IDE (I tested this on Notepad++) is the active window.

Specify the list of variables and class name if you want. I just used what was already in `window.location`.

Press esc to exit.

Press 0 on your numberpad to pause when someone tries to talk to you.

Press ctrl+w (w stands for work) to start

```
^w::
    loop{
        variable_names  :=  "hash|host|hostname|href|origin|pathname|port|protocol|search"
        class_name  :=  "location"

        StringSplit, variable_names_array, variable_names, "|"

        loop, %variable_names_array0%{
            Random, delay, 80, 120
            SetKeyDelay, %delay%
            current :=  variable_names_array%a_index%
            Send, %class_name%.prototype.
            Random, r, 800, 1300
            Sleep, %r%
            Send, get_
            Random, r, 800, 1300
            Sleep, %r%
            Send, %current%
            Random, r, 800, 1300
            Sleep, %r%
            Send, {space}={space}
            Random, r, 800, 1300
            Sleep, %r%
            Send, function(){{}{enter}
            Random, r, 800, 1300
            Sleep, %r%
            Send, {tab}
            Random, r, 800, 1300
            Sleep, %r%
            Send, return this.
            Random, r, 800, 1300
            Sleep, %r%
            Send, %current%;{enter}
            Random, r, 800, 1300
            Sleep, %r%
            Send, {BackSpace}{}}
            Random, r, 800, 1300
            Sleep, %r%
            Send, {enter}{enter}
            Random, r, 800, 1300
            Sleep, %r%

            Send, %class_name%.prototype.
            Random, r, 800, 1300
            Sleep, %r%
            Send, set_
            Random, r, 800, 1300
            Sleep, %r%
            Send, %current%
            Random, r, 800, 1300
            Sleep, %r%
            Send, {space}={space}
            Random, r, 800, 1300
            Sleep, %r%
            Send, function(%current%){{}{enter}
            Random, r, 800, 1300
            Sleep, %r%
            Send, {tab}
            Random, r, 800, 1300
            Sleep, %r%
            Send, this.
            Random, r, 800, 1300
            Sleep, %r%
            Send, %current% ={space}
            Random, r, 800, 1300
            Sleep, %r%
            Send, %current%;{enter}
            Random, r, 800, 1300
            Sleep, %r%
            Send, return this;{enter}
            Random, r, 800, 1300
            Sleep, %r%
            Send, {BackSpace}{}}
            Random, r, 800, 1300
            Sleep, %r%
            Send, {enter}{enter}
            Random, r, 800, 1300
            Sleep, %r%
        }
    }
return

esc::
    ExitApp
    return

numpad0::
    Pause, toggle
    return

```
> 14 votes

# Answer
# Bash

Dumps a random block of physical memory and looks at the contents. Going to need to be root for this. Only the first 1MB of memory is available by default. `dd` default block size is 512 bytes, that can be changed with option `ibs=bytes` but keep in mind the other option `skip=$offset` which picks a block at random. Output from `dd` is sent through `tr` to remove non ASCII characters; only unique results 2 characters or longer are evaluated.

Each string found is compared to a dictionary. If no matches are found, it attempts to decode as base64. Finally, all the strings evaluated are returned.

There are several other platform dependent options to be aware of, such as location of dictionary file (/usr/share/dict/words), whether sleep accepts floating point inputs, and if `base64` is available.

Also, be aware that `dd` outputs stats on the operation performed to stderr, which is piped to /dev/null. If something were to go horribly wrong (you are accessing /dev/mem ...) the stderr output won't be visible.

Overall, not very useful, but I learned a bit about linux memory and writing this script turned out to be fun.

```
#!/bin/bash

offset=`expr $RANDOM % 512`
mem=`dd if=/dev/mem skip=$offset count=1 2>/dev/null| tr '[\000-\040]' '\n' | tr '[\177-\377'] '\n' | sort -u | grep '.\{2,\}'`

results=""

for line in $mem
do
    echo "Evaluating $line"
    greps=`grep "^$line" /usr/share/dict/words | head`

    if [ -n "$greps" ]
    then
        echo "Found matches."
        echo $greps
    else
        #echo "No matches in dictionary. Attempting to decode."
        decode=`echo "$line" | base64 -d 2>/dev/null`
        if [ $? -ne 1 ]
        then
            echo "Decode is good: $decode"
        #else
            #echo "Not a valid base64 encoded string."
        fi
    fi

    results+=" $line"

    # make it look like this takes a while to process
    sleep 0.5

done

if (( ${#results} > 1 ))
then
    echo "Done processing input at block $offset: $results"
fi

```

Sometimes there's no interesting output (all zeroes). Sometimes there are only a few strings:

```
codegolf/work# ./s
Evaluating @~
Evaluating 0~
Evaluating ne
Found matches.
ne nea neal neallotype neanic neanthropic neap neaped nearable nearabout
Done processing input at block 319:  @~ 0~ ne

```

Sometimes there is actually something human readable in memory (before I was logging block offset):

```
codegolf/work# ./s
Evaluating grub_memset
Evaluating grub_millisleep
Evaluating grub_mm_base
Evaluating grub_modbase
Evaluating grub_named_list_find
Evaluating grub_net_open
Evaluating grub_net_poll_cards_idle
Evaluating grub_parser_cmdline_state
Evaluating grub_parser_split_cmdline
Evaluating grub_partition_get_name
Evaluating grub_partition_iterate
Evaluating grub_partition_map_list
Evaluating grub_partition_probe
Evaluating grub_pc_net_config
Evaluating grub_pit_wait
Evaluating grub_print_error
Evaluating grub_printf
Evaluating grub_printf_
Evaluating grub_puts_
Evaluating grub_pxe_call
Evaluating grub_real_dprintf
Evaluating grub_realidt
Evaluating grub_realloc
Evaluating grub_refresh
Evaluating grub_register_command_prio
Evaluating grub_register_variable_hook
Evaluating grub_snprintf
Evaluating grub_st
Evaluating grub_strchr
Evaluating _memmove
Done processing input:  grub_memset grub_millisleep grub_mm_base
    grub_modbase grub_named_list_find grub_net_open grub_net_poll_cards_idle
    grub_parser_cmdline_state grub_parser_split_cmdline
    grub_partition_get_name grub_partition_iterate grub_partition_map_list
    grub_partition_probe grub_pc_net_config grub_pit_wait grub_print_error
    grub_printf grub_printf_ grub_puts_ grub_pxe_call grub_real_dprintf
    grub_realidt grub_realloc grub_refresh grub_register_command_prio
    grub_register_variable_hook grub_snprintf grub_st grub_strchr _memmove

```

And one last sample run showing malformed grep input, dictionary hits, and a successful base64 decode (before logging block offset again):

```
codegolf/work# ./s
Evaluating <!
Evaluating !(
Evaluating @)
Evaluating @@
Evaluating $;
Evaluating '0@
Evaluating `1
Evaluating 1P$#4
Evaluating )$2
Evaluating -3
Evaluating 3HA
Evaluating 3N
Evaluating @@9
Evaluating 9@
Evaluating 9Jh
Evaluating \9UK
grep: Invalid back reference
Evaluating a#
Evaluating CX
Evaluating ?F
Evaluating !H(
Evaluating +%I
Evaluating Io
Found matches.
Io Iodamoeba Ione Ioni Ionian Ionic Ionicism Ionicization Ionicize Ionidium
Evaluating Kj
Found matches.
Kjeldahl
Evaluating l#
Evaluating L6qh
Decode is good: /��
Evaluating O%
Evaluating OX
Evaluating PR
Evaluating .Q
Evaluating Q4!
Evaluating qQ
Evaluating )u
Evaluating Ua
Found matches.
Uaraycu Uarekena Uaupe
Evaluating $v
Evaluating )V
Evaluating V8
Evaluating V,B~
Evaluating wIH
Evaluating xU
Evaluating y@
Evaluating @z
Evaluating Z0
Evaluating zI
Evaluating Z@!QK
Done processing input:  <! !( @) @@ $; '0@ `1 1P$#4 )$2 -3 3HA 3N
    @@9 9@ 9Jh \9UK a# CX ?F !H( +%I Io Kj l# L6qh O% OX PR .Q Q4!
    qQ )u Ua $v )V V8 V,B~ wIH xU y@ @z Z0 zI Z@!QK

```
> 14 votes

# Answer
**Windows Batch**

```
@echo off

set /p hax="How much haxx0rz: " %=%
set /p haxx="How quick haxx0rz (seconds): " %=%

FOR /L %%I IN (1, 1, %hax%) DO (
START cmd /k "COLOR A&&tree C:\"
timeout %haxx%
)

```

This is a joke script that I've kept with me for years to make it look like something out of a 90's hacker movie. I usually use it while remotely connected to a computer to freak people out.
> 13 votes

# Answer
### Bash

The never ending search for cafes.

I found this on the web a long time ago:

```
cat /dev/urandom | hexdump | grep "ca fe"

```
> 12 votes

# Answer
**Python 2.7**

The Endless Test Suite

"Runs" a set of "Unit Tests" on all the files in your directory tree. Traverses all subdirectories. Starts over when it gets to the end.

Prints a running status:

```
============================= entering . =============================
------------------------ test_line_numbers.py ------------------------
Ran 18 tests in 3.23707662572 seconds, 0 errors
---------------------------- test_main.c ----------------------------
Ran 26 tests in 1.3365194929 seconds, 0 errors
--------------------------- test_parser.c ---------------------------
Ran 8 tests in 1.61633904378 seconds, 0 errors
--------------------------- test_README.c ---------------------------
Ran 12 tests in 2.27466813182 seconds, 0 errors
4 modules OK (0 failed)
=========================== entering ./lib ===========================

```

...

Features that make it more complex than needed, and hopefully more realistic:

* The number of tests and test time is proportional to the file size.
* Turns non source code file extensions into known ones. Modify `CodeExtensions` to add more known types.
    + Selects new extension based on frequency of actual language files seen, so you won't be seen testing Python code if your hard drive is full of Ruby.
* Skips files with leading `.` No giveaways like "test\_.bashrc.js"

```
import os,random,time,collections

CodeExtensions = ('.py', '.c','.cpp','.rb','.js','.pl','.cs','.el')
last_exts = collections.deque(CodeExtensions[:1],100)
maxlen=0

def maketestname(filename):
    root,ext = os.path.splitext(filename)
    if ext in CodeExtensions:
        last_exts.append(ext)
    else:
        ext = random.choice(last_exts)
    return 'test_'+root+ext

def banner(char,text,width=70):
    bar = char*((width-len(text)-2)/2)
    return "{} {} {}".format(bar,text,bar)

def scaledrand(scale,offset):
    return random.random()*scale+random.randrange(offset)

while True:
    for dirname, subdirs, files in os.walk('.'):
        print banner('=',"entering {}".format(dirname))
        skipped = 0
        for filename in files:
            if filename[0] is not '.':
                testfilename = maketestname(filename)
                print banner('-',testfilename)
                filelen = os.path.getsize(os.path.join(dirname,filename))
                maxlen = max(maxlen,filelen)
                ntests = int(scaledrand(20*filelen/maxlen,10))
            testtime = scaledrand(ntests/5.0,2)
            time.sleep(testtime)
            else:
                skipped+=1
                continue

            print "Ran {} tests in {} seconds, {} errors".format(ntests,testtime,0)
        print "{} modules OK ({} failed)\n".format(len(files)-skipped,0)

```
> 11 votes

# Answer
# Java + Guava 16 (Guava isn't super necessary, but it made some things a little less annoying to write).

Alright, you're supposed to be working? How about a program that actually writes real Java code, that actually compiles (though it doesn't do much).

It's difficult to demonstrate the animation, but this program writes a Java program using either the default dictionary (250 common English words) or a newline delimited file (taken as a command line argument), and types it to the console **one character at a time at human seeming speeds**. Make sure to run it yourself because this post doesn't do it justice. When it finishes, it waits 1 minute, then prints a lot of blank lines to the console, and starts over again. I tried to write it to make various parameters reasonably tweakable.

Also, normally I would put this into more than one file, but to make it easier to run I smushed all the classes together.

```
package org.stackoverflow.ppcg;

import java.io.*;
import java.util.*;

import com.google.common.base.CaseFormat;
import com.google.common.base.Converter;
import com.google.common.collect.Lists;

public class CodeGenerator {
    public static final Converter<String, String> TOUPPER =
            CaseFormat.LOWER_CAMEL.converterTo(CaseFormat.UPPER_CAMEL);
    public static final Converter<String, String> TOLOWER =
            CaseFormat.UPPER_CAMEL.converterTo(CaseFormat.LOWER_CAMEL);

    public static final String[] TYPES = new String[]{
        "int", "long", "double", "String"
    };

    public static final List<String> DEFAULT_LIST = Arrays.asList(new String[]{
            "the", "and", "for", "you", "say", "but", "his", "not", "she", "can",
            "who", "get", "her", "all", "one", "out", "see", "him", "now", "how",
            "its", "our", "two", "way", "new", "day", "use", "man", "one", "her",
            "any", "may", "try", "ask", "too", "own", "out", "put", "old", "why",
            "let", "big", "few", "run", "off", "all", "lot", "eye", "job", "far",
            "have", "that", "with", "this", "they", "from", "that", "what", "make", "know",
            "will", "time", "year", "when", "them", "some", "take", "into", "just", "your",
            "come", "than", "like", "then", "more", "want", "look", "also", "more", "find",
            "here", "give", "many", "well", "only", "tell", "very", "even", "back", "good",
            "life", "work", "down", "call", "over", "last", "need", "feel", "when", "high",
            "their", "would", "about", "there", "think", "which", "could", "other", "these", "first",
            "thing", "those", "woman", "child", "there", "after", "world", "still", "three", "state",
            "never", "leave", "while", "great", "group", "begin", "where", "every", "start", "might",
            "about", "place", "again", "where", "right", "small", "night", "point", "today", "bring",
            "large", "under", "water", "write", "money", "story", "young", "month", "right", "study",
            "people", "should", "school", "become", "really", "family", "system", "during", "number", "always",
            "happen", "before", "mother", "though", "little", "around", "friend", "father", "member", "almost",
            "change", "minute", "social", "follow", "around", "parent", "create", "others", "office", "health",
            "person", "within", "result", "change", "reason", "before", "moment", "enough", "across", "second",
            "toward", "policy", "appear", "market", "expect", "nation", "course", "behind", "remain", "effect",
            "because", "through", "between", "another", "student", "country", "problem", "against", "company", "program",
            "believe", "without", "million", "provide", "service", "however", "include", "several", "nothing", "whether",
            "already", "history", "morning", "himself", "teacher", "process", "college", "someone", "suggest", "control",
            "perhaps", "require", "finally", "explain", "develop", "federal", "receive", "society", "because", "special",
            "support", "project", "produce", "picture", "product", "patient", "certain", "support", "century", "culture"
    });

    private static final int CLASS_NAME_LENGTH = 2;

    private final WordList wordList;
    private final Appendable out;
    private final Random r = new Random();

    private CodeGenerator(WordList wordList, Appendable out) {
        this.wordList = wordList;
        this.out = out;
    }

    public static void main(String... args) throws Exception {
        List<?> wordSource = getWords(args);
        WordList list = new WordList(wordSource);
        SleepingAppendable out = new SleepingAppendable(System.out);
        CodeGenerator generator = new CodeGenerator(list, out);
        while(!Thread.interrupted()) {
            generator.generate();
            try {
                Thread.sleep(60000);
            } catch (InterruptedException e) {
                break;
            }
            out.setSleeping(false);
            for(int i = 0; i < 100; i++) {
                out.append(System.lineSeparator());
            }
            out.setSleeping(true);
        }
    }

    private static List<?> getWords(String[] args) {
        if(args.length > 0) {
            try {
                return getListFromFile(args[0]);
            } catch(IOException e) { }
        }
        return DEFAULT_LIST;
    }

    private static List<Object> getListFromFile(String string) throws IOException {
        List<Object> newList = Lists.newArrayList();

        File f = new File(string);
        Scanner s = new Scanner(f);

        while(s.hasNext()) {
            newList.add(s.nextLine());
        }

        return newList;
    }

    private void generate() throws IOException {
        String className = beginClass();
        List<Field> finalFields = generateFields(true);
        printFields(finalFields);
        out.append(System.lineSeparator());
        List<Field> mutableFields = generateFields(false);
        printFields(mutableFields);
        out.append(System.lineSeparator());
        printConstructor(className, finalFields);
        printGetters(finalFields);
        printGetters(mutableFields);
        printSetters(mutableFields);
        endClass();
    }

    private void printGetters(List<Field> fields) throws IOException {
        for(Field f : fields) {
            out.append(System.lineSeparator());
            f.printGetter(out);
        }
    }

    private void printSetters(List<Field> fields) throws IOException {
        for(Field f : fields) {
            out.append(System.lineSeparator());
            f.printSetter(out);
        }
    }

    private void printConstructor(String className, List<Field> finalFields) throws IOException {
        out.append("\tpublic ").append(className).append('(');
        printArgs(finalFields);
        out.append(") {").append(System.lineSeparator());
        for(Field f : finalFields) {
            f.printAssignment(out);
        }
        out.append("\t}").append(System.lineSeparator());
    }

    private void printArgs(List<Field> finalFields) throws IOException {
        if(finalFields.size() == 0) return;

        Iterator<Field> iter = finalFields.iterator();

        while(true) {
            Field next = iter.next();
            next.printTypeAndName(out);
            if(!iter.hasNext()) break;
            out.append(", ");
        }
    }

    private List<Field> generateFields(boolean isfinal) {
        int numFields = r.nextInt(3) + 2;
        List<Field> newFields = Lists.newArrayListWithCapacity(numFields);
        for(int i = 0; i < numFields; i++) {
            String type = TYPES[r.nextInt(4)];
            newFields.add(new Field(type, wordList.makeLower(r.nextInt(2) + 1), isfinal));
        }
        return newFields;
    }

    private void printFields(List<Field> finalFields) throws IOException {
        for(Field f : finalFields) {
            f.printFieldDeclaration(out);
        }
    }

    private String beginClass() throws IOException {
        out.append("public class ");
        String className = wordList.nextClassName(CLASS_NAME_LENGTH);
        out.append(className).append(" {").append(System.lineSeparator());

        return className;
    }

    private void endClass() throws IOException {
        out.append("}");
    }

    private static class WordList {
        private final Random r = new Random();

        private final List<?> source;

        private WordList(List<?> source) {
            this.source = source;
        }

        private String makeUpper(int length) {
            StringBuilder sb = new StringBuilder();
            for(int i = 0; i < length; i++) {
                sb.append(randomWord());
            }
            return sb.toString();
        }

        private String makeLower(int length) {
            return TOLOWER.convert(makeUpper(length));
        }

        private String randomWord() {
            int sourceIndex = r.nextInt(source.size());
            return TOUPPER.convert(source.get(sourceIndex).toString().toLowerCase());
        }

        public String nextClassName(int length) {
            return makeUpper(length);
        }
    }

    private static class Field {
        private final String type;
        private final String fieldName;
        private final boolean isfinal;

        Field(String type, String fieldName, boolean isfinal) {
            this.type = type;
            this.fieldName = fieldName;
            this.isfinal = isfinal;
        }

        void printFieldDeclaration(Appendable appendable) throws IOException {
            appendable.append("\tprivate ");
            if(isfinal) appendable.append("final ");
            printTypeAndName(appendable);
            appendable.append(';').append(System.lineSeparator());
        }

        void printTypeAndName(Appendable appendable) throws IOException {
            appendable.append(type).append(' ').append(fieldName);
        }

        void printGetter(Appendable appendable) throws IOException {
            appendable.append("\tpublic ");
            appendable.append(type).append(" get").append(TOUPPER.convert(fieldName));
            appendable.append("() {").append(System.lineSeparator());
            appendable.append("\t\treturn ").append(fieldName).append(';');
            appendable.append(System.lineSeparator()).append("\t}").append(System.lineSeparator());
        }

        void printSetter(Appendable appendable) throws IOException {
            appendable.append("\tpublic void set");
            appendable.append(TOUPPER.convert(fieldName));
            appendable.append("(").append(type).append(' ').append(fieldName);
            appendable.append(") {").append(System.lineSeparator());
            printAssignment(appendable);
            appendable.append("\t}").append(System.lineSeparator());
        }

        void printAssignment(Appendable appendable) throws IOException {
            appendable.append("\t\tthis.").append(fieldName).append(" = ").append(fieldName);
            appendable.append(';').append(System.lineSeparator());
        }
    }

    private static class SleepingAppendable implements Appendable {
        private Random r = new Random();
        private Appendable backing;

        private boolean sleeping = true;

        public SleepingAppendable(Appendable backing) {
            this.backing = backing;
        }

        @Override
        public Appendable append(CharSequence csq) throws IOException {
            return append(csq, 0, csq.length());
        }

        @Override
        public Appendable append(CharSequence csq, int start, int end)
                throws IOException {
            for(int i = start; i < end; i++) {
                append(csq.charAt(i));
            }

            sleep(100, 300);

            return this;
        }

        @Override
        public Appendable append(char c) throws IOException {
            sleep(170, 80);

            backing.append(c);

            return this;
        }

        private void sleep(int base, int variation) {
            if(!sleeping) return;
            try {
                Thread.sleep((long) (r.nextInt(80) + 70));
            } catch (InterruptedException e) {
            }
        }

        public boolean isSleeping() {
            return sleeping;
        }

        public void setSleeping(boolean sleeping) {
            this.sleeping = sleeping;
        }
    }
}

```

Sample program output (just one program)

```
public class GetGroup {
    private final double thoughRight;
    private final double socialYear;
    private final double manOne;
    private final int appear;

    private double man;
    private double comeHis;
    private double certain;

    public GetGroup(double thoughRight, double socialYear, double manOne, int appear) {
        this.thoughRight = thoughRight;
        this.socialYear = socialYear;
        this.manOne = manOne;
        this.appear = appear;
    }

    public double getThoughRight() {
        return thoughRight;
    }

    public double getSocialYear() {
        return socialYear;
    }

    public double getManOne() {
        return manOne;
    }

    public int getAppear() {
        return appear;
    }

    public double getMan() {
        return man;
    }

    public double getComeHis() {
        return comeHis;
    }

    public double getCertain() {
        return certain;
    }

    public void setMan(double man) {
        this.man = man;
    }

    public void setComeHis(double comeHis) {
        this.comeHis = comeHis;
    }

    public void setCertain(double certain) {
        this.certain = certain;
    }
}

```

Another sample output:

```
public class TryControl {
    private final int over;
    private final double thatState;
    private final long jobInto;
    private final long canPut;

    private int policy;
    private int neverWhile;

    public TryControl(int over, double thatState, long jobInto, long canPut) {
        this.over = over;
        this.thatState = thatState;
        this.jobInto = jobInto;
        this.canPut = canPut;
    }

    public int getOver() {
        return over;
    }

    public double getThatState() {
        return thatState;
    }

    public long getJobInto() {
        return jobInto;
    }

    public long getCanPut() {
        return canPut;
    }

    public int getPolicy() {
        return policy;
    }

    public int getNeverWhile() {
        return neverWhile;
    }

    public void setPolicy(int policy) {
        this.policy = policy;
    }

    public void setNeverWhile(int neverWhile) {
        this.neverWhile = neverWhile;
    }
}

```
> 11 votes

# Answer
# bash

Output some comments from random source files at random intervals, followed by a randomly generated do-nothing progress bar.

```
#!/bin/bash

# The directory to extract source comments from
srcdir=~/src/php-src/

# Generate a status bar that lasts a random amount of time.
# The actual amount of time is somewhere between 1.5 and 30
# seconds... I think. I fudged this around so much it's hard to tell.
function randstatus() {
    bsize=4096
    r_rate=$(echo "$RANDOM/32767 * $bsize * 1.5 + $bsize / 4" | bc -l | sed 's/\..*$//')
    r_min=3
    r_max=15
    r_val=$(($r_min + $RANDOM % $(($r_max - $r_min)) ))
    i=0
    dd if=/dev/urandom bs=$bsize count=$r_val 2> /dev/null | pv -L $bsize -s $(($r_val * bsize)) > /dev/null
}

# Picks a random .c file from the given directory, parses
# out one-line comments, and outputs them one by one with a
# random delay between each line.
function randout() {
    r_file=$(find $1 -name '*.c' | sort -R | head -n 1)
    echo "# $r_file"
    grep '^\s*/\*.*\*/\s*$' $r_file | sed 's:[/\*]::g' | sed -e 's:^\s\+::' -e 's:\s\+$::' | sed -e 's:^\W\+::' | grep -v '^$' | while read line; do
        echo $line
        sleep $(printf "%0.2f" $(echo "$((($RANDOM%4)+1))/4" | bc -l))
    done
}

while true; do
    randout $srcdir
    randstatus
    # sleep here to make it easier to break out of the 'while read' loop
    sleep 2
done

```

Output:

```
# /home/jerkface/src/php-src/sapi/fpm/fpm/fpm_shm.c
Id: fpm_shm.c,v 1.3 20080524 17:38:47 anight Exp $
c) 2007,2008 Andrei Nigmatulin, Jerome Loyet
MAP_ANON is deprecated, but not in macosx
  32kB 0:00:08 [3.97kB/s] [====================================================================>] 100%
# /home/jerkface/src/php-src/ext/mbstring/mb_gpc.c
Id$
includes
mbfl_no_encoding _php_mb_encoding_handler_ex()
split and decode the query
initialize converter
auto detect
convert encoding
we need val to be emalloc()ed
add variable to symbol table
SAPI_POST_HANDLER_FUNC(php_mb_post_handler)
  12kB 0:00:03 [4.02kB/s] [===============>                                                      ] 24% ETA 0:00:09

```
> 9 votes

# Answer
## Rsync form BASH

```
 rsync -n -avrIc --verbose  ~ ~ | sed s/"(DRY RUN)"/""/g
# Note the space at the beginning of the above line,

```

***rsync*** *\- a fast, versatile, remote (and local) file-copying tool*... that with *-n* performs a *dry run*, only try to do, do not really do, and shows what happens.
In this case try to check if to update all file of your home directory (and *sub-folders*).
If you have the root access of course you can run it on a bigger part of your filesystem.

**Notes:**

1. If `HISTCONTROL=ignoreboth` or at least `HISTCONTROL=ignorespace` in your *bash session* your *bash history* will not remember that command if you write it with a space before. (You cannot push up and see it on the screen, neither in the *history log*).
2. `| sed s/"(DRY RUN)"/""/g` will pipe the output through `sed` that will erase the `(DRY RUN)` text at the end of the rsync output. If an expert check you can say you really doing that, not only testing.
3. `-avrIc` you can change those options, check on `man rsync`, but **never remove the `-n`**, else you should have serious problem, even more if you run as root... `8-O`!
> 7 votes

# Answer
# Cobra

This opens a console window that loops through various fake objects and assorted things, incrementing in passes and progress for each pass. It waits for a small random time each increment, to simulate actual computation delays.

```
class Does_Nothing_Useful
    var _rng as Random = Random()
    var _hash
    var _pass
    var _names as String[] = @['Vector', 'Object', 'File', 'Index', 'Report', 'Library', 'Entry', 'Log', 'Resource', 'Directory']
    def main
        while true
            .refresh
            name as String = _names[_rng.next(_names.length)] + ' ' + _hash.toString
            for i in _pass
                progress as decimal = 0
                while progress < 100000
                    progress += _rng.next(1000)
                    print name + '; pass', i, ' : ', progress/1000
                    wait as int = 0
                    for n in _rng.next(50), wait += _rng.next(1,100)
                    System.Threading.Thread.sleep(wait)
                print name + '; pass', i, '--FINISHED--'
                print ''
                System.Threading.Thread.sleep(_rng.next(1000,17500))
            print name, '--EVAL COMPLETE--'
            print ''
            System.Threading.Thread.sleep(_rng.next(12500,30000))
    def refresh
        _hash = _rng.next.getHashCode
        _pass = _rng.next(256)
        print '--LOADING NEXT TARGET--'
        print ''
        System.Threading.Thread.sleep(_rng.next(12500,30000))

```
> 6 votes

# Answer
**Maven under bash**

Maven is just perfect for this kind of task ;-)

```
while true;
do mvn -X archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false;
done

```
> 6 votes

# Answer
I wrote a stupid python script to do this once. Called "ProgramAboutNothing"... I'm not sure it's that convincing but it only took me about 10 minutes. It just outputs random sentences describing what it is supposedly doing... I could probably have chosen better words for it that might look more convincing but I never actually used it properly. I guess if someone wants to use it they can edit it and add their own words in the lists... Fans of Sim City might notice something familiar, though. :P

```
from random import randrange
from time import sleep

nouns = ["bridge", "interface", "artifact", "spline"]
verbs = ["building", "articulating", "reticulating", "compiling", "analyzing"]
adjectives = ["mix", "abstract", "essential"]

while True:
    one = randrange(0,5)
    two = randrange(0,4)
    print "%s %s" % (verbs[one], nouns[two]),
    sleep(randrange(0,500)/100)
    print ".",
    sleep(randrange(0,500)/100)
    print ".",
    sleep(randrange(0,500)/100)
    print ".\n",
    loop = randrange(0,50)
    one = randrange(0,5)
    for i in range(loop):
        two = randrange(0,4)
        three = randrange(0,3)
        print "%s %s %s" % (verbs[one], nouns[two], adjectives[three]),
        sleep(randrange(0,250)/100)
        print ".",
        sleep(randrange(0,250)/100)
        print ".",
        sleep(randrange(0,250)/100)
        print ".\n",

```
> 4 votes

# Answer
How about this one? It will download the codegolf HTML data every 1 second. So, the data will keep on changing as long as the newer questions come in. At the same time, it will also appear as if you are downloading some critical data from a website.

```
while true; do
sleep 1;
curl "codegolf.stackexchange.com" -s |  w3m -dump -T text/html;
done

```
> 4 votes

# Answer
# Bash

The recursive directory list:

```
ll -R /

```
> 3 votes

# Answer
This is a C++ Compiler Simulation (written in C#):

```
using System;
using System.Collections.Generic;
using System.Management;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Reflection;

class FakeCompiler {
    static void DoPrint(string txt) {
        Console.WriteLine("Compiling " + txt);
        Thread.Sleep(1000);
    }
    static string Extract(string TypeName) {
        string rt = TypeName.Split(new Char[] {'.'})[ TypeName.Split(new Char[] {'.'}).Length - 1 ];
        if (rt.Contains("+")) {
            rt = rt.Split(new char[] { '+' })[1];
        }
        if (rt.Contains("[")) {
            rt = rt.Split(new char[] { '[' })[0];
        }
        return rt;
    }
    static void DoCompileSingleFile(string _Type_Name) {
        string print = Extract(_Type_Name);
        DoPrint(print + ".h");
        DoPrint(print + ".cpp");
    }
    static Type[] DoFakeCompile_Assembly(string _AssemblyFileName) {
        System.Reflection.Assembly _asm = System.Reflection.Assembly.Load(_AssemblyFileName);
        Type[] _ts = _asm.GetTypes();
        for (int h = 0; h < 15; ++h) {
            DoCompileSingleFile(_ts[h].ToString());
        }
        return _ts;
    }
    static void DoFakeLinkErrors(Type[] t) {
        Console.WriteLine("linking..");
        Thread.Sleep(2000);
        MethodInfo[] mi;
        for (int i = 0; i < t.Length; ++i) {
            mi = t[i].GetMethods();
            for (int j = 0; j < mi.Length; ++j) {
                Console.WriteLine("Link Error: The object {@!" + mi[j].ToString().Split(new char[] {' '})[0] + "#$? is already defined in " + Extract(t[i].ToString()) + ".obj");
                Thread.Sleep(200);
            }
        }
    }
    static void Main(string[] args) {
        Console.WriteLine("Fictional C/C++ Optimizing Command-line Compiler Version 103.33.0");
        DoFakeLinkErrors(DoFakeCompile_Assembly("mscorlib.dll"));
    }
}

```
> 2 votes

# Answer
# xdotool and an IDE (for example eclipse)

For X11 users.

Use this script and make sure you just `Alt`+`tab`'ed from Eclipse. You need a java file. For example here: https://raw.githubusercontent.com/Valay/Longest-Word-Made-of-other-Words/master/LongestWord.java

```
#!/bin/sh

xdotool key alt+Tab
xdotool sleep 0.2
xdotool type --delay 300 "$(cat LongestWord.java)"
xdotool key alt+Tab

```
> 2 votes

# Answer
# Batch

Place in a folder with a lot of files. If it scrolls by fast enough, no one will suspect anything.

```
:l
dir/s
echo %RANDOM%
echo %RANDOM%
echo %RANDOM%
goto l

```
> 2 votes

# Answer
```
emerge @world

```

full recompile on gentoo
> 2 votes

# Answer
# C#

Slowly type up the full HTML of this webpage in the console. Added random time between "keystrokes" for realistic effect.

```
class HTMLConsole
{
    static void Main(string[] args)
    {
        System.Net.WebClient wc = new System.Net.WebClient();
        string webData = wc.DownloadString("http://codegolf.stackexchange.com/questions/30322/make-it-look-like-im-working");
        for(int i = 0; i < webData.Length; i++)
        {
            Console.Write(webData[i]);
            System.Threading.Thread.Sleep(new Random().Next(20, 300));
        }
    }
}

```

Alternatively, here is a program that will download, extract, unzip randomly-named packages, programs, bundles etc. forever.

```
class C
{
    static Random rnd = new Random();

    static void Main(string[] args)
    {
        for(;;)
        {
            string dType = GetDType();
            string extension = GetExt(dType);
            Console.Write(GetAction() + ' ' + dType + ' ' + GetName() + extension + "   .");
            for(int i = 0; i < rnd.Next(5, 40);i++)
            {
                Console.Write("\b..");
                Loading();
            }
            Console.Write("\bDone");
            Console.WriteLine();
        }
    }

    static string GetExt(string dType)
    {
        if (dType == "Package")
        {
            int r = rnd.Next(1, 5);
            if (r == 1) return ".crx";
            if (r == 2) return ".zip";
            if (r == 3) return ".rar";
            if (r == 4) return ".tar.gz";
            if (r == 5) return ".ymp";
            if (r == 6) return ".umx";
            if (r == 7) return ".gpk";
        }

        if (dType == "Bundle")
        {
            int r = rnd.Next(1, 3);
            if (r == 1) return ".app";
            if (r == 2) return ".bun";
        }

        if (dType == "Program")
        {
            int r = rnd.Next(1, 14);
            if (r == 1) return ".acc";
            if (r == 2) return ".akp";
            if (r == 3) return ".awk";
            if (r == 4) return ".fas";
            if (r == 5) return ".frx";
            if (r == 6) return ".int";
            if (r == 7) return ".mar";
            if (r == 8) return ".pdm";
            if (r == 9) return ".pgm";
            if (r == 10) return ".rn";
            if (r == 11) return ".sbp";
            if (r == 12) return ".t64";
            if (r == 13) return ".wxh";
        }

        if (dType == "Document")
        {
            int r = rnd.Next(1, 12);
            if (r == 1) return ".abc";
            if (r == 2) return ".rpl";
            if (r == 3) return ".doc";
            if (r == 4) return ".dat";
            if (r == 5) return ".hcg";
            if (r == 6) return ".indd";
            if (r == 7) return ".jw";
            if (r == 8) return ".mnt";
            if (r == 9) return ".neis";
            if (r == 10) return ".odm";
            if (r == 11) return ".pdf";
        }

        if (dType == "Update")
        {
            int r = rnd.Next(1, 5);
            if (r == 1) return ".rtp";
            if (r == 2) return ".mum";
            if (r == 3) return ".upd";
            if (r == 4) return ".bdf";
        }

        return "";

    }

    static string GetAction()
    {
        int r = rnd.Next(1, 6);

        if (r==1) return "Downloading";
        if (r==2) return "Unzipping";
        if (r==3) return "Installing";
        if (r==4) return "Extracting";
        if (r==5) return "Encrypting";

        return "";

    }

    static string GetName()
    {
        int length = rnd.Next(5, 12);
        string output = "";
        for(int i = 0; i < length; i++)
        {
            char c = (char)rnd.Next(97, 122);
            if (i == 0) c = char.ToUpper(c);
            else
            {
                bool same = (("aeiouAEIOU".IndexOf(c) >= 0) && ("aeiouAEIOU".IndexOf(output[i - 1]) >= 0))
                    || (!("aeiouAEIOU".IndexOf(c) >= 0) && !("aeiouAEIOU".IndexOf(output[i - 1]) >= 0));
                if (same)
                {
                    i--;
                    continue;
                }
            }
            output += c;
        }

        string version = "-";
        for(int i = 0; i < rnd.Next(1, 4); i++)
        {
            if (i != 0) version += ".";
            version += rnd.Next(0, 10);
        }

        int r = rnd.Next(1, 5);
        if (r == 1) version += "-BETA";
        if (r == 2) version += "-ALPHA";
        if (r == 3) version += "-" + ((char)rnd.Next(97,122)) + (rnd.Next(1000, 10000));

        output += version;

        return output;
    }

    static string GetDType()
    {

        int r = rnd.Next(1, 6);

        if (r==1) return "Package";
        if (r==2) return "Bundle";
        if (r==3) return "Program";
        if (r==4) return "Document";
        if (r==5) return "Update";

        return "";
    }

    static void Loading()
    {
        char s = '|';
        for(int i = 0; i < rnd.Next(10, 100); i++)
        {
            if (s == '\\') s = '|';
            if (s == '-') s = '\\';
            if (s == '/') s = '-';
            if (s == '|') s = '/';
            Console.Write('\b');
            Console.Write(s);
            System.Threading.Thread.Sleep(50);

        }
    }
}

```
> 2 votes

# Answer
# Rebol 2.7

This is very simple but nice example, noone can blame you if you have to download a lot of logs from a website.

```
    repeat count 100000 [print rejoin  ["Downloading log number " to-string count ": "  to-string to-hex to-integer random 56754674373263244673426342732]]

```
> 1 votes

# Answer
```
<?php
   echo "Script is running, please wait...";
?>

```
> -2 votes

---
Tags: popularity-contest, underhanded
---


title: 420 <s>Blaze</s> Golf It

text:
# Question
Title: 420 <s>Blaze</s> Golf It
This is a pretty simple challenge, but (I hope) a fun one.

# Task

If right now either the month is `4` and the day is `20`, the hour (on a 12 hour clock) is `4` and the minute is `20`, or the minute is `4` and the second is `20`, print this ascii art:

```
                        .
                       .:.
                       :|:
                      .:|:.
                      ::|::
       :.             ::|::             .:
       :|:.          .::|::.          .:|:
       ::|:.         :::|:::         .:|:;
       `::|:.        :::|:::        .:|::'
        ::|::.       :::|:::       .::|:;
        `::|::.      :::|:::      .::|::'
         :::|::.     :::|:::     .::|::;
         `:::|::.    :::|:::    .::|::;'
`::.      `:::|::.   :::|:::   .::|::;'     .:;'
 `:::..    `;::|::.  :::|:::  .::|:::    ::::;
   `:::::.    ':|::. :::|::: .::|:'   ,::::;'
     `:::::.    ':|:::::|:::::|:'   :::::;'
       `:::::.:::::|::::|::::|::::.,:::;'
          ':::::::::|:::|:::|:::::::;:'
             ':::::::|::|::|:::::::''
                  `::::::::::;'
                 .:;'' ::: ``::.
                      :':':
                        ;

```

You can have trailing spaces.

Otherwise, print the number of minutes and seconds left until the next such occasion in the format: `%d minutes and %d seconds left until your next hit.` with the time being minimized.

This is , so shortest code in **bytes** wins!

*P.S. If this challenge is too inappropriate for this site, tell me and I'll change it.*

# Answer
# Python 2, 371 bytes

This source contains non-printable bytes, so it is presented as a hexdump that can be decoded with `xxd -r`.

```
00000000: efbb bf66 726f 6d20 7469 6d65 2069 6d70  ...from time imp
00000010: 6f72 742a 0a74 3d74 696d 6528 290a 693d  ort*.t=time().i=
00000020: 300a 7768 696c 6527 3034 3a32 3027 6e6f  0.while'04:20'no
00000030: 7420 696e 2073 7472 6674 696d 6528 2725  t in strftime('%
00000040: 6d3a 2564 2572 272c 6c6f 6361 6c74 696d  m:%d%r',localtim
00000050: 6528 742b 6929 293a 692b 3d31 0a70 7269  e(t+i)):i+=1.pri
00000060: 6e74 5b22 7801 74cd c701 c430 0844 d1bb  nt["x.t....0.D..
00000070: aaf0 cd99 0286 6654 887a dfa0 f41d 7136  ......fT.z....q6
00000080: 8f61 7829 0b6f 5c72 bdb6 9414 de86 d2eb  .ax).o\r........
00000090: 9894 d4e7 64f7 de39 099a 8ed8 32b5 d34a  ....d..9....2..J
000000a0: e8c9 2a53 9da4 371a b1d0 a3d4 18e8 b212  ..*S..7.........
000000b0: 5a25 a139 158a ac90 4cba 7692 4007 c62e  Z%.9....L.v.@...
000000c0: 81b8 31c4 9682 04e2 6ab8 8f21 3bb3 3ce1  ..1.....j..!;.<.
000000d0: 7582 0163 8524 79a8 c175 cb58 7ce5 45ff  u..c.$y..u.X|.E.
000000e0: b3b7 8cc7 bfbe fbaa 9b95 b068 1837 db90  ...........h.7..
000000f0: a546 b54a 5cb9 5c38 6801 0936 a2a8 a85e  .F.J\.\8h..6...^
00000100: 6ca3 4c3e 8e83 a4ef 1412 12ac 7027 7075  l.L>........p'pu
00000110: 2084 ca61 026b 5c30 286e a1fe 222e 6465   ..a.k\0(n..".de
00000120: 636f 6465 2827 7a69 7027 292c 2725 6420  code('zip'),'%d
00000130: 6d69 6e75 7465 7320 616e 6420 2564 2073  minutes and %d s
00000140: 6563 6f6e 6473 206c 6566 7420 756e 7469  econds left unti
00000150: 6c20 796f 7572 206e 6578 7420 6869 742e  l your next hit.
00000160: 2725 2869 2f36 302c 6925 3630 295d 5b69  '%(i/60,i%60)][i
00000170: 3e30 5d                                  >0]

```

Readable part:

```
from time import*
t=time()
i=0
while'04:20'not in strftime('%m:%d%r',localtime(t+i)):i+=1
print["(ZLIB DATA)".decode('zip'),'%d minutes and %d seconds left until your next hit.'%(i/60,i%60)][i>0]

```
> 5 votes

# Answer
# JavaScript (ES6), 537 bytes

```
alert((f=t=>new Date(Date.now()+t*1e3).toISOString().match`(T16|04)[-:]20`)(i=0)?"À\u0019\u0002û1!°?4\u0002ë14!°>C3\u0002=\u0001Ê34\u0003Ê1\u0002=4\u00011C3\u000114\u0002=C\u0013ð4\u0009\u001fCS\u0002m34\u0001>Ià14s\u0002>C3\u0001=IÐ1CS\u0002n34\u0013À4\u0009\u001c34s\u0002?I3\u0001;I°1C3%ð6I3\u0001:I 1C3ub3\u0001l4\u00134\u0009\u001934S\u0007\u001bS'`\u0011 V34\u0013\u00004\u0009\u001034\u0009:Z\u0002i³\u0001zC3\u00014\u00091Cs8Z'°6\u001b 74K³4\u00079['Ð6\u001b³4J£4\u001a8Y' yó4I4]s\u0002Ê7M34CÓw\u0002«6u\u00021u\u0007`6\u0013\u0002ëss#ÀY".replace(/./g,c=>(l=" .\n:|;`',0123456")[(n=c.charCodeAt())&15]+l[n>>4]).replace(/.\d+/g,c=>c[0].repeat(parseInt(c.slice(1),7)+3)):eval('for(;!f(++i););`${i/60|0} minutes and ${i%60|0} seconds left until your next hit.`'))
```

Uses the CP-1252 encoding.

*Note: All unreadables in this post are escaped with `\u00xx` so that the Stack Exchange system doesn't automatically remove them. They should be considered to have a size of one byte.*

## Explanation

Uses a run-length encoding scheme along with packing each character into 4 bits. The main logic of the code is 174 bytes and the leaf string (including decompression) is 364 bytes. Further details of the compression method are found below.

```
alert((
  f=t=>                                   // f checks for 4:20 in a date
    new Date(Date.now()+t*1e3)            // get the date at now + t seconds
    .toISOString().match`(T16|04)[-:]20`  // find 4:20 in the ISO date string
)(i=0)?

  // Leaf decompression
  "À\u0019\u0002û1!°?4\u0002ë14!°>C3\u0002=\u0001Ê34\u0003Ê1\u0002=4\u00011C3\u000114\u0002=C\u0013ð4\u0009\u001fCS\u0002m34\u0001>Ià14s\u0002>C3\u0001=IÐ1CS\u0002n34\u0013À4\u0009\u001c34s\u0002?I3\u0001;I°1C3%ð6I3\u0001:I 1C3ub3\u0001l4\u00134\u0009\u001934S\u0007\u001bS'`\u0011 V34\u0013\u00004\u0009\u001034\u0009:Z\u0002i³\u0001zC3\u00014\u00091Cs8Z'°6\u001b 74K³4\u00079['Ð6\u001b³4J£4\u001a8Y' yó4I4]s\u0002Ê7M34CÓw\u0002«6u\u00021u\u0007`6\u0013\u0002ëss#ÀY"
  .replace(/./g,c=>                       // unpack each 4-bit character
    (l=" .\n:|;`',0123456")               // l = lookup table of characters
    [(n=c.charCodeAt())&15]+l[n>>4]       // return the two characters in the byte
  )
  .replace(/.\d+/g,c=>                    // run-length decoding
    c[0].repeat(parseInt(c.slice(1),7)+3) // repeat character n + 3 times (base-7)
  )

:eval(`                                   // eval just to allow a for loop here...
  for(;!f(++i););                         // check each second up until a match

  \`${i/60|0} minutes and ${i%60|0} seconds left until your next hit.\`
`))

```

## Compression Algorithms

### No Compression, 911 bytes

This is the leaf string with no compression at all.

```
`                        .
                       .:.
                       :|:
                      .:|:.
                      ::|::
       :.             ::|::             .:
       :|:.          .::|::.          .:|:
       ::|:.         :::|:::         .:|:;
       \`::|:.        :::|:::        .:|::'
        ::|::.       :::|:::       .::|:;
        \`::|::.      :::|:::      .::|::'
         :::|::.     :::|:::     .::|::;
         \`:::|::.    :::|:::    .::|::;'
\`::.      \`:::|::.   :::|:::   .::|::;'     .:;'
 \`:::..    \`;::|::.  :::|:::  .::|:::    ::::;
   \`:::::.    ':|::. :::|::: .::|:'   ,::::;'
     \`:::::.    ':|:::::|:::::|:'   :::::;'
       \`:::::.:::::|::::|::::|::::.,:::;'
          ':::::::::|:::|:::|:::::::;:'
             ':::::::|::|::|:::::::''
                  \`::::::::::;'
                 .:;'' ::: \`\`::.
                      :':':
                        ;`

```

### Run-Length Encoding, 542 bytes

Since there are many consecutive repeated characters, run-length encoding improves the byte count significantly.

```
` 21.
 20.:.
 20:|:
 19.:|:.
 19::|::
 4:. 10::|:: 10.:
 4:|:. 7.::|::. 7.:|:
 4::|:. 6:0|:0 6.:|:;
 4\`::|:. 5:0|:0 5.:|::'
 5::|::. 4:0|:0 4.::|:;
 5\`::|::. 3:0|:0 3.::|::'
 6:0|::. 2:0|:0 2.::|::;
 6\`:0|::. 1:0|:0 1.::|::;'
\`::. 3\`:0|::. 0:0|:0 0.::|::;' 2.:;'
 \`:0.. 1\`;::|::.  :0|:0  .::|:0 1:1;
 0\`:2. 1':|::. :0|:0 .::|:' 0,:1;'
 2\`:2. 1':|:2|:2|:' 0:2;'
 4\`:2.:2|:1|:1|:1.,:0;'
 7':6|:0|:0|:4;:'
 10':4|::|::|:4''
 15\`:7;'
 14.:;'' :0 \`\`::.
 19:':':
 21;`.replace(/.\d+/g,c=>c[0].repeat(+c.slice(1)+3))

```

Each character repeated 3 or more times is replaced with the character followed by a decimal number of `amount - 3`. The encoded string is generated with this code:

```
uncompressed.replace(/(.)\1{2,}/g,c=>c[0]+(c.length-3))

```

### 4-bit Packing + RLE, 364 bytes

There are 9 distinct characters in the original string, which means 4 is the minimum number of bits to represent each. Conveniently, this allows for exactly two character representations to fit into a single byte, enabling a simple (and golf-friendly) decompression algorithm to be used. On top of that, there are 7 characters left over, which allows base-7 run-length encoding to be used before packing. Putting each 4-bit index into the upper and lower nibbles of each compressed character means 2 characters are stored per byte, because the CP-1252 encoding encodes every character under code point 256 as a single byte.

```
"À\u0019\u0002û1!°?4\u0002ë14!°>C3\u0002=\u0001Ê34\u0003Ê1\u0002=4\u00011C3\u000114\u0002=C\u0013ð4\u0009\u001fCS\u0002m34\u0001>Ià14s\u0002>C3\u0001=IÐ1CS\u0002n34\u0013À4\u0009\u001c34s\u0002?I3\u0001;I°1C3%ð6I3\u0001:I 1C3ub3\u0001l4\u00134\u0009\u001934S\u0007\u001bS'`\u0011 V34\u0013\u00004\u0009\u001034\u0009:Z\u0002i³\u0001zC3\u00014\u00091Cs8Z'°6\u001b 74K³4\u00079['Ð6\u001b³4J£4\u001a8Y' yó4I4]s\u0002Ê7M34CÓw\u0002«6u\u00021u\u0007`6\u0013\u0002ëss#ÀY"
.replace(/./g,c=>(l=" .\n:|;`',0123456")[(n=c.charCodeAt())&15]+l[n>>4])
.replace(/.\d+/g,c=>c[0].repeat(parseInt(c.slice(1),7)+3))

```

The following code is used to do the run-length encoding and packing:

```
chars="",max=16;
[...uncompressed].map(c=>~chars.indexOf(c)?0:chars+=c);
base=max-chars.length;
chars+=[...Array(base).keys()].join``;
unpacked=uncompressed.replace(/(.)\1{2,}/g,c=>c[0]+(c.length-3).toString(base));
packed=unpacked.replace(/(.|\n){2}/g,s=> // Note: unpacked length must be even!
  String.fromCharCode(chars.indexOf(s[0])|(chars.indexOf(s[1])<<4)));

```

### Huffman Coding, (Possible Future Improvement)

Certain characters occur much more than others, so a Huffman encoding (variable-length integers representing each character) could save some further bytes. However this will introduce a lot more complexity into the decompression algorithm, so aside from being a lot more work it may also cost more bytes to decompress it than it saves in the encoded string.
> 4 votes

# Answer
# Javascript ES6, 905 bytes

Whew.. The 12 hour clock killed my otherwise short (*ahum*) solution.
905 bytes to print 898 chars of ascii art yay

```
_=>(a=(d=Date)(c=new d(),z=O=>Math.abs(new d(a[3]+O)-c)).split` `)[1]=='Apr'&a[2]==20|~a[4].search(/(04|16):20/)?'0,0,2ca2o,0,10e,0,0,1eu9z4,0,22w,1ulajuo,0,bklxc,2zgg,i,120gdfk,8lc,1s1s,15,j0jf9c,7em8,tac,10,190zcw0,tm8w,ksk,hra0ia,mihog0,3aels,wy,iv8e15,b98u80,cvs1s,575,9fm71g,190zcw0,bg7vgg,1t4,148d4lu,121pblx,b9ea68,2b36,iv8hn5,9zleso,15kytz4,98cp,4fwpwk,zir9ud,1h9u3ln,11c6vb4,84kda8,kbuo05,b98u84,14possy,k9su6i,a26hwk,zvft34,kavrpc,1tn1j4,1r3jis,kamgao,a5bhq8,2b2q,beyt6x,j0y810,muhiww,9xl,a5b7s8,14npcwi,1bkfw1s,4ys,14lipw4,kalr6k,0,1aq,kalqzg,0,48m,2j6hqf,zik0zk,0,33mcjk,0,5'.split`,`.map(a=>('0'.repeat(32)+parseInt(a,36).toString(2)).substr(-32)).join``.match(/.{1,3}/g).map(a=>` .:\`|;'
`[parseInt(a,2)]).join``:~~((T=Math.min(z('/4/20'),z(` ${a[1]} ${++a[2]} 0:4:20`),z(' 4:20'),z(' 0:4:20'),z(' 16:20'),z(' 0:16:20'))/1000)/60)+` minutes and ${~~(T%60)} seconds left until your next hit.`

```

### Ungolfed code

Note: The ungolfed code will not execute

```
function() {
    // (all vars here are actually global)
    var d = Date; // short reference to Date object
    var dateString = Date() // "Tue Apr 12 2016 20:13:00 GMT+0200 (W. Europe Daylight Time)"
    .split` `; // ["Tue", "Apr", "12", ...]
    var currentDate = new Date();
    dateDiff = function(toAppend) {
        return Math.abs( // no dates in the past
            new Date(dateString[3] + toAppend) // new Date('2016' + something)
            - currentDate // substract the current date.
                          // Thanks JS for the datetime implementation
        );
    }

    if ((dateString[1] == 'Apr' & dateString[2] == 20) |
        ~dateString[4].search(/(04|16):20/)) { // if the time doesn't contain 04:20 or
                                               // 16:20, this will return -1. ~-1 is 0
                                               // and thus falsy
        alert(printAscii());
    } else {
        alert(printTimeLeft());
    }
}

function printAscii() {
    var magicString = '0,0,2ca2o,0,10e,0,0,1eu9z4,0,22w,1ulajuo,0,bklxc,2zgg,i,120gdfk,8lc,1s1s,15,j0jf9c,7em8,tac,10,190zcw0,tm8w,ksk,hra0ia,mihog0,3aels,wy,iv8e15,b98u80,cvs1s,575,9fm71g,190zcw0,bg7vgg,1t4,148d4lu,121pblx,b9ea68,2b36,iv8hn5,9zleso,15kytz4,98cp,4fwpwk,zir9ud,1h9u3ln,11c6vb4,84kda8,kbuo05,b98u84,14possy,k9su6i,a26hwk,zvft34,kavrpc,1tn1j4,1r3jis,kamgao,a5bhq8,2b2q,beyt6x,j0y810,muhiww,9xl,a5b7s8,14npcwi,1bkfw1s,4ys,14lipw4,kalr6k,0,1aq,kalqzg,0,48m,2j6hqf,zik0zk,0,33mcjk,0,5' // ;)
    var splitted = magicString.split`,`;
    var binarySequence = splitted.map(function(piece) {
        return ('0'.repeat(32) + // 000000000... this will be padded
            parseInt(a,36) // parseInt('190zcw0',36) -> 000000002722627584
            .toString(2) // -> 10100010010010000000000000000000
        ).substr(-32) // left pad binary sequence
    }).join``; // create one big binary sequence from several smaller
    var groupsOfThree = binarySequence.match(/.{1,3}/g);
    return groupsOfThree.map(function(three) {
        return ` .:\`|;'\n`[parseInt(a,2)]; // magic.. turn 010 into : etc
    }).join``; // create them blaze
}

function printTimeLeft() {
    // this is way longer than it should be.. probably
    var minimumTimeDifference = Math.min(
        dateDiff('/4/20'), // -> Difference between now and 2016/4/20 00:00:00
        dateDiff(' 4:20'), // 2016 04:20:00.. Sadly the 2016 is needed (i think)
        dateDiff(' 0:4:20'), // 2016 00:04:20
        dateDiff(' 16:20'), // Damn 12 hour clock :(
        dateDiff(' 0:16:20'),
        dateDiff(` ${dateString[1]} // 2016 Apr
                   ${dateString[2]+1} // 2016 Apr 13 (12+1)
                   0:4:20` // Check the first occurrence of 4 minutes and 20 seconds
                           // the next day
    )
    var timeInSeconds = minimumTimeDifference / 1000;
    return Math.floor(timeInSeconds) + // ~~ works like Math.floor
        ` minutes and ${Math.floor(timeInSeconds%60)} seconds left until your next hit.`;
}

```

### Try it!

```
f=
_=>(a=(d=Date)(c=new d(),z=O=>Math.abs(new d(a[3]+O)-c)).split` `)[1]=='Apr'&a[2]==20|~a[4].search(/(04|16):20/)?'0,0,2ca2o,0,10e,0,0,1eu9z4,0,22w,1ulajuo,0,bklxc,2zgg,i,120gdfk,8lc,1s1s,15,j0jf9c,7em8,tac,10,190zcw0,tm8w,ksk,hra0ia,mihog0,3aels,wy,iv8e15,b98u80,cvs1s,575,9fm71g,190zcw0,bg7vgg,1t4,148d4lu,121pblx,b9ea68,2b36,iv8hn5,9zleso,15kytz4,98cp,4fwpwk,zir9ud,1h9u3ln,11c6vb4,84kda8,kbuo05,b98u84,14possy,k9su6i,a26hwk,zvft34,kavrpc,1tn1j4,1r3jis,kamgao,a5bhq8,2b2q,beyt6x,j0y810,muhiww,9xl,a5b7s8,14npcwi,1bkfw1s,4ys,14lipw4,kalr6k,0,1aq,kalqzg,0,48m,2j6hqf,zik0zk,0,33mcjk,0,5'.split`,`.map(a=>('0'.repeat(32)+parseInt(a,36).toString(2)).substr(-32)).join``.match(/.{1,3}/g).map(a=>` .:\`|;'
`[parseInt(a,2)]).join``:~~((T=Math.min(z('/4/20'),z(` ${a[1]} ${++a[2]} 0:4:20`),z(' 4:20'),z(' 0:4:20'),z(' 16:20'),z(' 0:16:20'))/1000)/60)+` minutes and ${~~(T%60)} seconds left until your next hit.`

alert(f())
```

In the following code snippet you can set the date to test the ascii art

```
day=prompt('Day?', 12);
month=prompt('Month?', 'Apr');
f=
_=>(a=(d=Date)(c=new d(),z=O=>Math.abs(new d(a[3]+O)-c)).split` `)[1]==month&a[2]==day|~a[4].search(/(04|16):20/)?'0,0,2ca2o,0,10e,0,0,1eu9z4,0,22w,1ulajuo,0,bklxc,2zgg,i,120gdfk,8lc,1s1s,15,j0jf9c,7em8,tac,10,190zcw0,tm8w,ksk,hra0ia,mihog0,3aels,wy,iv8e15,b98u80,cvs1s,575,9fm71g,190zcw0,bg7vgg,1t4,148d4lu,121pblx,b9ea68,2b36,iv8hn5,9zleso,15kytz4,98cp,4fwpwk,zir9ud,1h9u3ln,11c6vb4,84kda8,kbuo05,b98u84,14possy,k9su6i,a26hwk,zvft34,kavrpc,1tn1j4,1r3jis,kamgao,a5bhq8,2b2q,beyt6x,j0y810,muhiww,9xl,a5b7s8,14npcwi,1bkfw1s,4ys,14lipw4,kalr6k,0,1aq,kalqzg,0,48m,2j6hqf,zik0zk,0,33mcjk,0,5'.split`,`.map(a=>('0'.repeat(32)+parseInt(a,36).toString(2)).substr(-32)).join``.match(/.{1,3}/g).map(a=>` .:\`|;'
`[parseInt(a,2)]).join``:~~((T=Math.min(z('/4/20'),z(` ${a[1]} ${++a[2]} 0:4:20`),z(' 4:20'),z(' 0:4:20'),z(' 16:20'),z(' 0:16:20'))/1000)/60)+` minutes and ${~~(T%60)} seconds left until your next hit.`

alert(f())
```
> 3 votes

---
Tags: code-golf, ascii-art, kolmogorov-complexity, date
---