Scoundrel Code

A Great Big Book of Everything teaches, well, everything. A Big Book of War teaches details on how to deal with, well, war. Then there is this book, or this set of rules. Usually Played for Laughs, it teaches pirates, thieves, less savory people, scoundrels in general and those that want to be more like said scoundrels how to behave for their best gain. Its suggestions and rules are usually less than ethical, when not outright illegal. Less savory anti-heroes and other protagonists will often quote it. Antagonists will quote it less often.

Depending on the society in a Planet of Hats, this kind of list can actually be a central tenet of its culture. Due to its nature, the people that follow such a code tend to be good or amoral. Evil characters may consider it as advice, but ignore it for profit. A chaotic character may lack the discipline to follow it, or may prefer to improvise. Lawful folks won't usually follow such a code unless said code is the cultural norm. The Lovable Rogue who works Just Like Robin Hood and others of the Trickster Archetype are prone to following this kind of code. It is always dangerous to count on someone following the scoundrel's code and many even instruct their followers to ignore the rules for results.

Compare Honor Among Thieves, which is an actual moral code for the criminal or unsavory. Also compare the Evil Overlord List, a meta/Genre Savvy version of this for evil overlords.

Comic Books

 * In one Spider-Man story, the mob boss Fortunado claims that "only amateurs and animals" violate an unwritten underworld code that forbids killing civilians, newsmen, and policemen. In the same story, the South American clime lord the Black Tarantula decides to intentionally violate this code to frighten the Rose, his underworld rival. However, in Fortunado's case, this is contradicted in a later story where his partnership with H.Y.D.R.A. is revealed and he demands several other lesser bosses to execute a group of kidnapped civilians to prove loyalty to him.

Live-Action TV

 * The Seventy Maxims of Maximally Effective Mercenaries, in Schlock Mercenary.
 * The Ferengi Rules of Acquisition, Star Trek.
 * Dexter has the Code of Harry.
 * Hustle often refers to 'the Grifter's Code'.

Film

 * Star Wars: Han Solo's mentor Roa has Roa's Rules: Never ignore a call from help, steal only from those richer than you, never play cards unless you're prepared to lose, don't pilot under the influence, and always be prepared to make a quick getaway.
 * Pirates of the Caribbean: The Pirates' Code (Or Pirata Codex) is one. Also patently silly, since freedom from authority is one of the main reasons for being a pirate in the first place. This is probably why they are rarely hesitant to stray from it, so long as Captain Teague isn't in the room.
 * In Casino, Ace Rothstein talks about his soon-to-be wife Ginger following "the Hustlers' Code"—basically, making sure that she pays off everyone who is in a position to help her carry out her profession as a high-class prostitute, so they have an incentive to do so.

Tabletop Games

 * The Dungeons & Dragons d20 System Reference Documents have variant rules for an "honour" system which can include this sort of moral code as guidelines for characters to follow. In said SRD are included the Thieves' Code and the Mafia's Omerta—both of which mix Honor Among Thieves and Scoundrel Code.
 * In the Ravenloft setting, evil acts can cause Ravenloft Powers Checks, and whether or not stealing is considered evil enough depends not on the value of the stolen goods, but on the impact the theft has on the victim. For instance, stealing a bag of gold from a rich merchant won't do more to him than make him angry, so it is likely below the notice of the Dark Powers. Stealing ten coppers from a poverty stricken family, however, will result in them going hungry, so a Powers Check might be warranted there.
 * GURPS offers a Pirate's Code of Honor in addition to the more standard types. It is, needless to say, less restrictive.

Video Games

 * In  Might & Magic X: Legacy, the Player Characters are Raiders, shady adventurers who are considered thieves by some, treasure seekers by others, and often themselves consider both to be the same thing. However, the first part of the ten-part Raider's Code states that Life is More Precious than Gold, and that no treasure is so valuable that you should choose it over helping a comrade. The second part says that a Raider who violates the first part is no longer a Raider, and that it becomes a true Raider's job to punish the violator with death.
 * In Guilty Gear Xrd, when Bridget receives May's One-Turn-Kill (where May and her friend April launch the victim out of their ship's cannon) she panics and tries to convince them this must violate part of said code. Clearly, however, May herself does not think so.
 * In the Mortal Kombat franchise, the Red Dragons are a criminal organization who has a code like this; Kano was once a member who was kicked out for not abiding by it, leading him to start the Black Dragons so he could be, in his eyes, a better paid scoundrel.

Real Life

 * The many variations of the Pirate's Code.