277
votes
\$\begingroup\$

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!

\$\endgroup\$
29
  • 6
    \$\begingroup\$ What's the winning criteria, popularity-contest? \$\endgroup\$
    – Kyle Kanos
    Commented Jun 7, 2014 at 1:37
  • 36
    \$\begingroup\$ So... what happens if you test an answer and it actually does get you fired? \$\endgroup\$
    – Bob
    Commented Jun 7, 2014 at 11:28
  • 54
    \$\begingroup\$ This gives me an idea for another code golf question. "Make it look like my question shouldn't be put on hold" \$\endgroup\$
    – twiz
    Commented Jun 7, 2014 at 13:26
  • 9
    \$\begingroup\$ Just write one of these programs, and compile! \$\endgroup\$
    – ugoren
    Commented Jun 8, 2014 at 19:15
  • 13
    \$\begingroup\$ I saw a really good remake of the Tron Legacy boardroom on Github the other day: github.com/arscan/encom-boardroom \$\endgroup\$ Commented Jun 9, 2014 at 4:40

33 Answers 33

1
2
2
votes
\$\begingroup\$

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);               

        }
    }
}
\$\endgroup\$
1
vote
\$\begingroup\$

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]]
\$\endgroup\$
-2
votes
\$\begingroup\$
<?php
   echo "Script is running, please wait...";
?>
\$\endgroup\$
1
  • 12
    \$\begingroup\$ Welcome to Programming Puzzles and Code Golf. Please don't take the downvotes personally. Your answer was elegant, simple and achieved the purpose, but where you went wrong is in that it is too easy. Add some preload animation, a fake scrolling status, anything that will actually look like something is doing something and I promise you will get some upvotes. \$\endgroup\$ Commented Jun 13, 2014 at 17:24
1
2

Not the answer you're looking for? Browse other questions tagged or ask your own question.