Prank Code

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

User avatar
Grav
Posts: 61
Joined: Fri Aug 17, 2007 7:45 pm UTC
Contact:

Prank Code

Postby Grav » Wed Mar 23, 2011 1:07 am UTC

I just made some prank code for my friend to compile and excute (purposely made to be unintelligible). He's a new CS major and I thought I'd have a little fun. I didn't tell him what it did, just that he should try this code out. He was not pleased. ^_^

Code: Select all

#include <stdio.h>
void main(void)
{
   unsigned int buf[] = {0x50454542, 0x00070A21};
   while(!fputs((char*)buf, stdout)){};
}


Has anyone else made any fun (harmless) prank code to play on their friends? I can't be the only one.
That's about as witty as something not witty.

Carnildo
Posts: 2023
Joined: Fri Jul 18, 2008 8:43 am UTC

Re: Prank Code

Postby Carnildo » Wed Mar 23, 2011 2:45 am UTC

"PEEB"? What does that mean?

Laguana
Posts: 49
Joined: Sat Jan 19, 2008 10:13 pm UTC

Re: Prank Code

Postby Laguana » Wed Mar 23, 2011 2:56 am UTC

If you reverse the order of the bytes, it is "BEEP!\n\a", or BEEP! (bell character -> audible beep) repeated forever

User avatar
phlip
Restorer of Worlds
Posts: 7572
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: Prank Code

Postby phlip » Wed Mar 23, 2011 2:59 am UTC

Remember, x86 is little-endian...

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

User avatar
Briareos
Posts: 1940
Joined: Thu Jul 12, 2007 12:40 pm UTC
Location: Town of the Big House

Re: Prank Code

Postby Briareos » Wed Mar 23, 2011 3:03 am UTC

How are we supposed to play such a non-portable prank on our friends? Port it over?
Sandry wrote:Bless you, Briareos.

Blriaraisghaasghoasufdpt.
Oregonaut wrote:Briareos is my new bestest friend.

++$_
Mo' Money
Posts: 2370
Joined: Thu Nov 01, 2007 4:06 am UTC

Re: Prank Code

Postby ++$_ » Wed Mar 23, 2011 3:12 am UTC

At some point, I figured out how to twerk the bash prompt so that it would include an string of garbage once per 10 minutes, thereby (hopefully) driving the user crazy trying to figure out why his terminal was occasionally printing garbage in front of his prompt.

I never actually had occasion to use this on someone, though.

bytbox
Posts: 56
Joined: Wed Aug 19, 2009 5:43 am UTC

Re: Prank Code

Postby bytbox » Wed Mar 23, 2011 4:19 am UTC

Briareos wrote:How are we supposed to play such a non-portable prank on our friends? Port it over?


Looks pretty portable to me. Unless you're running an old mac or trying to run it on your smartphone. (Not unheard of - I know people who program in brainfuck on their phones...)

At some point, I figured out how to twerk the bash prompt so that it would include an string of garbage once per 10 minutes, thereby (hopefully) driving the user crazy trying to figure out why his terminal was occasionally printing garbage in front of his prompt.

I never actually had occasion to use this on someone, though.


For april fools, our school's server is set to give everybody a mirrored welcome message. (The actual shell isn't automatically mirrored, for the sake of the plebians who might get confused.)

The less mature have been known to cat /dev/urandom | write SomeoneIHate. Which has led to ACLs being put on the 'write' executable.

User avatar
phlip
Restorer of Worlds
Posts: 7572
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: Prank Code

Postby phlip » Wed Mar 23, 2011 4:29 am UTC

Bah, if you're going to pipe something into write, at least use something interesting, like "bb", or "mplayer -vo aa"...

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

bytbox
Posts: 56
Joined: Wed Aug 19, 2009 5:43 am UTC

Re: Prank Code

Postby bytbox » Wed Mar 23, 2011 4:46 am UTC

phlip wrote:Bah, if you're going to pipe something into write, at least use something interesting, like "bb", or "mplayer -vo aa"...

I've seen attempts - with varying levels of sophistication, to run cmatrix through write. None were too successful.

(The important part of the urandom write is that it hits certain control characters which change the font on most terminal implementations (or tell it to interpret things as 7- rather than 8-bit, and so on), in ways that are not easily fixed with a stty call. Meaning the terminal emulator must be restarted. Which can be a real pain in the arse, depending on the situation.)

User avatar
Xanthir
My HERO!!!
Posts: 5413
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: Prank Code

Postby Xanthir » Wed Mar 23, 2011 5:00 am UTC

Way back in high school, I made a calculator emulator on my calculator (TI-83+). Except, every few equations, it would give out a gibberish answer - a random number, or a "?", or similar.

I then handed it to my calc professor, complaining that my calculator "acting weird". He finally figured out something was up, 5 minutes later, when I could no longer hold in my giggles at his confusion. ^_^
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

User avatar
Grav
Posts: 61
Joined: Fri Aug 17, 2007 7:45 pm UTC
Contact:

Re: Prank Code

Postby Grav » Wed Mar 23, 2011 7:57 pm UTC

Does anyone know an easy way to toggle the hardware beep a motherboard can make (without inducing an actual hardware fault)? My code in the first post makes a beep that can be easily muted by the user (because it goes through the normal speakers). It would be a much better prank if they couldn't mute it because it was actually coming from their MoBo. Is the MoBo speaker memory mapped, or do I have to go through layers of security to access it (and through some special API)? Or is it simply impossible to toggle the hardware beep using software, because it is controlled directly from hardware only (such as during a fail state)?
That's about as witty as something not witty.

User avatar
TaintedDeity
Posts: 4003
Joined: Sun Feb 10, 2008 7:22 pm UTC
Location: England;

Re: Prank Code

Postby TaintedDeity » Wed Mar 23, 2011 8:36 pm UTC

I played a downloadable game a while ago which used the computer's internal speakers to beep at me as an intro. It was not welcomed.
Ⓞⓞ◯

User avatar
phlip
Restorer of Worlds
Posts: 7572
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: Prank Code

Postby phlip » Wed Mar 23, 2011 10:01 pm UTC

It's possible to do from DOS, where you have direct access to the hardware... in a more-featured OS though, like Windows or Linux, it would depend on there being an driver or API for it. Windows had one, but in Vista and 7 the beep comes out of the sound card, not the internal speaker. Linux has a module variously called "pcspkr" or "snd_pcsp", but I'm having trouble finding docs on how to interface with these, as almost all the results when you search for them are people asking how to disable them... if you get the source to this it might give some clues.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

User avatar
TheChewanater
Posts: 1279
Joined: Sat Aug 08, 2009 5:24 am UTC
Location: lol why am I still wearing a Santa suit?

Re: Prank Code

Postby TheChewanater » Wed Mar 23, 2011 11:51 pm UTC

I once wired something up to the motherboard speaker so I could activate it. I don't quite remember what I did, though it may have been to a broken mouse. No coding involved.

Hey, maybe you could control it through an Arduino.
ImageImage
http://internetometer.com/give/4279
No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

User avatar
Grav
Posts: 61
Joined: Fri Aug 17, 2007 7:45 pm UTC
Contact:

Re: Prank Code

Postby Grav » Thu Mar 24, 2011 1:58 am UTC

TheChewanater wrote:I once wired something up to the motherboard speaker so I could activate it. I don't quite remember what I did, though it may have been to a broken mouse. No coding involved.

Hey, maybe you could control it through an Arduino.


That's clever! But I think using a microcontroller would be overkill. This is giving me a whole host of ideas though.

Place a contact sensor on a chair (under a cushion?), when sat on buzzes the computer speaker. You would have to be sneaky with the wires though. Imagine someone calling the helpdesk with that one! "Help! Every time I sit down my computer buzzes!" :lol:
That's about as witty as something not witty.

User avatar
b.i.o
Green is the loneliest number
Posts: 2519
Joined: Fri Jul 27, 2007 4:38 pm UTC
Location: Hong Kong

Re: Prank Code

Postby b.i.o » Thu Mar 24, 2011 4:11 am UTC

Xanthir wrote:Way back in high school, I made a calculator emulator on my calculator (TI-83+). Except, every few equations, it would give out a gibberish answer - a random number, or a "?", or similar.

I then handed it to my calc professor, complaining that my calculator "acting weird". He finally figured out something was up, 5 minutes later, when I could no longer hold in my giggles at his confusion. ^_^

I did something similar: I wrote a program that added 1 to whatever answer it would have otherwise given. (I did it on a friend's calculator though, and had her show the teacher, so it wouldn't be as obvious.) The simple version was only 4-5 lines of TI-BASIC, if I remember correctly (which made it a very easy trick to play on people when they put their calculator down for a minute).

User avatar
TheChewanater
Posts: 1279
Joined: Sat Aug 08, 2009 5:24 am UTC
Location: lol why am I still wearing a Santa suit?

Re: Prank Code

Postby TheChewanater » Thu Mar 24, 2011 4:32 am UTC

I wrote a program that makes it look like it says 2+2 is 5, and had a friend show it to the teacher. He caught on quickly, though. A few classmates were baffled until I told them how I did that.
ImageImage
http://internetometer.com/give/4279
No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

User avatar
Thesh
Made to Fuck Dinosaurs
Posts: 6579
Joined: Tue Jan 12, 2010 1:55 am UTC
Location: Colorado

Re: Prank Code

Postby Thesh » Thu Mar 24, 2011 4:38 am UTC

TheChewanater wrote:I wrote a program that makes it look like it says 2+2 is 5, and had a friend show it to the teacher. He caught on quickly, though. A few classmates were baffled until I told them how I did that.


I think you need to post the code.
Summum ius, summa iniuria.

User avatar
phlip
Restorer of Worlds
Posts: 7572
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: Prank Code

Postby phlip » Thu Mar 24, 2011 4:42 am UTC

With the (non-graphics) calculators we used in my earlier years of high school, I found that if you type in "1+(0" it will look exactly like the calculator had no input and was ready to go... all the numbers you'd enter it would behave normally, and any intermediate answers it showed would be correct, but when you hit "=" at the end, the answer would be 1 too high. It's just a one-shot thing, so if they try the same input again, it'll come out correctly.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

User avatar
b.i.o
Green is the loneliest number
Posts: 2519
Joined: Fri Jul 27, 2007 4:38 pm UTC
Location: Hong Kong

Re: Prank Code

Postby b.i.o » Thu Mar 24, 2011 7:40 am UTC

Thesh wrote:
TheChewanater wrote:I wrote a program that makes it look like it says 2+2 is 5, and had a friend show it to the teacher. He caught on quickly, though. A few classmates were baffled until I told them how I did that.


I think you need to post the code.

Sounds pretty similar to what I did...you set an input field with a blank prompt, store anything they enter as one of the graph variables (Y10 is the least noticeable), and then print out the result of evaluating that input, plus 1. And then you loop back to the top.

User avatar
TheChewanater
Posts: 1279
Joined: Sat Aug 08, 2009 5:24 am UTC
Location: lol why am I still wearing a Santa suit?

Re: Prank Code

Postby TheChewanater » Thu Mar 24, 2011 8:48 pm UTC

Thesh wrote:
TheChewanater wrote:I wrote a program that makes it look like it says 2+2 is 5, and had a friend show it to the teacher. He caught on quickly, though. A few classmates were baffled until I told them how I did that.


I think you need to post the code.

It's not too impressive. I just used Pxl-On and a lot of loops.
ImageImage
http://internetometer.com/give/4279
No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

User avatar
Thesh
Made to Fuck Dinosaurs
Posts: 6579
Joined: Tue Jan 12, 2010 1:55 am UTC
Location: Colorado

Re: Prank Code

Postby Thesh » Fri Mar 25, 2011 12:40 am UTC

OK, I was thinking you wrote a program in a language like C; I didn't realize you wrote a program on a calculator. I was envisioning something along the lines of the 1=2 math pranks.
Summum ius, summa iniuria.

User avatar
Sc4Freak
Posts: 673
Joined: Thu Jul 12, 2007 4:50 am UTC
Location: Redmond, Washington

Re: Prank Code

Postby Sc4Freak » Fri Mar 25, 2011 3:00 am UTC

Code: Select all

#include <stdio.h>

#define SIX 1 + 5
#define NINE 8 + 1

int main()
{
    printf("6x9=%d\n", SIX * NINE);
}

Outputs:

Code: Select all

6x9=42

mcvoid
Posts: 24
Joined: Tue Jan 18, 2011 1:35 pm UTC

Re: Prank Code

Postby mcvoid » Fri Mar 25, 2011 6:18 pm UTC

#define SIX 1 + 5
#define NINE 8 + 1


So 1 + ( 5 * 8 ) + 1, huh? I like the cleverness, but text substitution errors like that reawaken my PTSD from some particularly hairy debugging sessions back in the day.

edit: damn you, automatic smilies!

User avatar
adeadhead
Posts: 7
Joined: Wed Nov 24, 2010 10:42 pm UTC

Re: Prank Code

Postby adeadhead » Mon Mar 28, 2011 2:57 pm UTC

TheChewanater wrote:
Thesh wrote:
TheChewanater wrote:I wrote a program that makes it look like it says 2+2 is 5, and had a friend show it to the teacher. He caught on quickly, though. A few classmates were baffled until I told them how I did that.


I think you need to post the code.

It's not too impressive. I just used Pxl-On and a lot of loops.

Hell yes. Random (but with 4 axis symmetry) image generator on my ti83+
Spoiler:
Image
Also, just fucking google it.

User avatar
Dason
Posts: 1311
Joined: Wed Dec 02, 2009 7:06 am UTC
Location: ~/

Re: Prank Code

Postby Dason » Mon Mar 28, 2011 3:13 pm UTC

adeadhead wrote:
TheChewanater wrote:
Thesh wrote:
TheChewanater wrote:I wrote a program that makes it look like it says 2+2 is 5, and had a friend show it to the teacher. He caught on quickly, though. A few classmates were baffled until I told them how I did that.


I think you need to post the code.

It's not too impressive. I just used Pxl-On and a lot of loops.

Hell yes. Random (but with 4 axis symmetry) image generator on my ti83+

I made a couple of those. It was fun watching them progress as opposed to paying attention to high school calculus teacher.
double epsilon = -.0000001;

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Prank Code

Postby You, sir, name? » Mon Mar 28, 2011 4:11 pm UTC

I expected this thread to be about stuff like sneaking

Code: Select all

#define if(X) if(!(X))
#define printf printf("You suck!\n"); printf

into a system header.
Last edited by You, sir, name? on Mon Mar 28, 2011 7:04 pm UTC, edited 1 time in total.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
TheChewanater
Posts: 1279
Joined: Sat Aug 08, 2009 5:24 am UTC
Location: lol why am I still wearing a Santa suit?

Re: Prank Code

Postby TheChewanater » Mon Mar 28, 2011 6:41 pm UTC

Today I was bored listen to the teacher rehash last class's algebra 2 lesson because half the class was too stupid to do the homework right, so I wrote the following on one of the school calculators and left it running:

Code: Select all

While 1
Input x

If rand 
< 0.05
Then
x
+1⇾x
End

Disp x
End
ImageImage
http://internetometer.com/give/4279
No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

User avatar
sourmìlk
If I can't complain, can I at least express my fear?
Posts: 6393
Joined: Mon Dec 22, 2008 10:53 pm UTC
Location: permanently in the wrong
Contact:

Re: Prank Code

Postby sourmìlk » Mon Apr 04, 2011 4:57 am UTC

For a given value of "harmless" and "prank":

My high school would have a news announcement every morning. At the beginning and end of said announcement, a song would play. You could email the school and request a song to be played. After having done that a couple times (only for my requests to be ignored), I decided to get their attention. I created a page in PHP that would refresh every second and send an email with my song requests. After about 2500 messages (I had multiple pages running), the vice principle decided to contact me. They were much more scared than I expected: they thought it was a virus or something (I don't even understand the logic behind that assumption.) They blocked me from using the school's wireless, but I got back on somehow.
Terry Pratchett wrote:The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.

User avatar
Dason
Posts: 1311
Joined: Wed Dec 02, 2009 7:06 am UTC
Location: ~/

Re: Prank Code

Postby Dason » Mon Apr 04, 2011 4:35 pm UTC

sourmìlk wrote:For a given value of "harmless" and "prank":

My high school would have a news announcement every morning. At the beginning and end of said announcement, a song would play. You could email the school and request a song to be played. After having done that a couple times (only for my requests to be ignored), I decided to get their attention. I created a page in PHP that would refresh every second and send an email with my song requests. After about 2500 messages (I had multiple pages running), the vice principle decided to contact me. They were much more scared than I expected: they thought it was a virus or something (I don't even understand the logic behind that assumption.) They blocked me from using the school's wireless, but I got back on somehow.

And what song were you trying to request? Because I can think of quite a few songs that it would be perfectly understandable for them to ignore.
double epsilon = -.0000001;

User avatar
netcrusher88
Posts: 2166
Joined: Mon Mar 26, 2007 4:35 pm UTC
Location: Seattle

Re: Prank Code

Postby netcrusher88 » Mon Apr 04, 2011 8:37 pm UTC

There's always the ever-popular :(){:|:&};:
Sexothermic
I have only ever made one prayer to God, a very short one: "O Lord, make my enemies ridiculous." And God granted it. -Voltaire
They said we would never have a black president until Swine Flu. -Gears

User avatar
Qwert
Posts: 73
Joined: Sun Feb 10, 2008 4:09 am UTC
Location: Elsewhere

Re: Prank Code

Postby Qwert » Mon Apr 04, 2011 8:40 pm UTC

TheChewanater wrote:Today I was bored listen to the teacher rehash last class's algebra 2 lesson because half the class was too stupid to do the homework right, so I wrote the following on one of the school calculators and left it running:


I did something similar, except it was to swap between RADIANS and DEGREES only when the input started with cos(.
2 is not equal to 3, not even for large values of 2.
- Grabel's Law
Talent hits a target no one else can hit; Genius hits a target no one else can see.
- Arthur Schopenhauer

Lanzaa
Posts: 33
Joined: Fri Apr 06, 2007 6:24 am UTC

Re: Prank Code

Postby Lanzaa » Tue Apr 05, 2011 4:06 am UTC

netcrusher88 wrote:There's always the ever-popular :(){:|:&};:


For people you don't know what that is, but have access to a *nix terminal try using the man page to find out:

Code: Select all

man bomb;:(){ :|:& };:


BTW don't actually do this

User avatar
sourmìlk
If I can't complain, can I at least express my fear?
Posts: 6393
Joined: Mon Dec 22, 2008 10:53 pm UTC
Location: permanently in the wrong
Contact:

Re: Prank Code

Postby sourmìlk » Tue Apr 05, 2011 6:22 am UTC

Dason wrote:
sourmìlk wrote:For a given value of "harmless" and "prank":

My high school would have a news announcement every morning. At the beginning and end of said announcement, a song would play. You could email the school and request a song to be played. After having done that a couple times (only for my requests to be ignored), I decided to get their attention. I created a page in PHP that would refresh every second and send an email with my song requests. After about 2500 messages (I had multiple pages running), the vice principle decided to contact me. They were much more scared than I expected: they thought it was a virus or something (I don't even understand the logic behind that assumption.) They blocked me from using the school's wireless, but I got back on somehow.

And what song were you trying to request? Because I can think of quite a few songs that it would be perfectly understandable for them to ignore.


I think some stuff by Queen.
Terry Pratchett wrote:The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.

userxp
Posts: 436
Joined: Thu Jul 09, 2009 12:40 pm UTC

Re: Prank Code

Postby userxp » Tue Apr 05, 2011 6:50 pm UTC

sourmìlk wrote:They were much more scared than I expected: they thought it was a virus or something (I don't even understand the logic behind that assumption.)

For many people, "computer doing bad or strange things" == "virus".

User avatar
sourmìlk
If I can't complain, can I at least express my fear?
Posts: 6393
Joined: Mon Dec 22, 2008 10:53 pm UTC
Location: permanently in the wrong
Contact:

Re: Prank Code

Postby sourmìlk » Wed Apr 06, 2011 4:13 am UTC

userxp wrote:
sourmìlk wrote:They were much more scared than I expected: they thought it was a virus or something (I don't even understand the logic behind that assumption.)

For many people, "computer doing bad or strange things" == "virus".

Okay, but they have tech staff. And it's not their computer doing anything weird, seeing as the email doesn't even come from their computer. I don't even see how they could have jumped to that conclusion. They might as well have guessed, "yep, probably those damn rats chewing on the ethernet cables again."
Terry Pratchett wrote:The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.

User avatar
netcrusher88
Posts: 2166
Joined: Mon Mar 26, 2007 4:35 pm UTC
Location: Seattle

Re: Prank Code

Postby netcrusher88 » Wed Apr 06, 2011 6:11 pm UTC

They saw something that looked wrong and assumed malware. And, to be fair, they were right.
Sexothermic
I have only ever made one prayer to God, a very short one: "O Lord, make my enemies ridiculous." And God granted it. -Voltaire
They said we would never have a black president until Swine Flu. -Gears

Breakfast
Posts: 117
Joined: Tue Jun 16, 2009 7:34 pm UTC
Location: Coming to a table near you

Re: Prank Code

Postby Breakfast » Thu Apr 21, 2011 12:22 am UTC

Ever since I picked up C# one of the things I've liked to do is program a double click event for every object that has a single click event that contains the code: this.Close();

guyy
Posts: 610
Joined: Tue May 06, 2008 3:02 am UTC

Re: Prank Code

Postby guyy » Thu Apr 21, 2011 8:22 pm UTC

-
Last edited by guyy on Fri Apr 22, 2011 10:53 pm UTC, edited 1 time in total.

Carnildo
Posts: 2023
Joined: Fri Jul 18, 2008 8:43 am UTC

Re: Prank Code

Postby Carnildo » Fri Apr 22, 2011 6:20 am UTC

Forkbombs should be non-obvious. There's nothing impressive about writing

Code: Select all

int main(void)
{
    while(1) {fork();}
}


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 4 guests