Duct tape can fix anything Overview

This challenge was inspired by this StackOverflow Meta post.  In it, @hakre says:


  I've seen a project really written by Stackoverflow (a noob copies together from SO here and SO there), attribution normally never is done which results in rights termination under CC. (sic)


Your mission is to make the most interesting program you can -- without ever writing a single line of code.  You can only use code which is already written for you, both in questions and answers from StackOverflow.  All you can do is duct tape it all together the best you can.  And of course, it's very important that we provide appropriate attribution so that we don't get our rights terminated.



Rules


You must include links to the questions/answers you used in your answer.
You may not modify the code you find, with the following exceptions:

a. You may rename variables, functions, and methods.  (This doesn't mean you can change a method invocation, by changing, say scanner.nextInt() to scanner.nextLine() and claiming that you're changing a method name.  The change must be in the definition or reference to the same entity.)

b. You may adjust indentation appropriately.

c. You can assume that the proper modules are loaded for the code snippets to work.  (e.g., import statements for Java and Python, using statements for C# and C++, and their equivalents in all languages)  If the code snippet includes the imports for you, you can move them to the top of the code.

d. If the language requires the code to be in some kind of method body to execute (e.g., public static void main(String[] args) for Java, static int Main(string[] args) for C#, and so on), you can wrap your code in the appropriate method.  But the contents of that main method must remain unmodified.
You must supply an explicit list of any variable/method/function/class rename-ings performed.
You can't take snippets of snippets (meaning if you take a code block from a post, you take the whole thing)
Provide a brief description of what the code does for people who aren't intimate with the language you're using.
Popularity contest, so the most upvotes wins!




Boring Five Minute Example (Python 3)

Description: Reads a bunch of log files from the current directory and randomizes the lines in them (exciting, right? This would totally win a popularity contest)

Source

import glob
import random

for file in glob.glob('log-*-*.txt'):
    # Etc.
    with open(file) as f:
        content = f.readlines()
        # shuffle the list in place 
        random.shuffle(content)

        # print it
        print(content)


Legal Modifications


Renamed fname to file from link 1
Renamed b to content from link 2


Attributions


https://stackoverflow.com/a/3277516/1435657
https://stackoverflow.com/a/16737991/1435657
https://stackoverflow.com/a/4918520/1435657
C - one operation calculator

Let's have this for a start.
It's actually quite hard to find pieces of C programs that aren't whole programs. I had most trouble with declarations.

// http://stackoverflow.com/a/2911978 Block #1 (changed i to a)
static int a = 10;
// http://stackoverflow.com/a/2911978 Block #1 (changed i to b)
static int b = 10;
// http://stackoverflow.com/a/442647 Block #1 (changed c to op)
unsigned char op = (unsigned char)-1;
// http://stackoverflow.com/q/3711048 Inline block #1
int main()
// http://stackoverflow.com/a/14902422 Inline block #1
{
// http://stackoverflow.com/q/217074 Inline block #2 (changed i to a)
scanf("%d", &amp;a)
// http://stackoverflow.com/a/23353870 Inline block #2
;
// http://stackoverflow.com/q/217074 Block #2 (changed c to op)
scanf("%c", &amp;op)
// http://stackoverflow.com/a/23353870 Inline block #2
;
// http://stackoverflow.com/q/217074 Inline block #2 (changed i to b)
scanf("%d", &amp;b)
// http://stackoverflow.com/a/23353870 Inline block #2
;
// http://stackoverflow.com/a/4173188 Block #2
int result = 0;
result = (op == '*') ? a * b : result;
result = (op == '/') ? a / b : result;
result = (op == '+') ? a + b : result;
result = (op == '-') ? a - b : result;
printf("%d",result);
// http://stackoverflow.com/a/3245525 Block #2
printf("\n");  /* prints newline */
// http://stackoverflow.com/q/4138649 Inline block #1
return 0;
// http://stackoverflow.com/a/14902422 Inline block #2
}


Takes a simple integral operation like 3+151 or 41/2 on stdin and outputs the result to stdout.