From: b Date: Sun, 20 Sep 2015 12:00:00 +0000 (+0000) Subject: Initial state as of 20.09.2015 X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=58d29541919c00734438155e1af788f0a45138fa;p=ott%2Fenhance Initial state as of 20.09.2015 --- 58d29541919c00734438155e1af788f0a45138fa diff --git a/agpl.txt b/agpl.txt new file mode 100644 index 0000000..70eec1e --- /dev/null +++ b/agpl.txt @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/bb2html.awk b/bb2html.awk new file mode 100644 index 0000000..f7faa35 --- /dev/null +++ b/bb2html.awk @@ -0,0 +1,541 @@ +#// bb2html.awk +#// converts bbcode to html. +#// 30.03.2015 +#// +#// Copyright (C) 2015 Balthasar Szczepański +#// +#// This program is free software: you can redistribute it and/or modify +#// it under the terms of the GNU Affero General Public License as +#// published by the Free Software Foundation, either version 3 of the +#// License, or (at your option) any later version. +#// +#// This program is distributed in the hope that it will be useful, +#// but WITHOUT ANY WARRANTY; without even the implied warranty of +#// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#// GNU Affero General Public License for more details. +#// +#// You should have received a copy of the GNU Affero General Public License +#// along with this program. If not, see . + +BEGIN{ + FS="=" + debug="debug=bb2html.awk:" +}; +{ + eq=index($0,"=") + argtab[substr($0,1,eq-1)]=substr($0,eq+1) +}; +END{ + if(argtab["disable_bbcode"]!="") + { + debug=debug"###nl;BBcode disabled" + print debug>>outfile + exit 0 + } + text=argtab["BB"] + html=bb2html(text) + print "HTML="html>>outfile + print debug>>outfile +}; + +function bb2html(text, depth,count,bbtree,html,tag,tagstart,taglength,elm,tagv,tagname,tagvalue,matchname) +{ + depth=0 + count[0]=1 + bbtree["0"]="" + bbtree["0.n"]=0 + bbtree["0.t"]="post" + bbtree["0.v"]=argtab["subject"] + html="" + gsub(/=/,"=",text) + debug = debug "###nl;###nl;Build BBcode tree:" + while(length(text)!=0) + { + tag=match(text, /\[\/?[a-z0-9\*]+(=(([^\[<>\"\]]*)|(\"[^\"<>]*\")))?\]/) + #"#\"" + # debug = debug "###nl;" RSTART " " RLENGTH + if (tag==0) + { + debug = debug "###nl;text: " text + bbtree[ind(count,depth)]=text + bbtree[indt(count,depth)".n"]=count[depth] + ++count[depth] + text="" + break; + } + tagstart=RSTART + taglength=RLENGTH + if(tagstart>1) + { + elm=substr(text,1,tagstart-1) + debug = debug "###nl;text: " elm + bbtree[ind(count,depth)]=elm + bbtree[indt(count,depth)".n"]=count[depth] + ++count[depth] + } + tag=substr(text,tagstart,taglength) + text=substr(text,tagstart+taglength) + debug = debug "###nl;tag: " tag + if(tag!~/^\[\//) + { + tagv=index(tag,"=") + if(tagv<2) + { + tagname=substr(tag,2,length(tag)-2) + tagvalue="" + } + else + { + tagname=substr(tag,2,tagv-2) + tagvalue=substr(tag,tagv+1,length(tag)-tagv-1) + } + if(tagname !~ /^((quote)|b|i|u|(code)|(img)|(url)|(size)|(color)|(center)|(right)|(sub)|(sup)|(s)|(spoiler)|(list)|(\*))$/) + { + debug = debug "###nl;unknown tag" + bbtree[ind(count,depth)]=tag + bbtree[indt(count,depth)".n"]=count[depth] + ++count[depth] + continue + } + if((bbtree[indt(count,depth)".t"] == "code" && tagname!="code")||bbtree[indt(count,depth)".t"] == "img"||(bbtree[indt(count,depth)".t"] == "size" && tagname=="size")) + { + debug = debug "###nl;this tag forbidden here" + bbtree[ind(count,depth)]=tag + bbtree[indt(count,depth)".n"]=count[depth] + ++count[depth] + continue + } + if(tagname=="*") + { + if(bbtree[indt(count,depth)".t"]==tagname) + { + debug = debug "###nl;implied tag: [/"tagname"]" + debug = debug "###nl;matched" + bbtree[ind(count,depth)]="[/"tagname"]" + bbtree[ind(count,depth)".k"]="e" + bbtree[ind(count,depth)".m"]=1 + bbtree[ind(count,depth)".t"]=tagname + bbtree[ind(count,depth)".v"]=bbtree[indt(count,depth)".v"] + bbtree[indt(count,depth)".n"]=count[depth] + bbtree[indt(count,depth)".m"]=1 + count[depth]="" + --depth + ++count[depth] + } + else if(bbtree[indt(count,depth)".t"]!="list") + { + debug = debug "###nl;this tag forbidden here" + bbtree[ind(count,depth)]=tag + bbtree[indt(count,depth)".n"]=count[depth] + ++count[depth] + continue + } + } + debug = debug "###nl;name: " tagname " value: " tagvalue + bbtree[ind(count,depth)]=tagname" "tagvalue + bbtree[ind(count,depth)".k"]="s" + bbtree[indt(count,depth)".n"]=count[depth] + ++depth + count[depth]=1 + bbtree[indt(count,depth)]=tag + bbtree[indt(count,depth)".n"]=0 + bbtree[indt(count,depth)".t"]=tagname + bbtree[indt(count,depth)".v"]=tagvalue + } + else + { + if(depth<=0) + { + debug = debug "###nl;""unmatched" + bbtree[ind(count,depth)]=tag + bbtree[indt(count,depth)".n"]=count[depth] + ++count[depth] + continue + } + tagname=substr(tag,3,length(tag)-3) + if(tagname=="list"&&bbtree[indt(count,depth)".t"]=="*") + { + debug = debug "###nl;implied tag: [/*]" + debug = debug "###nl;matched" + bbtree[ind(count,depth)]="[/*]" + bbtree[ind(count,depth)".k"]="e" + bbtree[ind(count,depth)".m"]=1 + bbtree[ind(count,depth)".t"]="*" + bbtree[ind(count,depth)".v"]=bbtree[indt(count,depth)".v"] + bbtree[indt(count,depth)".n"]=count[depth] + bbtree[indt(count,depth)".m"]=1 + count[depth]="" + --depth + ++count[depth] + } + debug = debug "###nl;name: " tagname + matchname=bbtree[indt(count,depth)".t"] + if((bbtree[indt(count,depth)".t"] == "code" && tagname!="code")||(bbtree[indt(count,depth)".t"] == "img" && tagname != "img")) + { + debug = debug "###nl;this tag forbidden here" + bbtree[ind(count,depth)]=tag + bbtree[indt(count,depth)".n"]=count[depth] + ++count[depth] + continue + } + if(tagname!=matchname) + { + debug = debug "###nl;mismatched: " matchname + # bbtree[ind(count,depth)]=tag + # bbtree[indt(count,depth)".n"]=count[depth] + # ++count[depth] + # continue + bbtree[ind(count,depth)]=tag + bbtree[ind(count,depth)".k"]="e" + bbtree[ind(count,depth)".t"]=bbtree[indt(count,depth)".t"] + bbtree[ind(count,depth)".v"]=bbtree[indt(count,depth)".v"] + bbtree[indt(count,depth)".n"]=count[depth] + count[depth]="" + --depth + ++count[depth] + continue + } + debug = debug "###nl;matched" + bbtree[ind(count,depth)]=tag + bbtree[ind(count,depth)".k"]="e" + bbtree[ind(count,depth)".m"]=1 + bbtree[ind(count,depth)".t"]=tagname + bbtree[ind(count,depth)".v"]=bbtree[indt(count,depth)".v"] + bbtree[indt(count,depth)".n"]=count[depth] + bbtree[indt(count,depth)".m"]=1 + count[depth]="" + --depth + ++count[depth] + } + } + if(depth>0) + debug = debug "###nl;unclosed tags: " depth + + debug = debug "###nl;###nl;""generate HTML:" + depth=0 + count[0]=0 + while(count[0]<=bbtree["0.n"]&&depth>=0) + { + if(count[depth]==0) + { + tag=bbtree[indt(count,depth)] + tagname=bbtree[indt(count,depth)".t"] + tagvalue=bbtree[indt(count,depth)".v"] + debug = debug "###nl;name: "tagname" value: "tagvalue" elements: "bbtree[indt(count,depth)".n"] + if(tagname == "post") + { + } + else if(bbtree[indt(count,depth)".m"]=="") + { + debug = debug "###nl;unmatched" + html = html tag + } + else if(tagname == "quote") + { + if (tagvalue=="") + { + html = html "
" + } + else + { + if(tagvalue !~ /^\".*\"$/) + #"#\"" + tagvalue="You forgot about the quote marks, "tagvalue + else + tagvalue=bb2html(substr(tagvalue,2,length(tagvalue)-2)) + html = html "
"tagvalue" wrote:
" + } + } + else if (tagname == "b") + { + html = html"" + if(tagvalue!="") + html=html"This tag shouldn't have any value. " + } + else if (tagname == "i") + { + html = html"" + if(tagvalue!="") + html=html"This tag shouldn't have any value. " + } + else if (tagname == "u") + { + html = html"" + if(tagvalue!="") + html=html"This tag shouldn't have any value. " + } + else if (tagname == "code") + { + if(bbtree[indtu(count,depth)".t"] == "code") + { + html=html tag + debug = debug "###nl;not a tag, actually" + } + else + { + html=html"
Code: Select all
" + if(tagvalue!="") + html=html"This tag shouldn't have any value. " + } + } + else if (tagname == "img") + html=html"" + } + else if (tagname == "size") + { + if (tagvalue==""||(tagvalue !~ /^[0-9]+$/)||(tagvalue+0)>200) + html=html" This tag should have a correct value. " + else + html=html"" + } + else if (tagname == "color") + { + if (tagvalue==""||tagvalue !~ /^#[0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F]$/) #for some reason /^([0-9A-F]{6})$/ doesn't work. + html=html" This tag should have a correct value. " + else + html=html"" + } + else if (tagname ~ /^((center)|(right))$/) + { + html=html"
" + if(tagvalue!="") + html=html"This tag shouldn't have any value. " + } + else if (tagname =="s") + { + html=html"" + if(tagvalue!="") + html=html"This tag shouldn't have any value. " + } + else if (tagname =="sub") + { + html=html"" + if(tagvalue!="") + html=html"This tag shouldn't have any value. " + } + else if (tagname =="sup") + { + html=html"" + if(tagvalue!="") + html=html"This tag shouldn't have any value. " + } + else if (tagname=="spoiler") + { + html=html"
Spoiler:
" + if(tagvalue!="") + html=html"This tag shouldn't have any value. " + } + else if (tagname=="list") + { + if(tagvalue=="") + html=html"
    " + else + { + if (tagvalue=="1") + tagvalue="decimal" + else if (tagvalue=="i") + tagvalue="lower-roman" + else if (tagvalue=="I") + tagvalue="upper-roman" + else if (tagvalue=="a") + tagvalue="lower-alpha" + else if (tagvalue=="A") + tagvalue="upper-alpha" + else + { + html=html"This tag should have a correct value. " + tagvalue="decimal" + } + html=html"
      " + } + } + else if (tagname=="*") + { + html=html"
    1. " + if(tagvalue!="") + html=html"This tag shouldn't have any value. " + } + else + { + debug = debug "###nl;unknown tag" + html = html tag + } + ++count[depth] + } + else if(bbtree[ind(count,depth)".k"]=="s") + { + debug = debug "###nl;entering tag:" + ++depth + count[depth]=0 + } + else if(bbtree[ind(count,depth)".k"]=="e") + { + debug = debug "###nl;leaving tag:" + tag=bbtree[ind(count,depth)] + tagname=bbtree[ind(count,depth)".t"] + tagvalue=bbtree[ind(count,depth)".v"] + debug = debug "###nl;name: "tagname" value: "tagvalue + if (tagname == "post") + { + } + else if(bbtree[ind(count,depth)".m"]=="") + { + debug = debug "###nl;unmatched" + html = html tag + } + else if(tagname == "quote") + html = html "
" + else if (tagname ~/^(b|i|u|(size)|(color))$/) + html = html"" + else if (tagname == "code") + { + if(bbtree[indtu(count,depth)".t"] == "code") + { + html=html tag + debug = debug "###nl;not a tag, actually" + } + else + html = html"" + } + else if (tagname == "img") + { + html = html"\" alt=\"Image\" />" + if(tagvalue!="") + html=html"This tag shouldn't have any value. " + } + else if(tagname=="url") + html=html"" + else if (tagname ~ /^((center)|(right))$/) + html=html"
" + else if (tagname =="s") + html=html"" + else if (tagname =="sub") + html=html"" + else if (tagname =="sup") + html=html"" + else if (tagname=="spoiler") + html=html"" + else if (tagname=="list") + { + if (tagvalue=="") + html=html"" + else + html=html"" + } + else if (tagname=="*") + html=html"" + else + { + debug = debug "###nl;unknown tag" + html = html tag + } + count[depth]="" + --depth + ++count[depth] + } + else if(count[depth]>bbtree[indt(count,depth)".n"]) + { + debug = debug "###nl;run out of elements in this tag; leaving" + count[depth]="" + --depth + ++count[depth] + } + else + { + tag=bbtree[ind(count,depth)] + debug = debug "###nl;text: "tag + if(bbtree[indt(count,depth)".t"] == "code") + { + # gsub(/ ?
?/,"
",tag) + gsub(/ /,"\\ ",tag) + gsub(/\t/,"\\ \\ ",tag) + } + if(argtab["disable_magic_url"]==""&& bbtree[indt(count,depth)".t"] !~ /^((code)|(img)|(url))$/) + gsub(/https?:\/\/[^\n\r\t<> ]+/,"&",tag) + if(argtab["disable_smilies"]=="" && bbtree[indt(count,depth)".t"] !~ /^((code)|(img))$/) + { + gsub(/(^|[\n\r\t ]):D($|[\n\r\t ])/," \":D\" ",tag) + gsub(/(^|[\n\r\t ]):\)($|[\n\r\t ])/," \":)\" ",tag) + gsub(/(^|[\n\r\t ]):\(($|[\n\r\t ])/," \":(\" ",tag) + gsub(/(^|[\n\r\t ]):o($|[\n\r\t ])/," \":o\" ",tag) + gsub(/(^|[\n\r\t ]):shock:($|[\n\r\t ])/," \":shock:\" ",tag) + gsub(/(^|[\n\r\t ]):\?($|[\n\r\t ])/," \":?\" ",tag) + gsub(/(^|[\n\r\t ])8-\)($|[\n\r\t ])/," \"8-)\" ",tag) + gsub(/(^|[\n\r\t ]):lol:($|[\n\r\t ])/," \":lol:\" ",tag) + gsub(/(^|[\n\r\t ]):x($|[\n\r\t ])/," \":x\" ",tag) + gsub(/(^|[\n\r\t ]):P($|[\n\r\t ])/," \":P\" ",tag) + gsub(/(^|[\n\r\t ]):oops:($|[\n\r\t ])/," \":oops:\" ",tag) + gsub(/(^|[\n\r\t ]):cry:($|[\n\r\t ])/," \":cry:\" ",tag) + gsub(/(^|[\n\r\t ]):evil:($|[\n\r\t ])/," \":evil:\" ",tag) + gsub(/(^|[\n\r\t ]):twisted:($|[\n\r\t ])/," \":twisted:\" ",tag) + gsub(/(^|[\n\r\t ]):roll:($|[\n\r\t ])/," \":roll:\" ",tag) + gsub(/(^|[\n\r\t ]):wink:($|[\n\r\t ])/," \":wink:\" ",tag) + gsub(/(^|[\n\r\t ]);\)($|[\n\r\t ])/," \":wink:\" ",tag) + gsub(/(^|[\n\r\t ]):!:($|[\n\r\t ])/," \":!:\" ",tag) + gsub(/(^|[\n\r\t ]):\?:($|[\n\r\t ])/," \":?:\" ",tag) + gsub(/(^|[\n\r\t ]):idea:($|[\n\r\t ])/," \":idea:\" ",tag) + gsub(/(^|[\n\r\t ]):arrow:($|[\n\r\t ])/," \":arrow:\" ",tag) + gsub(/(^|[\n\r\t ]):\|($|[\n\r\t ])/," \":|\" ",tag) + gsub(/(^|[\n\r\t ]):mrgreen:($|[\n\r\t ])/," \":mrgreen:\" ",tag) + } + + html = html tag + ++count[depth] + } + } + debug = debug "###nl;done" + return html +} + +function ind(count,depth, ii,iindex) +{ + iindex = "" + for(ii=0;ii<=depth;++ii) + { + if(ii!=0) + iindex = iindex "." + iindex = iindex count[ii] + } + # debug = debug "###nl;" iindex + return iindex +} +function indt(count,depth, ii,iindex) +{ + iindex = "" + for(ii=0;ii0) + iindex=iindex"." + iindex = iindex "0" + # debug = debug "###nl;" iindex + return iindex +} +function indtu(count,depth, ii,iindex) +{ + iindex = "" + for(ii=0;ii0) + iindex=iindex"." + iindex = iindex "0" + # debug = debug "###nl;" iindex + return iindex +} \ No newline at end of file diff --git a/bot4.c b/bot4.c new file mode 100644 index 0000000..a8cc27c --- /dev/null +++ b/bot4.c @@ -0,0 +1,699 @@ +// bot4.c +// The bot to post frames to the OTT +// 08.04.2015 +// +// Copyright (C) 2015 Balthasar Szczepański +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include +#include +#include +#include +#include +#include + +#define OK 0 +#define POST_MSTD 256 +#define INDELIVERABLE 512 +#define NOPOSTS 3 +#define STOP_MSTD 4 +#define NAME_MSTD 5 +#define DOWN_MSTD 6 +#define PREP_MSTD 7 +#define LAST_MSTD 8 +#define ONGD_MSTD 9 + +#define LINE_LIMIT 16000 + +#define USERAGENT "bothasar_p (http://1190.bicyclesonthemoon.info/ongoing.htm; BFTF post bot)" + +#define OTT_ADDRESS "http://forums.xkcd.com/viewtopic.php?f=7&t=101043&start=" +#define TTO_ADDRESS "http://1190.bicyclesonthemoon.info/ott/view?start=" +#define MSTD_ADDRESS "http://1190.bicyclesonthemoon.info/ott/mview?start=" +#define LASTPOST_ADDRESS "http://forums.xkcd.com/viewtopic.php?f=7&t=101043&sd=d" + +#define LAST_PATH "/eizm/mem/ong1/lasttime" +#define LOG_PATH "/eizm/log/ong1/bot4.log" +#define STOP_PATH "/eizm/tmp/ong1/bot4stop" +#define NAME_PATH "/eizm/mem/ong1/name" +#define REDUNDANT_NAME_PATH "/eizm/mem/ottmirror/name" +#define TEMPFILE_PATH "/eizm/tmp/ong1/bot3temp" +#define TEMPFILE2_PATH "/eizm/tmp/ong1/bot3temp2" +#define POSTDATA_PATH "/eizm/tmp/ong1/bot3post" +#define COOKIE_PATH "/eizm/tmp/ong1/bot3cook" +#define ONG_STATE_PATH "/eizm/data/aftertime/bftf/ongstate" +#define FORCEMEME_PATH "/eizm/mem/ong1/forcememe" +#define MEME_PATH "/eizm/mem/ong1/mome.txt" + +#define WGET_PATH "/usr/bin/wget" +#define MAWK_PATH "/usr/bin/mawk" +#define RM_PATH "/bin/rm" +#define PERL_PATH "/usr/bin/perl" +#define AWK_LATEST "/eizm/pro/ong1/findlatest.awk" +#define AWK_RELATED "/eizm/pro/ong1/related.awk" +#define AWK_POST "/eizm/pro/ong1/post.awk" +#define AWK_MPOST "/eizm/pro/ong1/mpost.awk" +#define AWK_MOME "/eizm/pro/ong1/mome.awk" +#define PERL_MOME "/eizm/pro/ong1/mome.pl" +#define AWK_LASTPOST "/eizm/pro/ong1/lastpost.awk" + +int main(int argc,char *argv[]); +int longline(const char *in,const char *out, unsigned long limit); +void end(int m); + +unsigned char logopen=0; +FILE *file; +FILE *stopfile; +pid_t sub; +int r; + +int main(int argc,char *argv[]) +{ + time_t t; + + int yarg; + unsigned char text=0; + unsigned char otherbot=0; + unsigned char force=0; + unsigned char newlog=0; + unsigned char nopost=0; + unsigned char mpost=0; + unsigned long start=0x06666666; // this is a coincidence. It's the largest number that won't overflow the 32bit integer. + unsigned long last=0xffffffff; + unsigned long page; + unsigned long posts; + + unsigned short frame=65523; + unsigned short lastframe=0; + unsigned char ongstate=0; + unsigned char pope=0; + unsigned char selectong=0; + unsigned char edit; + + char name [256]; + char mome[1024]; + char pass [256]; + char bot [256]; + char argp1[256]; + char argp2[256]; + char argp3[256]; + char argp4[256]; + char argp5[256]; + char URL [256]; + + time(&t); + srand(getpid()); + opterr=0; + + while((yarg = getopt(argc,argv,"tnfpmro:")) != -1) + { + switch(yarg) + { + case 't': + text=1; + break; + case 'n': + newlog=1; + break; + case 'f': + force=1; + break; + case 'p': + nopost=1; + break; + case 'm': + mpost=1; + break; + case 'r': + otherbot=1; + break; + case 'o': + selectong=1; + sscanf(optarg,"%hu",&frame); + ongstate=2; + break; + default: + + break; + } + } + + if(!text) + { + if(freopen(LOG_PATH,newlog?"wt":"at",stdout)!=NULL) + logopen=1; + } + setvbuf(stdout, NULL, _IONBF, 0); + dup2(fileno(stdout),fileno(stderr)); + printf("\n%s",ctime(&t)); + + stopfile=fopen(STOP_PATH,"wt"); + if (stopfile==NULL) + end(STOP_MSTD); + if (lockf(fileno(stopfile),F_TLOCK,0)!=0) + end(STOP_MSTD); + fprintf(stopfile,"%hu.FULL STOPFULL STOP\n",0); + + if((file=fopen(LAST_PATH,"rt"))!=NULL) + { + fscanf(file,"%lu %hu",&start,&lastframe); + fclose(file); + } + printf("start with page %lu, last frame was %hu",start,lastframe); + + if(!selectong) + { + file=fopen(ONG_STATE_PATH,"rt"); + if(file!=NULL) + { + fscanf(file,"%hhu %hu",&ongstate,&frame); + fclose(file); + } + else + end(LAST_MSTD); + } + + printf(", current frame is %hu",frame); + + file=fopen(otherbot?REDUNDANT_NAME_PATH:NAME_PATH,"rt"); + if(file==NULL) + end(NAME_MSTD); + if(fgets(argp1,255,file)!=NULL) + sscanf(argp1,"%s",name); + else + end(NAME_MSTD); + if(fgets(argp1,255,file)!=NULL) + sscanf(argp1,"%s",pass); + else + end(NAME_MSTD); + if(fgets(argp1,255,file)!=NULL) + sscanf(argp1,"%s",bot); + else + sprintf(bot,"%s","bothasar_p"); + fclose(file); + printf("\n%s",bot); + + if(force==0) + { + if(ongstate!=2) + end(INDELIVERABLE); + if(frame<=lastframe) + end(ONGD_MSTD); + for(page=start;page<=last;++page) + { + if(page!=start) + sleep(3); + printf("\n%lu",page); + sprintf(URL,"%s%lu",OTT_ADDRESS,(page-1)*40); + + // download the newpage + printf(" download"); + sub=fork(); + if(!sub) + { + r=execl(WGET_PATH,WGET_PATH, "-q","-t", "3","--connect-timeout=60","-U", USERAGENT, "-O", TEMPFILE_PATH,URL, (char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + { + sprintf(URL,"%s%lu",TTO_ADDRESS,(page-1)*40); + printf(" redundant %s",URL); + sub=fork(); + if(!sub) + { + r=execl(WGET_PATH,WGET_PATH, "-q","-t", "3","-U", USERAGENT, "-O", TEMPFILE_PATH,URL, (char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + { + printf(" %d ",r); + end(DOWN_MSTD); + } + } + printf(" OK, prepare"); + r=longline(TEMPFILE_PATH,TEMPFILE2_PATH,LINE_LIMIT); + if(r) + end(PREP_MSTD); + printf("."); + + // what's the last page and how many posts are there? + sprintf(argp1,"outfile=%s",TEMPFILE_PATH); + sub=fork(); + if(!sub) + { + r=execl(MAWK_PATH,MAWK_PATH,"-f",AWK_LATEST,"-v",argp1,TEMPFILE2_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + end(LAST_MSTD); + printf("."); + + if((file=fopen(TEMPFILE_PATH,"rt"))!=NULL) + { + fscanf(file,"%lu %lu",&last,&posts); + if(posts%40==0) + pope=1; + else + pope=0; + fclose(file); + } + else + end(LAST_MSTD); + if(page>last) + page=last; + printf(".OK match"); + + sprintf(argp1,"frame=%hu",frame); + sub=fork(); + if(!sub) + { + r=execl(MAWK_PATH,MAWK_PATH,"-f",AWK_RELATED,"-v",argp1,TEMPFILE2_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + { + if((file=fopen(LAST_PATH,"wt"))!=NULL) + { + fprintf(file,"%lu %hu",last,frame); + fclose(file); + } + else + end(STOP_MSTD); + end(ONGD_MSTD); + } + else + { + if((file=fopen(LAST_PATH,"wt"))!=NULL) + { + fprintf(file,"%lu %hu",page,frame); + fclose(file); + } + else + end(STOP_MSTD); + } + printf(" nothing found."); + } + + for(page=1,last=0xffffffff;page<=last;++page) + { + if(page!=start) + sleep(3); + printf("\nm%lu",page); + sprintf(URL,"%s%lu",MSTD_ADDRESS,(page-1)*40); + + // download the newpage + printf(" download"); + sub=fork(); + if(!sub) + { + r=execl(WGET_PATH,WGET_PATH, "-q","-t", "3","--connect-timeout=60","-U", USERAGENT, "-O", TEMPFILE_PATH,URL, (char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + { + printf(" not here."); + break; + } + printf(" OK, prepare"); + r=longline(TEMPFILE_PATH,TEMPFILE2_PATH,LINE_LIMIT); + if(r) + break; + printf("."); + + // what's the last page and how many posts are there? + sprintf(argp1,"outfile=%s",TEMPFILE_PATH); + sub=fork(); + if(!sub) + { + r=execl(MAWK_PATH,MAWK_PATH,"-f",AWK_LATEST,"-v",argp1,TEMPFILE2_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + break; + printf("."); + + if((file=fopen(TEMPFILE_PATH,"rt"))!=NULL) + { + fscanf(file,"%lu %lu",&last,&posts); + if(posts%40==0) + pope=1; + else + pope=0; + fclose(file); + } + else + break; + if(page>last) + page=last; + printf(".OK match"); + + sprintf(argp1,"frame=%hu",frame); + sub=fork(); + if(!sub) + { + r=execl(MAWK_PATH,MAWK_PATH,"-f",AWK_RELATED,"-v",argp1,TEMPFILE2_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + end(ONGD_MSTD); + printf(" nothing found."); + } + } + + printf("\nGet meme."); + + file=fopen(FORCEMEME_PATH,"rt"); + if(file==NULL) + { + sub=fork(); + if(!sub) + { + freopen(TEMPFILE_PATH,"wt",stdout); + r=execl(PERL_PATH,PERL_PATH,PERL_MOME,"-lc","150","-n","67","-d",MEME_PATH,"-t",pope?"[decrall]":"",(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r==0) + { + sprintf(argp1,"outfile=%s",TEMPFILE2_PATH); + sub=fork(); + if(!sub) + { + r=execl(MAWK_PATH,MAWK_PATH,"-f",AWK_MOME,"-v",argp1,TEMPFILE_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r==0) + { + file=fopen(TEMPFILE2_PATH,"rt"); + if(file!=NULL) + { + fscanf(file,"%s",mome); + fclose(file); + } + else + sprintf(mome,"%s","Ong."); + } + else + sprintf(mome,"%s","Ong."); + } + else + sprintf(mome,"%s","Ong."); + } + else + { + fscanf(file,"%s",mome); + fclose(file); + sub=fork(); + if(!sub) + { + r=execl(RM_PATH,RM_PATH,"-f",FORCEMEME_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + sprintf(mome,"%s","Ong."); + } + + printf(" %s OK.\ncreate post file",mome); + + file=fopen(POSTDATA_PATH,"wt"); + if(file != NULL) + { + fprintf(file,"username=%s\n",name); + fprintf(file,"password=%s\n",pass); + fprintf(file,"subject=bftf-%04hu\n",frame); + fprintf(file,"addbbcode20=%s\n","100"); + fprintf(file,"message=%s%s%hu%s%04hu%s%s%s%s%s", + mome, + "%0A%5Burl%3Dhttp%3A%2F%2F1190.bicyclesonthemoon.info%2Fongoing.htm%3Ff%3D", + frame, + ((rand()&0x7)?"%5D%5Bimg%5Dhttp%3A%2F%2F1190.bicyclesonthemoon.info%2Fongoing%2Fbftf-":"%5D%5Bimg%5Dhttp%3A%2F%2F1190.bicyclesonthemoon.info%2Fongoing%2Fnpbftf-"), + frame, + (frame>=564)? + ".png%5B%2Fimg%5D%5B%2Furl%5D%5Bspoiler%5DI%27d%20highly%20recommend%20following%20the%20first%20commandment%20...again.%5B%2Fspoiler%5D": + ".png%5B%2Fimg%5D%5B%2Furl%5D%5Bspoiler%5D...%5B%2Fspoiler%5D", + pope?"":"", + "%5Bsize%3D85%5D%5Bright%5D--%20posted%20by%20", + bot, + "%5B%2Fright%5D%5B%2Fsize%5D" + ); + fclose(file); + } + else + end(POST_MSTD); + printf(" OK\nsend post"); + + do + {//test latest post + edit=0; + sub=fork(); + if(sub==0) + { + r=execl(WGET_PATH,WGET_PATH, "-q","-t", "3","-U", USERAGENT, "-O", TEMPFILE_PATH,LASTPOST_ADDRESS, (char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + break; + + sub=fork(); + if(sub==0) + { + if(freopen(TEMPFILE2_PATH,"wt",stdout)==NULL) + exit(255); + r=execl(MAWK_PATH,MAWK_PATH, "-f",AWK_LASTPOST, TEMPFILE_PATH, (char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + break; + + file=fopen(TEMPFILE2_PATH,"rt"); + if(file==NULL) + break; + + if(fgets(argp1,255,file)!=NULL) + { + sscanf(argp1,"%s",argp2); + sprintf(argp4,"edit=%s",argp2); + } + else + { + fclose(file); + break; + } + if(fgets(argp1,255,file)!=NULL) + { + sscanf(argp1,"%s",argp2); + sprintf(argp5,"user=%s",argp2); + } + else + { + fclose(file); + break; + } + fclose(file); + edit=1; + }while(0); + + sprintf(argp1 ,"postfile=%s",TEMPFILE2_PATH); + sprintf(argp2,"cookiefile=%s",COOKIE_PATH); + sprintf(argp3,"tempfile=%s",TEMPFILE_PATH); + //sprintf(argp4,"name=%s",name); + //sprintf(argp5,"pass=%s",pass); + + if(!nopost) + { + if(mpost) + r=mpost; + else + { + sub=fork(); + if(!sub) + { + if(edit) + r=execl(MAWK_PATH,MAWK_PATH,"-f",AWK_POST,"-v",argp1,"-v",argp2,"-v",argp3,"-v",argp4,"-v",argp5,POSTDATA_PATH,(char *)0); + else + r=execl(MAWK_PATH,MAWK_PATH,"-f",AWK_POST,"-v",argp1,"-v",argp2,"-v",argp3,POSTDATA_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + } + if(r) + { + sub=fork(); + if(!sub) + { + r=execl(MAWK_PATH,MAWK_PATH,"-f",AWK_MPOST,"-v",argp1,"-v",argp2,"-v",argp3,POSTDATA_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + end(r); + } + } + printf(" OK"); + end(OK); + return 0; +} + +int longline(const char *in,const char *out, unsigned long limit) +{ + FILE *infile; + FILE *outfile; + unsigned char tag; + unsigned long counter=0; + char ch; + + outfile=fopen(out,"wt"); + if(outfile==NULL) + return 1; + infile=fopen(in,"rt"); + if(infile==NULL) + { + fclose(outfile); + return 1; + } + + while(!feof(infile)) + { + ch=(char)(fgetc(infile)); + fputc(ch,outfile); + ++counter; + switch(ch) + { + case '<': + tag=1; + break; + case '>': + tag=0; + if(counter>=limit) + { + fputc('\n',outfile); + counter=0; + } + break; + case ' ': + if((!tag) && (counter>= limit)) + if(counter>=limit) + { + fputc('\n',outfile); + counter=0; + } + break; + case '\r': + case '\n': + counter=0; + break; + default: + break; + } + + } + return 0; +} + + +void end(int m) +{ + switch(m) + { + case INDELIVERABLE: + printf("\nCan't ONG this yet.\n"); + break; + case NAME_MSTD: + printf("\nName and password fail.\n"); + break; + case DOWN_MSTD: + printf("\nDownload fail.\n"); + break; + case PREP_MSTD: + printf("\nNewpage prepare fail.\n"); + break; + case LAST_MSTD: + printf("\nRemember last time fail.\n"); + break; + case ONGD_MSTD: + printf("\nAlready ONGed\n"); + break; + case POST_MSTD: + printf("\nPost fail.\n"); + break; + case STOP_MSTD: + printf("\nFULL STOPFULL STOP\n"); + break; + + + case OK: + printf("\nONGED\n"); + break; + default: + printf("\nCh*rping m*stard!\n"); + } + if(logopen) + fclose(stdout); + if(m != STOP_MSTD) + { + sub=fork(); + if(!sub) + { + r=execl(RM_PATH,RM_PATH,"-f",COOKIE_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + sub=fork(); + if(!sub) + { + r=execl(RM_PATH,RM_PATH,"-f",POSTDATA_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + sub=fork(); + if(!sub) + { + r=execl(RM_PATH,RM_PATH,"-f",TEMPFILE_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + sub=fork(); + if(!sub) + { + r=execl(RM_PATH,RM_PATH,"-f",TEMPFILE2_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + + lockf(fileno(stopfile),F_ULOCK,0); + fclose(stopfile); + + sub=fork(); + if(!sub) + { + r=execl(RM_PATH,RM_PATH,"-f",STOP_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + + } + exit(m); +} diff --git a/click.c b/click.c new file mode 100644 index 0000000..3a8a273 --- /dev/null +++ b/click.c @@ -0,0 +1,164 @@ +// click.c (1190.bicyclesonthemoon.info/click) +// The button that could activate BFTF +// 06.04.2015 +// +// Copyright (C) 2015 Balthasar Szczepański +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#define ONG_STATE_PATH "/eizm/data/aftertime/bftf/ongstate" +#define LOG_PATH "/eizm/log/ong1/click.log" +#define TIMEFRAME 4 +#define INDEX_PATH "/eizm/www/time/index.htm" +#define NEWINDEX_PATH "/eizm/www/time/ongdex.htm" +#define CP_PATH "/bin/cp" + + +#include +#include +#include +#include +#include +#include +#include + +s_cgi *cgi; +pid_t sub; +int r; + +void writeHTML(FILE *file,const char *text); +int main (int argc, char *argv[]); + +void writeHTML(FILE *file,const char *text) +{ + unsigned short length, i, v; + for(i=0, length=strlen(text);i': + case ' ': + case '\r': + case '=': + fprintf(file,"&#%hu;",v); + break; + default: + fputc(v,file); + } + } +} + +int main (int argc, char *argv[]) +{ + FILE *file; + char *value; + unsigned short ongFrame; + unsigned char ongState, safeword; + time_t now; + struct tm *nowS; + unsigned char h,m,s; + unsigned long d; + + cgi=cgiInit(); + + now=time(NULL); + nowS=localtime(&now); + d=TIMEFRAME*3600-(nowS->tm_sec+60*nowS->tm_min+3600*(nowS->tm_hour%TIMEFRAME)); + s=(unsigned char)(d%60); + m=(unsigned char)((d/60)%60); + h=(unsigned char)(d/3600); + + value=cgiGetValue(cgi,"n"); + safeword=((value!=NULL)?((strcmp(value,"NI")==0)?1:0):0); + + if(safeword) + { + file=fopen(ONG_STATE_PATH,"rt"); + if(file!=NULL) + { + fscanf(file,"%hhu %hu",&ongState,&ongFrame); + fclose(file); + if(ongState==0) + { + file=fopen(ONG_STATE_PATH,"wt"); + if(file!=NULL) + { + fprintf(file,"1 0"); + fclose(file); + } + sub=fork(); + if(!sub) + { + r=execl(CP_PATH,CP_PATH, "-f", NEWINDEX_PATH, INDEX_PATH, (char *)0); + exit(r); + } + waitpid(sub,&r,0); + } + if(ongFrame>0) + cgiRedirect("/ongoing.htm"); + } + + } + + file=fopen(LOG_PATH,"at"); + if(file!=NULL) + { + fprintf(file,"%s\n",(value!=NULL)?value:""); + fclose(file); + } + + fputs("Content-type: text/html\n\n",stdout); + + fputs("\n",stdout); + fputs("\n",stdout); + fputs("N = ",stdout); + writeHTML(stdout,safeword?"2":((value!=NULL)?value:"???")); + fputs("• Bicycles on the Moon\n",stdout); + fputs("\n",stdout); + fputs("\n",stdout); + fputs("
\n",stdout); + fputs("\"1190.bicyclesonthemoon.info\"
\n",stdout); + fputs("

N = ",stdout); + writeHTML(stdout,safeword?"2":((value!=NULL)?value:"???")); + fputs("

\n",stdout); + if(safeword) + { + fputs("
\n",stdout); + fputs("\"the
\n",stdout); + fputs("
\n",stdout); + printf("%2hhu:%02hhu:%02hhu\n",h,m,s); + fputs("
",stdout); + fputs("You started something.
\n",stdout); + fputs("You made a change that can't be reversed.
\n",stdout); + fputs("Soon, you will notice a change.
\n",stdout); + fputs("And then another one.
\n",stdout); + fputs("And another one.
\n",stdout); + fputs("
\n",stdout); + fputs("Wait for it.
\n",stdout); + fputs("
\n",stdout); + } + else + { + fputs("\"xkcd722\3\"
\n",stdout); + } + fputs("1190.bicyclesonthemoon.info\n",stdout); + fputs("
\n",stdout); + + return 0; +} \ No newline at end of file diff --git a/deliver.c b/deliver.c new file mode 100644 index 0000000..0794e8d --- /dev/null +++ b/deliver.c @@ -0,0 +1,180 @@ +// deliver.c +// The ct-if bot +// 08.09.2014 +// +// Copyright (C) 2015 Balthasar Szczepański +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include +#include +#include +#include +#include + +#define TEMP_PATH "/eizm/tmp/ong1/deliver." +#define LOG_PATH "/eizm/log/ong1/deliver.log" +#define POST_PATH "/eizm/mem/ong1/mpost/" +#define WAIT_PATH "/eizm/mem/ong1/mpost/wait/" +#define LS_PATH "/bin/ls" +#define MV_PATH "/bin/mv" +#define RM_PATH "/bin/rm" + +pid_t sub; +int r; + +int main(int argc, char **argv) +{ + time_t t; + struct tm *nowS; + int yarg; + unsigned char text=0; + unsigned char newlog=0; + FILE *list; + FILE *post; + char temppath[256]; + unsigned char logopen=0; + unsigned char i; + char line[32]; + char value[32]; + char inpath[256]; + char outpath[256]; + unsigned char d; + unsigned char m; + unsigned short y; + + t=time(NULL); + sprintf(temppath,"%s%lu",TEMP_PATH,(unsigned long)getpid()); + + while((yarg = getopt(argc,argv,"tn")) != -1) + { + switch(yarg) + { + case 't': + text=1; + break; + case 'n': + newlog=1; + break; + default: + + break; + } + } + if(!text) + { + if(freopen(LOG_PATH,newlog?"wt":"at",stdout)!=NULL) + logopen=1; + } + setvbuf(stdout, NULL, _IONBF, 0); + dup2(fileno(stdout),fileno(stderr)); + printf("\n%s",ctime(&t)); + + sub=fork(); + if(sub==0) + { + if(freopen(temppath,"wt",stdout)==NULL) + exit(255); + r=execl(LS_PATH,LS_PATH,"-1","--color=never",WAIT_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + printf("ls fail.\n"); + else + { + list=fopen(temppath,"rt"); + if(list==NULL) + printf("list fail.\n"); + else + { + for(i=0; fgets(line,31,list)!=NULL; ++i) + { + sscanf(line,"%s",value); + printf("%s",value); + sprintf(inpath,"%s%s",WAIT_PATH,value); + post=fopen(inpath,"rt"); + if(post==NULL) + { + printf(" fail.;"); + continue; + } + for(d=0xff,m=0xff,y=0xffff;fgets(line,31,post)!=NULL;) + { + if(line[0]=='d'&&line[1]=='=') + sscanf(line+2,"%hhu",&d); + else if(line[0]=='m'&&line[1]=='=') + sscanf(line+2,"%hhu",&m); + else if(line[0]=='y'&&line[1]=='=') + sscanf(line+2,"%hu",&y); + } + fclose(post); + printf(" %hhu.%hhu.%hu",d,m,y); + nowS=localtime(&t); + + if(y>1900+nowS->tm_year) + { + printf(" wait\n"); + continue; + } + else if(y==1900+nowS->tm_year) + { + if(m>1+nowS->tm_mon) + { + printf(" wait\n"); + continue; + } + else if(m==1+nowS->tm_mon) + { + if(d>nowS->tm_mday) + { + printf(" wait\n"); + continue; + } + } + } + + printf(" deliver"); + sprintf(outpath,"%s%s",POST_PATH,value); + + sub=fork(); + if(sub==0) + { + r=execl(MV_PATH,MV_PATH,inpath,outpath,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + printf(" mv fail.\n"); + else + printf(" ok\n"); + } + if(i==0) + printf("Nothing.\n"); + fclose(list); + sub=fork(); + if(sub==0) + { + r=execl(RM_PATH,RM_PATH,"-f",temppath,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + printf("rm fail.\n"); + } + } + if(logopen) + fclose(stdout); + return 0; +} diff --git a/findlatest.awk b/findlatest.awk new file mode 100644 index 0000000..5701c47 --- /dev/null +++ b/findlatest.awk @@ -0,0 +1,49 @@ +#// findlatest.awk +#// find the latest page and number of posts. +#// 14.08.2014 +#// +#// Copyright (C) 2014 Balthasar Szczepański +#// +#// This program is free software: you can redistribute it and/or modify +#// it under the terms of the GNU Affero General Public License as +#// published by the Free Software Foundation, either version 3 of the +#// License, or (at your option) any later version. +#// +#// This program is distributed in the hope that it will be useful, +#// but WITHOUT ANY WARRANTY; without even the implied warranty of +#// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#// GNU Affero General Public License for more details. +#// +#// You should have received a copy of the GNU Affero General Public License +#// along with this program. If not, see . + + +BEGIN { + a=1; +}; +{ + if (posts== "") + { + for(i=1;i<=NF;i++) + { + if(tolower($i) ~ /posts/) + posts=$(i-1) + } + } + else if (tolower($0) ~ /page/) + { + gsub(/<[^>]*>/," ",$0) + for(i=1;i<=NF;i++) + { + if((tolower($i) ~ /page/) && (tolower($(i+2)) ~ /of/)) + { + print $(i+3) " " posts >outfile + a=0; + exit a; + } + } + } +}; +END { + exit a +} diff --git a/force.c b/force.c new file mode 100644 index 0000000..5f6a077 --- /dev/null +++ b/force.c @@ -0,0 +1,47 @@ +// force.c (1190.bicyclesonthemoon.info/ct-if-f) +// Force the ct-if bot +// 11.11.2014 +// +// Copyright (C) 2014 Balthasar Szczepański +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#define BOT_PATH "/eizm/pro/ong1/deliver" + +#include +#include +#include +#include +#include + +int main (int argc, char *argv[]) +{ + s_cgi *cgi; + pid_t sub; + int r; + + cgi=cgiInit(); + printf("Content-type: text\n\n"); + + fflush(stdout); + sub=fork(); + if(sub==0) + { + r=execl(BOT_PATH,BOT_PATH,"-t","-r",(char *)0); + exit(r); + } + waitpid(sub,&r,0); + + return 0; +} \ No newline at end of file diff --git a/generator.c b/generator.c new file mode 100644 index 0000000..db950ac --- /dev/null +++ b/generator.c @@ -0,0 +1,163 @@ +// generator.c (1190.bicyclesonthemoon.info/og-if-2) +// The object generator online interface +// 20.09.2015 +// +// Copyright (C) 2015 Balthasar Szczepański +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#define LOG_PATH "/eizm/log/ong1/generator.log" +#define FILE_PATH "/eizm/mem/ong1/generator/" +#define LOGIN0 "kxa" +#define PASSWORD0 "CFRTdsn'tapproV" +#define LOGIN1 "b" +#define LOGIN2 "fth" +#define MV_PATH "/bin/mv" +#define MAWK_PATH "/usr/bin/mawk" +#define AWK_OGDF "/eizm/pro/ong1/ogdfparse.awk" + +#include +#include +#include +#include +#include +#include +#include + + +void response(char *text); +int main(int argc,char **argv); + +time_t posttime; +s_cgi *cgi; +int t; +pid_t sub; + +// void response(char *text) +// { + // printf("%s%s%s%s%s%s%s%s%s%s%s%s%s", + // "Content-type: text/html\n\n", + // "\n", + // "\n", + // "Object Generator online • Bicycles on the Moon\n", + // "\n", + // "\n", + // "\n", + // "\n", + // "\"1190.bicyclesonthemoon.info\"\n", + // "

Object generator online

\n", + // text, + // "
Object generator interface

\n", + // "1190.bicyclesonthemoon.info\n" + // ); + // exit(0); +// } + +int main(int argc, char **argv) +{ + char *login; + char *password; + char *n; + char **up; + char *filename; + char filepath[256]; + char argp1[256]; + char argp2[256]; + char argp3[256]; + FILE *logfile; + + posttime=time(NULL); + cgi=cgiInit(); + + setvbuf(stdout, NULL, _IONBF, 0); + dup2(fileno(stdout),fileno(stderr)); + + login=cgiGetValue(cgi,"login"); + password=cgiGetValue(cgi,"password"); + n=cgiGetValue(cgi,"n"); + + up=cgiGetFiles(cgi); + if (up) + { + filename=cgiGetFile(cgi,up[0])->filename; + sprintf(filepath,"%s%llu_%s",FILE_PATH,(unsigned long long)posttime,filename); + sub=fork(); + if(sub==0) + { + t=execl(MV_PATH,MV_PATH,cgiGetFile(cgi,up[0])->tmpfile,filepath,(char *)0); + exit(t); + } + waitpid(sub,&t,0); + } + else + sprintf(filepath,"%s","---"); + + // if(login==NULL || password==NULL || n==NULL || !up) + // cgiRedirect("/generator.htm"); + + logfile=fopen(LOG_PATH,"at"); + if(logfile!=NULL) + { + fprintf(logfile,"l=%s p=%s n=%s f=%s\n",(login!=NULL)?login:"---",(password!=NULL)?password:"---",(n!=NULL)?n:"---",filepath); + fclose(logfile); + } + // else + // response(LOG_PATH); + printf("%s%s%s%s%s%s%s%s%s%s", + "Content-type: text/html\n\n", + "\n", + "\n", + "Object Generator online • Bicycles on the Moon\n", + "\n", + "\n", + "\n", + "\n", + "\"1190.bicyclesonthemoon.info\"\n", + "

Object generator online

\n" + ); + if(login==NULL) + printf("No login.\n"); + else if(password==NULL) + printf("No password.\n"); + else if(strcmp(login,LOGIN0)==0 && strcmp(password,PASSWORD0)==0) + { + if(!up) + printf("No definition file.\n"); + else if(n==NULL) + printf("Quantity unspecified.\n"); + else + { + sprintf(argp1,"ogdf_name=%s",filename); + sprintf(argp2,"q=%s",n); + sprintf(argp3,"logf=%s",LOG_PATH); + + sub=fork(); + if(sub==0) + { + t=execl(MAWK_PATH,MAWK_PATH,"-f",AWK_OGDF,"-v",argp1,"-v",argp2,"-v",argp3,filepath,(char *)0); + exit(t); + } + waitpid(sub,&t,0); + } + } + else if((strcmp(login,LOGIN0)==0 || strcmp(login,LOGIN1)==0 || strcmp(login,LOGIN2)==0)) + printf("Password incorrect.\n"); + else + printf("Login incorrect.\n"); + printf("%s%s", + "

Object generator interface

\n", + "1190.bicyclesonthemoon.info\n" + ); + return 0; +} \ No newline at end of file diff --git a/lastpost.awk b/lastpost.awk new file mode 100644 index 0000000..9b93751 --- /dev/null +++ b/lastpost.awk @@ -0,0 +1,46 @@ +#// lastpost.awk +#// what was the last post? +#// 20.03.2015 +#// +#// Copyright (C) 2015 Balthasar Szczepański +#// +#// This program is free software: you can redistribute it and/or modify +#// it under the terms of the GNU Affero General Public License as +#// published by the Free Software Foundation, either version 3 of the +#// License, or (at your option) any later version. +#// +#// This program is distributed in the hope that it will be useful, +#// but WITHOUT ANY WARRANTY; without even the implied warranty of +#// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#// GNU Affero General Public License for more details. +#// +#// You should have received a copy of the GNU Affero General Public License +#// along with this program. If not, see . + +BEGIN{ + FS="" +} +{ + if ((i=match($0, /id=\"p[0-9]+\"/))!=0) #" + { + temp=substr($0, i+5) + postid=substr(temp, 1, index(temp,"\"")-1) + } + + if ($0 ~ /class=\"postprofile\"/) #" + postprofile = "1" + + else if (postprofile=="") + next + + if($0 ~ /memberlist\.php.*mode=viewprofile[^<>]*>[^<>]+<\/a/) + { + temp=substr($0, index($0, ">")+1) + username=substr(temp, 1, index(temp,"<")-1) + exit + } +} +END{ + print postid + print username +} \ No newline at end of file diff --git a/makefile b/makefile new file mode 100644 index 0000000..9f4ff62 --- /dev/null +++ b/makefile @@ -0,0 +1,68 @@ +CC=gcc +CC2=g++ +CF=-g -Wall +LF=-lIL +LF2=-lcgi + +all: bot4 deliver remove view mpview viewpage relink ong pleaseong update spoiler click generator post posted force enable npb npbd + +npb: npb.cpp makefile + $(CC2) $(CF) $(LF) -o npb npb.cpp + +npbd: npbd.cpp makefile + $(CC2) $(CF) -o npbd npbd.cpp $(LF2) + +bot4: bot4.c findlatest.awk related.awk post.awk mpost.awk mome.pl mome.awk makefile + $(CC) $(CF) -o bot4 bot4.c + +deliver: deliver.c + $(CC) $(CF) -o deliver deliver.c + +remove: remove.c + $(CC) $(CF) -o remove remove.c $(LF2) + +pleaseong: pleaseong.c + $(CC) $(CF) -o pleaseong pleaseong.c $(LF2) + +view: view.c makefile + $(CC) $(CF) -o view view.c $(LF2) + +mpview: mpview.c mview.awk view.awk makefile + $(CC) $(CF) -o mpview mpview.c $(LF2) + +viewpage: viewpage.c makefile + $(CC) $(CF) -o viewpage viewpage.c $(LF2) + +relink: relink.c makefile + $(CC) $(CF) -o relink relink.c $(LF2) + +ong: ong.c makefile + $(CC) $(CF) -o ong ong.c + +update: update.c makefile + $(CC) $(CF) -o update update.c + +spoiler: spoiler.c makefile + $(CC) $(CF) -o spoiler spoiler.c $(LF2) + +click: click.c makefile + $(CC) $(CF) -o click click.c $(LF2) + +generator: generator.c ogdfparse.awk makefile + $(CC) $(CF) -o generator generator.c $(LF2) + +posted: posted.c posted.awk makefile + $(CC) $(CF) -o posted posted.c $(LF2) + +post: post.cpp preview.awk bb2html.awk makefile + $(CC2) $(CF) -o post post.cpp $(LF2) + +ongtext: ongtext.c ongtext.awk makefile + $(CC) $(CF) -o ongtext ongtext.c $(LF2) + +force: force.c + $(CC) $(CF) -o force force.c $(LF2) + + +enable: relink view click generator posted post remove ongtext pleaseong force + chmod u+s relink view click generator posted post remove ongtext pleaseong force diff --git a/mem/mome.txt b/mem/mome.txt new file mode 100644 index 0000000..2e18542 --- /dev/null +++ b/mem/mome.txt @@ -0,0 +1,3367 @@ +#THE MEME TEMPLATE FILE. I'S A COPY OF MROB'S FILE WITH SOME MODIFICATIONS. +#(almost)NONE OF THESE COMMENTS BELOW ARE MINE +#http://mrob.com/time/automome +# OTTified memes for #automeme# +# +# LICENSE +# +# This memes file, and the software to process it (which is at +# http://mrob.com/time/automome/automeme-pl.txt ) are made available under +# a Creative Commons Attribution-NonCommercial 4.0 International License. +# License details are at http://mrob.com/cc-license.html +# +# EXAMPLES +# +# To get lots of What-If memes, use: +# +# automeme -v -n 143 | \ +# egrep '(COULD|HOW..*WOULD|IF.EVERY|IF..*[CW]OULD|WHAT.IF)' +# +# REVISION HISTORY +# 20140406 First version by mrob27 +# 20140407: +# add 'CASSINI-MADAGASCAR' to noun-place +# add classes verb-intr-perfect and verb-tr-perfect. They are mostly +# the same as verb-xx-past, except for irregular verbs. The only +# difference right now is "HIDE FROM CORINNE" vs. "HIDDEN FROM CORINNE" +# add verb-tr-perfect to "THIS IS [@PHOTOSHOPPED@0.67, adjective..." +# template. In my mind, transitive perfect-tense verbs metch the +# snowclone a little bit better than adjectives. The original AUTOMEME +# has ('~photoshopped', 'adj') but I added 'verb3 there as well. +# 20140408: +# change 'SHIT' to 'M**STARD' in the 'SHIT WAS SO CASH' meme +# add AMTOO, BEANETTE and ROSETTA; add another of CUEBALL, MEGAN, +# CUEGAN and MEGBALL because those characters are more 'popular' +# 20140408, continued +# add THE BEACH to [noun-place] +# add MYSTERYONG to all 3 noun types +# add ONG (5 tenses) to verb-tr-xxx (for usage examples, see +# [OTT:381:11|#p3334595], [OTT:475:17|#p3343415], and [OTT:1282:16|#p3423689] +# add CUPCAKE (a big deal with @Valarya) to the [noun]s +# 20140409: +# The JavaScript now has a function scan_cvt() with 5 arguments that +# performs mappings like '_foo_' -> 'foo'. scan_cvt is used 4 times: +# s = scan_cvt(s, '**', '*', '*'); +# s = scan_cvt(s, '*', '', ''); +# s = scan_cvt(s, '$', '', ''); +# s = scan_cvt(s, '*', '*', '*'); +# The effect of the first and last part is to make ** be the way to +# represent a literal '*'. The middle two calls turn '*' into the +# style and '$' into small-caps. Thus CH**RP becomes CH*RP and *CHIRP* +# becomes CHIRP. +# Add $ER$OTT$IC$ to [adjective] +# Add the ability to filter and transform (using regular expressions) +# members of a class to define another class. +# +# 20140410: +# Add char-1word, containing 1-word characters, and use it in the BLESS +# and THANK templates. +# Break [noun-singular] up into two categories [noun-unique] and +# [noun-commodity], then define [noun-singular] as the union of those +# two, and define [noun-article] using only the members of [noun-commodity] +# Add VOLDEFRAME and WHISTLE OF TEMPORAL HARMONY to noun-unique +# +# 20140411: +# BLESS... and THANK YOU... memes once again include multi-word things. +# Re-do te nouns again; there is now a list of nouns with articles and +# [noun-commodity] is derived from it. This allows us to handle initial +# consonants properly ("AN HONOR") and foreign scripts ("A ᓭᘖᔭᓄᐨ" or +# "AN ᓭᘖᔭᓄᐨ") should we ever want to. +# There may now be two random literals at the beginning of a replaceable, +# enabling the following modifications: +# I ACCIDENTALLY ... IS THIS [BAD@0.33, DANGEROUS@0.5, ENDISH]? +# I LIKE MY [MEN@0.25, WOMEN@0.33, noun-plural, noun-mass] ... +# (and maybe a few others (I forgot to keep track)) +# Add this variation on the Dos Equis meme: +# I DON'T ALWAYS [verb-tr-inf] [noun-plural, noun-mass], BUT WHEN I DO, +# I [PREFER@0.2, verb-tr-inf] [noun-plural, noun-mass] +# Add snowclone templates: +# THE [noun-singular] IS TOO CH**RPING [HIGH@0.3, adjective] +# KEEP CALM AND [MOLPY@0.2, verb-inf-1word] ON +# REMAIN [CALM@0.2, adjective] AND [verb-inf-1word] [noun-mass, noun-plural] +# (Previously I had these slightly worse versions of those two: +# KEEP [CALM@0.2, adjective] AND [MOLPY@0.2, verb-tr-inf, verb-intr-inf] ON +# KEEP [CALM@0.2, adjective] AND [verb-tr-inf, verb-intr-inf] [noun-mass, noun-plural] +# ) +# [verb-tr-cont, verb-intr-cont] [$0/ING/ERS/] GONNA [$0/ING//] +# (e.g. "CH*RPING CH*IRPERS GONNA CH*RP") +# (needs an operator that links the verb tenses by table lookup.) +# A WILD [noun-singular] [APPEARED@0.5, APPEARS]! +# +# Add category [nounz] and use in the "IS IT CAN BE... TIEM NAO PLEES?" +# Vocabulary additions: +# adjectives: ZANCLEAN, (AWEFULSOME, but we already have AWESOMEFUL), +# MUSTARDY, CH*RPING, BEANISH, OTCOLORED +# characters: BEARDO (early name for Rosetta), EXPANDO, OLDPIXBOT +# place names: "THE AFOREWHEN", "THE AFTERWHEN", "THE FUTURE" +# commodity noun with irregular plural: A NEWPIX / NEWPICES +# normal nouns: A PASTPOST, A MANIP, A FIRSTPOST, A BLINDPOST, A XIP, +# A WIP, A WIPEND, A MOLPYSNAKE, A WOWTREE, A FLUTTERBEE, +# AN OTTIFICATION, A RAPTORCAT, A CUEGANITE, A PUNSAW, A SILENTONG +# intransitive verbs: COMA +# transitive verbs: SPOILER +# +# 20140412: +# Use non-greedy patterns in the BLESS and THANKS memes +# Vocabulary additions: +# verb: POST/POSTED/POSTING/POSTS +# character: MS. FRIZZLE, GOATEE +# noun-unique: (THE) JAVASCRIPT, (THE) ZANCLEAN FLOOD +# noun-comm-art: A RAPTOR, A RIBBIT, AN EQUIMOLPY, A SPARROW-RAPTOR, +# A CHUPAMOLPY, A QUACKMOLPY, A FACEBUG, A MOOLPY, A RHINOCEROLPY, +# A PASTPAGE (there are a lot more molpy species on NP1543) +# +# 20140414: +# Add the cut operator, an empty replaceable '[]', which is a +# signal to delete everything up to that point. This is used in the +# DIAL X FOR Xxxx template, where the full word Xxxx needs to be +# generated first. +# Add several memes from @Link +# +# 20140415: +# Many additions that I did not bother to document. +# place: CHRONOCORP +# 20140418: +# noun-plural: HOTDOGS ("A HOTDOG" was already in noun-comm-art) +# 20140421: +# Add Doge meme (WOW - SO [noun] - etc.) +# 20140425: +# character: AZULE +# verb-transitive: to WAIT FOR +# Add a bunch of templates tagged 'azule' and originating in OtherComics +# 20140427: +# Break commodity (non-unique) nouns into positive and negative +# categories (used in XKCD #51 meme). +# +# 20140511: +# Add noun Q04B +# Add snowclone: "PLEASE READ: A PERSONAL APPEAL ..." +# 20140512: +# Add noun-unique QUESTIONABLE CARCASS +# Add CITATION NEEDED meme +# 20140518: +# Add a few more XKCD-based memes from @azule. +# Add [adjective-article] and derive [adjective] from it. Add [adverb]. +# Add more vocabulary from Link's versions 2.1 and earlier (e.g. +# PINKLYMOLP and CUEGANZZLE, to GO CAVE) and memes from his v. 2.0 +# +# 20140522: +# Change MOOLPY to MOOPY +# 20140523: +# Add a lot of origin notes. +# Add BAOBABBY +# +# 20140612: +# Add origin of "THANK YOU [character], BUT OUR... +# +# 20140621 Add verb to AZULE +# 20140622: +# Add VITSSÅGAR (plural of VITSSÅGEN) +# 20140624: +# adjectives SANDISH, CAVEISH +# 20140625: +# noun-plural OVARIES (see OTT:1997:28#p3611339) and verb AZULING +# (see OTT:1998:24#p3611715) +# Add sexual double-entendre meme +# +# 20140709: +# Add AN OVARY +# 20140711: +# Add 408 and 503 memes +# +# 20140724: +# Add MOROBU. +# Begin scanning through all edits of @Link's version +# (automome.penguindevelopment.org) to bring mine up to date. I +# had fallen behind since his version 2.0, which added the MultiWord +# class. Today I start by adding my own multiclass syntax, and use +# it to define the verbs. +# +# 20140725: +# add a bunch of origin comments; multiclass the nouns (still in +# animal and mineral categories); rename "noun-place" to simply +# "place"; add several memes from @Link; improve alphabetization of +# the templates. +# +# 20140726: +# add the rest of Link's memes, so this file now has all from his +# version 2.4 +# Add meme: NOW IS THE TIME... +# 20140727: +# add meme "EVERY TIME YOU [verb-inf], ..." +# 20140728: +# add two versions of the "Billy Madison" meme, and "you can't have +# your X and Y it too". +# Lengthen the "this is your brain on drugs" template. +# Add PELRIGG, ETERNAL DENSITY and BLITZGIRL +# Add [character] to the ONLY TWO THINGS COME FROM template +# Lengthen the Ramirez meme by adding [character] +# 20140729: +# Add ERGMAN, YAPPO, TAIXZO +# 20140730: +# Improvements from Link's v. 2.5: +# Add A HERETICAL and HERETICALLY; character SIR VINNIE LONGDONG; +# verb SACRIFICING; nouns COLPIX, LOOPIST, OTHERCOMIC, and VIRGIN; +# minor corrections (e.g. use [verb-tr-present] instead of +# [verb-present] in "think of the kittens"); Add "Hast seen the +# white whale", "I'm sorry, Dave...", "Maybe X is a metaphor for..." +# Make [place] a multiclass to define appropriate prepositions for +# each (used in the two templates marked '**' below) +# Add meme templates: +# "he wasn't the most X Y in the Z" ** +# "don't hate me because I'm adjective" +# "molpies gone wild" +# "there is no crying in [place]" ** +# Isaiah 48:22 ("there is no peace for the wicked") +# "got milk?" +# "I'm going to X like I've never X'd before" (two forms) +# Add the paradoxical "noun-unique-article" class so that I can +# add the "Yes Virginia, there is a..." template. +# 20140731: +# Break adjectives up into positive and negative +# Add recent change from azule to xkcd #194, and add xkcd #1025 template +# (there are still a lot of xkcd-based templates from azule that I could add later) +# Add TREBUCHAT to noun-mass-negative (see OTT:2050:16#p3632176) +# 20140801: +# Add THE CASTRAFTLE to [place] +# 20140802: +# Add characters THE 1ST CLERIC, THE 2ND SCRIBE, UCIM, and noun BLITZROCKET +# Add corrections and improvements made evident by Link's recent version 3.0: +# Merge 404/408/503 into one template +# Change some literal probabilities +# Add [verb-cont][noun] form of "I don't want to be right" template +# Use intransitive verb in Billy Madison template +# Use perfect tense in "...like I've never [verbed] before" +# in Arthur Baer meme use appropriate "out of" preposition according to place, e.g. "AWAY FROM THE BEACH" rather than "OUT OF THE BEACH" +# Add initial "THIS" to "this is the cancer that..." and "... why we can't have nice things" +# Add noun-mass-the and verb-cont-1word +# Add -pr-out column to multiclass [place], used in the Arthur Baer meme +# Add templates: +# "it's super effective!" +# "I am Ozymandius... look on my works" (two forms) +# Add class [adjective=most] +# Add a few more xkcd templates from azule +# Add "best part of waking up..." meme +# 20140803: +# Small tweak to Boys' Life meme +# 20140804: +# Add named regexes for the class-building operations. +# Add place THE PAST +# 20140805: +# Use named regexes in all of the templates. +# Add changes from Link's 3.2: +# Add multiclass adjec (only used in a couple of places, until we get +# multiclass unions so we can retain the positive/negative distinction) +# Improve grammar of some templates +# Add memes "So long ... all the fish"; "friends don't let friends..." ; +# "one ring to rule..."; "nuke it from orbit..."; "demons run..." +# Add regex /s-ending-invert/ to support new meme "He's the hero Gotham..." +# Add place THE MOONBASE +# 20140807: +# Add memes "You live by the sword..."; "the buck stops here" +# 20140808: +# Add DUNEJUMPISHLY, break adverbs up into positive ane negative +# Add a few Japanese memes (@@Link and @@azule, please ignore ^_^ ) +# Add "A few X short of a Y"; "give me your poor, your tired..."; "math +# is hard, let's go shopping"; "my X Y-eth over"; "X is the Y of Z" and +# its "then why are we..." variant +# 20140809: +# Change spelling of :AZULE: isomorphs +# Expand "consider the lilies..." and "I'm a doctor, not..." +# Add several more memes: "have X will travel"; "I'm going to X ... and +# by X I mean..."; "... but I played one on TV"; "in X nobody can hear..."; +# "save an X, shoot a Y"; "shit happens"; "take this X and shove it"; +# "we don't need no stinking X"; "X is so last week" +# +# 20140830: +# Add some Azule memes, and change some others to add ideas from @azule (some of which might have also come from @Link) +# 20140902: +# Add some memes from Link's version 3.2 +# 20140903: +# Add changes from Link's 3.3 +# 20140904: Add a bunch of memes based on chapter titles in the What-If book. +# 20140905: Bug-fixes and clean up new regexes. Add more What-If titles. +# 20140907: +# Add -art field to the verbs, use it for t-verb-actor-article and a couple memes +# Add Azule's dawgify and dawgchar +# Add Eternal Density's random name generator +# 20140908: +# Add multiclass noun-interval +# Add vocabulary from Eternal Density's list at OTT:2094:23#p3648331 +# Add vocabulary from Azule; add some more xkcd memes from azule. +# Add ЯOЯЯIM TTO ИA. +# 20140910: +# Add some more vocabulary from balthasar_s +# Use a new fancy regex remove-the: /(^THE )|( ƎHT$)|($)//i +# Add several more What-If titles +# 20140912: Add OTHERRIVERWADINGISH, GOOMHR; tweak a couple of the azule memes +@ 20140914: Hyphenate modifier in HOW X IS IT.. IN A Y-STORM +# 20140917: "ЯОЯЯІМ ТТО" (all Cyrillic) looks better than "ЯOЯЯIM TTO" +# 20140919: +# Add lots fo changes from azule: vocabulary including several animals, ASPCA meme +# 20141127: Add Roko's Basilisk meme (alt-text of xkcd 1450) +# 20150102: Add Sustainabilizer meme ("If we have asked you for some data...") +# 20150108: Add SILENTBOT +# 20150109: +# Changes from Link's version 3.4: +# Add THE GLR (in addition to, not replacing, plain "GLR") +# Add interjection BAOBABS +# Add nouns CHRONOTRANSPONDER, LIZARD, RIDONDAKITI, RONG, TRANSLATEOUNG +# Add class [char-noart] +# Add [adjec-noun] to most replaceables that already had [noun-mass] +# 7 new memes from @Link: +# Vega Strike "Hulls pop like vibrant seeds..." +# Mario "It's-a-me, Luigi" +# Firefly "Man walks down the street..." +# Firefly "My food is problematic" +# "¡This NOUN is VERBing me!" +# Doctor Who "No, not the mind probe!" +# Legend of Zelda Tingle "... These are the magic words..." +# 20150110: Add more bits of edtitle template +# 20150112: Add NUMBERWONGGH meme; add a few animals like TRILOMEG +# 20150113: Add PENGOAT and other goat-like vocab; there is now an adjective-neutral category. Fix Colossal Caves "maze" meme to handle placenams that have a hyphen. + 20150115: Add "Stick it in your..." and "99 problems" memes +# 20150119: Add a little "utility templates" section with (for now) only the [sentence-imperative] template. +# 20150123: Add [decree] template definitions by #balthasar_s#. Add several movie name templates. +# 20150131: Add CASTRAFTLE in several places. +# 20150213: Add "I went to see the fight..." +# 20150215: Add *AUFGEMOLPEN* +# 20150224: Add BALTHACARIUS and JAVASCRIPT +# Named regex transformations for class lists and classlike templates. + +# The 'add-foo' regexes simply add something to the beginning +regex add-that: /^/THAT / +regex add-the: /^/THE / +regex add-most: /^/MOST / + +# /has-no-spaces/ matches a string only if it contains no spaces, +# and if used in a grep context, leaves the string unchanged. +regex has-no-spaces: /^([^ ]+)$/$1/ + +# oneword-est only matches things that end in EST and contain no punctuation +# or spaces. +regex oneword-est: /^({A-Z}+EST)$/$1/ + +# /remove-article/ only matches things that start with an article 'A ' +# or 'AN ', and removes the article. +regex remove-article: /^ *AN? +//i + +# Match anything, and if it starts with "THE ", remove the THE. It is of +# critical importance that the clauses of this OR-grouping are ordered +# with the ^-forms first and the $-forms after. +regex remove-the: /(^THE )|( ƎНТ$)|($)//i + +class adjective-positive-article: +AN AWEFULSOME +AN AWESOMEFUL +A BAOBABISH +A BEANISH +A BUFFYHATTED +A DUNEISH +A DUNEJUMPISH +AN $ER$OTT$IC$ +A FLUTTERBEEWINGISH +A MOUNTAINISH +A MOLPISH +A NEAT +AN OTCOLORED +AN OTTERRIFIC +AN OTTISH +A PRICKLY +A RAPTORISH +A $RELATED$ +A SANDISH +A SEAISH +A STEAKISH +A TOQUISH +A TREEISH +A WINGISH +A WINGGHISH +A WOWTERFALLISH +A WOWTERFUL +A ZANCLEAN +A SILENTTIMERISH +A SUSTAINABILIZED +A KEYBOARD-SMASHING + +class adjective-neutral-article: +A PENGOATIMATE +A RECENT + +class adjective-negative-article: +A CAVEISH +A CH**RPING +AN ENDISH +AN EPSILONISH +A HERETICAL +A HILLISH +A MUSTARDY +AN OTHERRIVERWADINGISH +A RAPTORCATTISH +A REDUNDANT +A RIVERISH +A STEAMBOTTLISH +A WEIRD +A YAPPOCISED + +class adjective-article: +[adjective-positive-article] +[adjective-neutral-article] +[adjective-negative-article] + +class adjective-positive: +[adjective-positive-article] ms/remove-article/ + +class adjective-negative: +[adjective-negative-article] ms/remove-article/ + +class adjective: +[adjective-article] ms/remove-article/ + +# Some of the -noun forms are deliberately humorous. See Jargon File, e.g. "ferrous => ferrosity" +multiclass adjec [-desc-art, -comp-art, -super, -noun]: +AN AWEFULSOME | AN AWEFULSOMER | AWEFULSOMEST | AWEFULSOMENESS +AN AWESOMEFUL | AN AWESOMEFULLER | AWESOMEFULLEST | AWESOMEFULNESS +A BAOBABISH | A BAOBABISHER | BAOBABISHEST | BAOBABISHNESS +A BEANISH | A BEANISHER | BEANISHEST | BEANISHNESS +A BUFFYHATTED | A MORE BUFFYHATTED | MOST BUFFYHATTED | BUFFYHABERDASHERY +A CAVEISH | A CAVEISHER | CAVEISHEST | CAVEISHNESS +A CH*RPING | A MORE CH*RPING | MOST CH*RPING | CH*RPITUDE +A DUNEISH | A DUNEISHER | DUNEISHEST | DUNEISHNESS +A DUNEJUMPISH | A DUNEJUMPISHER | DUNEJUMPISHEST | DUNEJUMPTION +AN ENDISH | AN ENDISHER | ENDISHEST | ENDISHNESS +AN EPSILONISH | AN EPSILONISHER | EPSILONISHEST | EPSILONITY +A FLUTTERBEEWINGISH | A FLUTTERBEEWINGISHER | FLUTTERBEEWINGISHEST | FLUTTERBEEWINGISHNESSITUDE +A HATTED | A MORE HATTED | MOST HATTED | HABERDASHERY +A HERETICAL | A MORE HERETICAL | MOST HERETICAL | HERESY +A HILLISH | A HILLISHER | HILLISHEST | HILLISHNESS +A MOUNTAINISH | A MORE MOUNTAINISH | MOST MOUNTAINISH | MOUNTAINOSITY +A MOLPISH | A MOLPIER | MOLPIEST | MOLPISHNESS +A MUSTARDY | A MUSTARDIER | MUSTARDIEST | MUSTARDINESS +AN OTCOLORED | A MORE OTCOLORED | MOST OTCOLORED | OTCOLORISATION +A PENGOATIMATE | A MORE PENGOATIMATE | MOST PENGOATIMATE | PENGOATITUDE +A RAPTORISH | A MORE RAPTORISH | MOST RAPTORISH | RAPTORISHNESS +A RAPTORCATTISH | A RAPTORCATTISHER | RAPTORCATTISHEST | RAPTORFELINITY +A RECENT | A MORE RECENT | A RECENTMOST | RECENTNESS +A REDUNDANT | A MORE REDUNDANT | MOST REDUNDANT | REDUNDANCY +A RELATED | A MORE RELATED | MOST RELATED | RELATEDNESS +A RIVERISH | A MORE RIVERISH | MOST RIVERISH | RIVERISHNESS +A SANDISH | A SANDISHER | SANDISHEST | SANDISHNESS +A SEAISH | A MORE SEAISH | MOST SEAISH | SEAISHNESS +A STEAKISH | A STEAKISHER | STEAKISHEST | STEAKISHNESS +A STEAMBOTTLISH | A MORE STEAMBOTTLISH | MOST STEAMBOTTLISH | STEAMBOTTLISHNESS +A TEMPORAL | A MORE TEMPORAL | MOST TEMPORAL | TEMPORALITY +A TREEISH | A TREEISHER | TREEISHEST | TREEISHNESS +AN UNGLISH | AN UNGLISHER | MOST UNGLISH | UNGLISHNESS +A WEIRD | A WEIRDER | WEIRDEST | WEIRDNESS +A WINGISH | A WINGISHER | WINGISHEST | WINGISHNESS +A WOWTERFALLISH | A MORE WOWTERFALLISH | MOST WOWTERFALLISH | WOWTERFALLISHNESS +A WOWTERFUL | A MORE WOWTERFUL | MOST WOWTERFUL | WOWTERFULNESS +A YAPPOCISED | A MORE YAPPOCISED | MOST YAPPOCISED | YAPPOCISION +A ZANCLEAN | A MORE ZANCLEAN | MOST ZANCLEAN | ZANCLEANLINESS +A SUSTAINABLE | A MORE SUSTAINABLE | MOST SUSTAINABLE | SUSTAINABILITY + +class adjec-est: +[adjec-super] ms/oneword-est/ + +class adjec-comp: +[adjec-comp-art] ms/remove-article/ + +class adverb-positive: +AWEFULSOMELY +AWESOMEFULLY +BAOBABISHLY +BEANISHLY +DUNEJUMPISHLY +$ER$OTT$ICALLY$ +FLUTTERBEEWINGISHLY +MOLPISHLY +OTCOLOREDLY +RAPTORISHLY +RELATEDLY +SEAISHLY +TREEISHLY +WINGISHLY +WOWTERFULLY +ZANCLEANLY + +class adverb-negative: +CAVEISHLY +CH**RPINGLY +ENDISHLY +EPSILONISHLY +HERETICALLY +MUSTARDILY +RAPTORCATTISHLY +REDUNDANTLY +RIVERISHLY +STEAMBOTTLISHLY +WEIRDLY +YAPPOCISEDLY + +class adverb: +[adverb-positive] +[adverb-negative] + +class character_no_s: +# OTC characters +AFRO +AMTOO +BALDO +BEANETTE +BEARDO +BIGGEST BANGS BROTHER +BLACK BUN +BOB +BRAVEBEAN +BRICK +BROKENBEAN +BUNNY +BUZZ +CUEBALL + CUEBALL +CUEGAN + CUEGAN +CUEGANZZLE +CURLY +CURLY BUN +EXPANDO +FORELOCK +GOATEE +GLR +GRAY BUN +HAT-HAIR +HEADBAND +HES +LAPETITE +LITTLEST BANGS BROTHER +LOOPSY +LOPSIDE +LUCKY +MEG-A-LIKE +MEGAN + MEGAN +MEGBALL + MEGBALL +MIDDLE BANGS BROTHER +MINI-BUNNY +MINI-SHORTDO +MINI-TWO-TONE +MS. FRIZZLE +NEWEST BANGS BROTHER +PART +PONY +PULLED BACK +ROSE +ROSETTA + ROSETTA +ROUNDHAIR +SANDY +SHE-BANGS +SHORTDO +SHORTY +SPARSE +SPIKE +THE FORTY +THE GLR +THE TIMEGHOST +TWO-TONE +WHITE BUNNY +ZOMBEANIE +# +# OTTers and their fictional creations +THE 1ST CLERIC +THE 2ND SCRIBE +AUTOMOME +AZULE +BALTHACARIUS +BLITZGIRL +CZULE +ETERNAL DENSITY +ERGMAN +FFOXY +GEORGE THE MALEVOLENT GALLSTONE +HES +IMAGEBOT +LMJB1964 +LMJBOT +MOROBU +MROB27 +MRORL +NEWPIXBOT +OLDPIXBOT +PELRIGG +RANDOMPIXBOT +SILENTBOT +SIR VINNIE LONGDONG +STORMANGEL +TAIXZO +THE FIRST CLERIC +THE MOPEY MOLPY MOME +THE PINKLYMOLP +THE SECOND SCRIBE +TIMBORME +UCIM +YAPPO +BOTHASAR__S +BOTHASAR__P +BOTHASAR__T +KXA +# Non-OTC and non-Otter +HODOR + +# A temporary "gift" to balthasar_s +class character: +[character_no_s] +[character_no_s] +[character_no_s] +[character_no_s] +[character_no_s] ms/$/__S/ + +# All the characters that are just one word (used in Ramirez meme) +class char-1word: +[character] ms/has-no-spaces/ + +class char-noart: +[character] ms/remove-the/ +# He made a connection in the other direction and the fans all shouted out... +class interjection: +BAOBABS +BOOM-DE-YADA +CH**RP +CH**RPING MUSTARD +GOOMHR +LWPAII +OMR +RANDAMMIT +STEAMBOTTLE + +class noun-mass-pos-article: +A BLUEHANCEMENT +A BUTTER +A +A CUSTARD +AN EPSILON +A KETCHUP +AN OINTMENT +AN ORGANIZED SAND +A PANTHER SALVE +A Q04B +A REDUNDANCY +A SIGCOURAGEMENT +A SKITCHERTS +A TIME +A ᓭᘖᔭᓄᐨ +A T1I +A BFTF +A LEML + +class noun-mass-positive: +[noun-mass-pos-article] ms/remove-article/ + +class noun-mass-neg-article: +AN ****DISHNESS +A HERESY +A JAVASCRIPT +A LEGO +A MMONS +A MUSTARD +AN ONGST +AN OUTSIDE +A SEMENCOFFEECANCERSTARSANDBACONBABIESONICE +A TREBUCHAT + +class noun-mass-negative: +[noun-mass-neg-article] ms/remove-article/ + +class noun-mass: +[noun-mass-positive] +[noun-mass-negative] + +class noun-mass-the: +[noun-mass] ms/add-the/ + +# NOTE: I include 'GOAT', 'PENGOAT', etc. as [animal] even though they refer to poats, because it's just too confusing. +multiclass noun-animal[-art, -plural]: +AN AMOEBLPY | AMOEBLPIES +AN ANTELOPEY | ANTELOPIES +AN ANTEPENGOAT | ANTEPENGOATS +A BADGERMOLP | BADGERMOLPS +A BAOBABBY | BAOBABBIES +A BEANIE | BEANIES +A BEARAPTOR | BEARAPTORS +A BEESNAKE | BEESNAKES +A BRAINSLUG | BRAINSLUGS +A CENTIMOLPY | CENTIMOLPIES +A CHIRPY | CHIRPIES +A CHUPAMOLPY | CHUPAMOLPIES +A CUEGANITE | CUEGANITES +AN EQUIMOLPY | EQUIMOLPIES +A FACEBUG | FACEBUGS +A FLUTTERBEE | FLUTTERBEES +A FREQUENTLY | FREQUENTLIES +A GATORRAPTOR | GATORRAPTORS +A GECKOLPY | GECKOLPIES +A GHOLPY | GHOLPIES +A GOAT | GOATS +A GOATPY | GOATPIES +A GUINEAMOLP | GUINEAMOLPS +A HAMPLY | HAMPLIES +A KANGAMOLP | KANGAMOLPIES +A KEYBOARD | KEYBOARDS +A LOOPIST | LOOPISTS +A MEOWLPY | MEOWLPIES +A MOLPACA | MOLPACAS +A MOLPANZEE | MOLPANZEES +A MOLPHIN | MOLPHINS +A MOLPICOOT | MOLPICOOTS +A MOLPIDILLO | MOLPIDILLOES +A MOLPOSSUM | MOLPOSSUM +A MOLPY | MOLPIES +A MOLPYBARA | MOLPYBARAS +A MOLPYDILE | MOLPYDILES +A MOLPYSNAKE | MOLPYSNAKES +A MOME | MOMES +A MOOPY | MOOPIES +A MURTLE | MURTLES +A NINJA | NINJAS +AN ORCARAPTOR | ORCARAPTORS +AN ORANGUMOLP | ORANGUMOLPS +AN OTTER | OTTERS +AN OTTERMOLPY | OTTERMOLPIES +A PAGEPOPE | PAGEPOPES +A PENGOAT | PENGOATS +A POPE | POPES +A POPERAPTOR | POPERAPTORS +A PRICKLYMOLP | PRICKLYMOLPS +A QUACKMOLPY | QUACKMOLPIES +A RABTOR | RABTORS +A RAPTOR | RAPTORS +A RAPTORCAT | RAPTORCATS +A RAPTORCUDA | RAPTORCUDAS +A RAPTORSHARK | RAPTORSHARKS +A RATPY | RATPIES +A REDUNDAKITTY | REDUNDAKITTIES +A RHINOCEROLPY | RHINOCEROLPIES +A RIBBIT | RIBBITS +A ROOMMOLPY | ROOMMOLPIES +A SEAWOLPY | SEAWOLPIES +A SLITHERMOLP | SLITHERMOLPS +A SPARROW-RAPTOR | SPARROW-RAPTORS +A SPOILERAPTOR | SPOILERAPTORS +A SQUIRPY | SQUIRPIES +A TIMEWAITER | TIMEWAITERS +A TRICEROCUE | TRICEROCUES +A TRILOBOLPY | TRILOBOLPIES +A TRILOMEG | TRILOMEGGS +A TURTLEMOLPY | TURTLEMOLPIES +A VIPERRAPTOR | VIPERRAPTORS +A VIRGIN | VIRGINS +A WALLAPY | WALLAPIES +A WOLPY | WOLPIES +A WOOLPY | WOOLPIES +A WOTTERMOLPY | WOTTERMOLPIES + +class noun-animal: +[noun-animal-art] ms/remove-article/ + +class noun-animal-1word: +[noun-animal] ms/has-no-spaces/ + +class noun-animal-singular: +[noun-animal] + +multiclass noun-interval [-art, -plural]: +A HECTONEWPIX | HECTONEWPICES +A LONGPIX | LONGPICES +A MINIP | MINIPS +A NOPIX | NOPICES +A NEWPIX | NEWPICES +A XIP | XIPS +A DIP | DIPS +A WIP | WIPS +A YIP | YIPS + +class noun-interval: +[noun-interval-art] ms/remove-article/ +multiclass noun-mineral [-art, -plural]: +A BAG | BAGS +A BAGPUN | BAGPUNS +A BAOBAB | BAOBABS +A BLINDPOST | BLINDPOSTS +A BLITZROCKET | BLITZROCKETS +A BOTCASTLE | BOTCASTLES +A BUFFYHAT | BUFFYHATS +A BUNGALOW | BUNGALOWS +A CAKE | CAKES +A CASBOTTLE | CASBOTTLES +A CASTRAFTLE | CASTRAFTLES +A CHRONOTRANSPONDER | CHRONOTRANSPONDERS +A COMA | COMAS +A C****KIE | C****KIES +A COLPIX | COLPICES +A CREDENZA | CREDENZAS +A CUPCAKE | CUPCAKES +A DECREE | DECREES +A DILGUNNERANG | DILGUNNERANGS +A DOOM BANANA | DOOM BANANAS +A FIRSTPOST | FIRSTPOSTS +A GAZEBO | GAZEBOES +A GRAPEVINE | GRAPEVINES +A HARPSICHORD | HARPSICHORDS +A HOTDOG | HOTDOGS +A HUGO | HUGOS +A LAPLEOPARD | LAPLEOPARDS +AN M&&M | M&&MS +A MANIP | MANIPS +A MIP | MIPS +A MUSTARDIS | MUSTARDISAR +A MYSTERYONG | MYSTERYONGS +A NEEDLE-PULLED THING | NEEDLE-PULLED THINGS +A NEWPIXBOTTIFICATION | NEWPIXBOTTIFICATIONS +AN OLDPIX | OLDPICES +AN ONG | ONGS +AN OTHERCOMIC | OTHERCOMICS +AN OTTERCOMIC | OTTERCOMICS +AN OTTERONG | OTTERONGS +AN OTTIFICATION | OTTIFICATIONS +AN OVARY | OVARIES +A PASTPAGE | PASTPAGES +A PASTPOST | PASTPOSTS +A PHONESAW | PHONESAWS +A PLAN(C)K | PLAN(C)KS +A PUN | PUNS +A PUNSAW | PUNSAWS +A PUZZLE | PUZZLES +A RAFTCASTLE | RAFTCASTLES +A REVEALER THE RECENT | REVEALERS THE RECENT +A BLITZYCLE | BLITZYCLES +A REDUNDABIKE | REDUNDABIKES +A RIDONDAKITI | RIDONDAKITI +A RONG | RONGS +AN S&&M | S&&MS +A SCRUMPTIOUS DONUT | SCRUMPTIOUS DONUTS +A SILENTONG | SILENTONGS +AN ONGTHEMOON | ONGTHEMOONS +A SHIPCASTLE | SHIPCASTLES +A %5bSPOILER%5d | %5bSPOILERS%5d +A SPOILERCAKE | SPOILERCAKES +A SPURLER | SPURLERS +A STARRYONG | STARRYONGS +A STEAMBOTTLE | STEAMBOTTLES +A TARDIS | TARDISES +A THREAD | THREADS +A THWAPSTICK | THWAPSTICKS +A TIMEFRAME | TIMEFRAMES +A TIMEODY | TIMEODIES +A TREBUCHAT | TREBUCHATS +A TREBUCHET | TREBUCHETS +AN UNG | UNGS +A VITSSÅGEN | VITSSÅGAR +A WHEELSTICK | WHEELSTICKS +A WIPEND | WIPENDS +A WOWTERFALL | WOWTERFALLS +A WOWTREE | WOWTREES + +class noun-mineral: +[noun-mineral-art] ms/remove-article/ + +class noun-plural: +[noun-animal-plural] +[noun-mineral-plural] +[noun-interval-plural] + +class nounz: +[noun-plural] ms/S$/Z/ + +# 'unique' noun is one for which the article A or AN does not make sense: +# There is only one OTC, so we do not say 'AN OTC' (but THE OTC is okay) +# Ironically the noun-uniqie-article form is needed, to satisfy the +# "Yes Virginia, there is a Santa Claus" template. +class noun-unique-article: +A COMFY CHAIR +AN EPILOGUE +A JAVASCRIPT +A MROBDEX +AN OTC +AN OTT +AN OTTSCARS +AN OTW +A QUESTIONABLE CARCASTLE +A RECKONING +A SKYCIRCLE +A TYMIVERSARY +A VATICAN MILLINER'S PERFECT CUSTOMER +A VOLDEFRAME +A WHISTLE OF TEMPORAL HARMONY +A ZANCLEAN FLOOD +ЯОЯЯІМ ТТО ИА + +class noun-unique: +[noun-unique-article] ms/remove-article/ +[noun-unique-article] ms/ ИА$// + +#regex ra-balt: /(^ *AN? +)|( +ИА *$)//i +#class nu-balt: +#[noun-unique-article] ms/ra-balt/ + +# In azule's version this is called "noun-definite" +class noun-unique-the: +[noun-unique] ms/add-the/ + +# A 'commodity' noun is one for which the article A or AN makes sense +# (and THE would also be all right). First we define these with their article +# and then we make the commodity list by removing the articles from this list. +class noun-comm-art: +[noun-animal-art] +[noun-mineral-art] +[noun-interval-art] + +class noun-article: +[noun-unique-article] +[noun-comm-art] + +class noun-commodity: +[noun-comm-art] ms/remove-article/ + +class noun-singular: +[noun-unique] +[noun-commodity] + +class noun-pl-1word: +[noun-plural] ms/has-no-spaces/ + +class noun-singular-article: +[noun-comm-art] + +class noun-singular-the: +[noun-singular] ms/add-the/ + +# Note that this defines "place-name" and "place-prep", but doesn't +# define "place", but we immediately define that later. +multiclass place [-name, -pr-in, -pr-out, -art]: +CASSINI-MADAGASCAR | IN | OUT OF | A +THE CASTRAFTLE | ON | OFF OF | A +CHATEAU D'IF | IN | OUT OF | A +CHRONOCORP | AT | OUT OF | A +GIBRALTAR | IN | OUT OF | A +NEWPIXIA | IN | OUT OF | A +OTTERCON | AT | OUT OF | AN +R.A.Z.O.R. | AT | OUT OF | A +SPAAACE | IN | BACK FROM | SOME +THE AFOREWHEN | IN | OUT OF | AN +THE AFTERWHEN | IN | OUT OF | AN +THE BASEMENT | IN | OUT OF | A +THE BEACH | ON | AWAY FROM | A +THE BLUECAVE | IN | OUT OF | A +THE BOTCASTLE | IN | OUT OF | A +THE DUNES | IN | OUT OF | SOME +THE FUTURE | IN | BACK FROM | A +THE HILLS | IN | OUT OF | SOME +THE MR*BDEX | IN | OUT OF | A +THE MOONBASE | ON | OFF OF | A +THE MOUNTAINS | IN | OUT OF | SOME +THE MUSTARDIS | IN | OUT OF | A +THE OTC | IN | OUT OF | AN +THE OTT | IN | OUT OF | AN +THE OUTSIDE | IN | BACK FROM | AN +THE PAST | IN | FORWARD FROM | A +THE PRESENT TIME | IN | OUT OF | A +THE RAFTCASTLE | ON | OFF OF | A +THE RIVER | ON | FROM | A +THE SANDCASTLE | IN | OUT OF | A +THE SEA | ON | FROM | A +THE TARDIS | IN | OUT OF | A +THE TOWER | ON | OUT OF | A +XKPLAINXKCD | ON | FROM | SOME +ᘝᓄᘈᖉᐣ | IN | OUT OF | A +ЯОЯЯІМ ТТО ƎНТ | ON | OUT OF | AN + +# Use this regex to transform IN/ON/AT to INTO/ONTO/INTO +regex in-to-into: /IN/INTO/, /ON/ONTO/, /AT/INTO/ + +# Use this regex to transform SOME/A/AN to THEM/IT/IT +regex some-to-them: /SOME/THEM/, /AN?/IT/ + +# This one is a little more elaborate; it is used when a [place] is +# modified by another word (typically an adjective) and we want to +# retain SOME when appropriate but otherwise use A or AN according to the +# adjective that was added. For example, starting with: +# ... A RIVER ... +# ... SOME MOUNTAINS ... +# we add adjectives to get: +# ... A AN ENDISH RIVER ... +# ... SOME AN ENDISH MOUNTAINS ... +# then postprocess to remove the unwanted article: +# ... AN ENDISH RIVER ... +# ... SOME ENDISH MOUNTAINS ... +regex postproc-some: / SOME AN? / SOME /, / AN? (AN?) / $1 / + +class place: +[place-name] + +class place-noart: +[place-name] ms/remove-the/ + +# Test of fancy regex. To see results, uncomment the code and use the command: +# +# automeme -v -n 30 -t '[test2]' | sort +# +#regex test3: /(^THE )|( ƎHT$)|($)//i +# +#class test1: +#THE BAR +#FOO ƎHT +#QUX +# +#class test2: +#[test1] ms/test3/ + +# Only used in the Russian Reversal meme (%%% we really need multiclass unions) +multiclass place-russia [-name, -pr-in, -pr-out]: +RUSSIA | IN | OUT OF +RUSSIA | IN | OUT OF +RUSSIA | IN | OUT OF +RUSSIA | IN | OUT OF +RUSSIA | IN | OUT OF + +class noun-singular-1word: +[noun-singular] ms/has-no-spaces/ + +class noun: +[noun-singular] +[noun-mass] + +class noun-the: +[noun-singular-the] +[noun-mass-the] + +class noun-1word: +[noun] ms/has-no-spaces/ + +class noun-plural-the: +[noun-mass] ms/add-the/ +[noun-plural] ms/add-the/ + +class noun-singular-that: +[noun-singular] ms/add-that/ +[noun-unique] ms/add-that/ + +# %%% This is a placeholder for a full negative-positive distinction system +# to be added after I permit multiclass unions. For now it's okay because +# it is only being used in one place and there aren't many negative nouns +# to redundantly list twice and be redundant. +# Since the nouns are already multiclassed and already have one distinction (animal vs mineral), I'd want to define a way for two multiclasses to be union-ed together forming a new multiclass. That would also simplify existing memes where I use the isomorph syntax and I have to use "[verb-tr-xxx verb-intr-xxx]" instead of just "verb-xxx" so that the isomorph works. +class noun-singular-neg-art: +A BAGPUN +A BRAINSLUG +A C****KIE +A DILGUNNERANG +A DOOM BANANA +A FACEBUG +A KEYBOARD +A LOOPIST +A PUNSAW +A RAPTORCAT +A RAPTORSHARK +A SPURLER +A STEAMBOTTLE +A THWAPSTICK +A VOLDEFRAME + +class noun-singular-negative: +[noun-singular-neg-art] ms/remove-article/ + +# This probably won't be too useful. Some preps not listed (like BETWEEN) would be nice to add if I could make a prep-ref-plural for prepositions referencing a plural indirect object; or others (like INSTEAD OF) that require that the precedent phrae is [verb-tr] [object]. +class preposition: +ABOVE +ACROSS +AMONGST +ATOP +BEFORE +BELOW +BESIDE +CLOSE TO +FOR +FROM +IN +INSTEAD OF +LIKE +NEAR +ON +ONTO +OUT OF +OVER +PAST +'ROUND +THROUGH +TOWARDS +UNDER +UPON +WITH + +class prep-1word: +[preposition] ms/has-no-spaces/ + +# ------------------------ INTRANSITIVE VERBS ------------------------ + +# Column +# 1 intransitive present continuous, as in "I am hiding", or "while hiding" +# 2 intransitive 1st/2nd person present and infinitive, as in "I hide", "you hide", or "to hide" (3rd-person present is "verb-intr-present") +# 3 intransitive past, as in "I hid" +# 4 intransitive perfect, as in "I had hidden" +# 5 intransitive third-person present, as in "he hides" + +multiclass verb-intr[-cont, -inf, -past, -perfect, -present, -art]: +:AZULING: | :AZULE: | :AZULED: | :AZULED: | :AZULES: | AN +BASEMENTING | BASEMENT | BASEMENTED | BASEMENTED | BASEMENTS | A +BLINDPOSTING | BLINDPOST | BLINDPOSTED | BLINDPOSTED | BLINDPOSTS | A +CHEWING BEESNAKES | CHEW BEESNAKES | CHEWED BEESNAKES | CHEWED BEESNAKES | CHEWS BEESNAKES | A +CH**RPING | CH**RP | CH**RPED | CH**RPED | CH**RPS | A +COMAING | COMA | COMA'D | COMA'D | COMAS | A +DELURKING | DELURK | DELURKED | DELURKED | DELURKS | A +DOODLING FURIOUSLY | DOODLE FURIOUSLY | DOODLED FURIOUSLY | DOODLED FURIOUSLY | DOODLES FURIOUSLY | A +GOING CAVE | GO CAVE | WENT CAVE | GONE CAVE | GOES CAVE | A +HIDING FROM CORINNE | HIDE FROM CORINNE | HID FROM CORINNE | HIDDEN FROM CORINNE | HIDES FROM CORINNE | A +KETCHUPPING | KETCHUP | UPKETCHED | UPKETCHED | KETCHUPS | A +MOLPYING ABOUT | MOLPY ABOUT | MOLPIED ABOUT | MOLPIED ABOUT | MOLPIES ABOUT | A +MOLPYING DOWN | MOLPY DOWN | MOLPIED DOWN | MOLPIED DOWN | MOLPIES DOWN | A +MOLPYING UP | MOLPY UP | MOLPIED UP | MOLPIED UP | MOLPIES UP | A +POSTING | POST | POSTED | POSTED | POSTS | A +UNBASEMENTING | UNBASEMENT | UNBASEMENTED | UNBASEMENTED | UNBASEMENTS | AN +WAITING | WAIT | WAITED | WAITED | WAITS | A +WAITING FOR IT | WAIT FOR IT | WAITED FOR IT | WAITED FOR IT | WAITS FOR IT | A +*AUFMOLP*ING | *MOLP* *AUF* | *MOLP*ED *AUF* | *AUFGEMOLPT* | *MOLP*S *AUF* | AN +E:E:EING | E:E:E | E:E:E'D | E:E:E'D | E:E:ES +# For testing +#SINGING | SING | SANG | SUNG | SINGS | A + +# ------------------------ TRANSITIVE VERBS ------------------------ + + #Column +# 1 transitive present continuous, as in "I am drinking milk" or "while drinking milk" +# 2 transitive 1st/2nd person present, and infinitive, as in "I drink milk" or "to drink milk" (3rd-person present is "verb-tr-present"); used with "will" for future tense +# 3 transitive past tense, as in "I drank milk" +# 4 transitive active-perfect or passive-perfect, as in "he had drunk milk" or "the milk had been drunk"; used with "will have" for future-perfect +# 5 transitive 3rd person present, as in "he drinks milk" +# 6 article for use in compound phrases, e.g. "A" for "a drinking party" +multiclass verb-tr[-cont, -inf, -past, -perfect, -present, -art]: +BLITZING | BLITZ | BLITZED | BLITZED | BLITZES | A +BLITZNAPPING | BLITZNAP | BLITZNAPPED | BLITZNAPPED | BLITZNAPS | A +BLUENHANCING | BLUENHANCE | BLUENHANCED | BLUENHANCED | BLUENHANCES | A +CH**RPING | CH**RP | CH**RPED | CH**RPED | CH**RPS | A +CORINNING | CORINNE | CORINNED | CORINNED | CORINNES | A +CRENELLATING | CRENELLATE | CRENELLATED | CRENELLATED | CRENELLATES | A +DEMUSTARDING | DEMUSTARD | DEMUSTARDED | DEMUSTARDED | DEMUSTARDS | A +****DING | ****D | ****DED | ****DED | ****DS | AN +ENHANCING | ENHANCE | ENHANCED | ENHANCED | ENHANCES | AN +GOATING | GOAT | GOATED | GOATED | GOATS | A +HOTDOGGING | HOTDOG | HOTDOGGED | HOTDOGGED | HOTDOGS | A +KETCHUPPING | KETCHUP | UPKETCHED | UPKETCHED | KETCHUPS | A +MEMEIFYING | MEMEIFY | MEMEIFIED | MEMEIFIED | MEMEIFIES | A +MUSTARDING | MUSTARD | MUSTARDED | MUSTARDED | MUSTARDS | A +NINJAING | NINJA | NINJA'D | NINJA'D | NINJAS | A +ONGING | ONG | ONG'D | ONG'D | ONGS | AN +OTTCOLORISING | OTTCOLORISE | OTTCOLORISED | OTTCOLORISED | OTTCOLORISES | AN +OTTIFYING | OTTIFY | OTTIFIED | OTTIFIED | OTTIFIES | AN +POSTING | POST | POSTED | POSTED | POSTS | A +PUNSAWING | PUNSAW | PUNSAWED | PUNSAWED | PUNSAWS | A +SACRIFICING | SACRIFICE | SACRIFICED | SACRIFICED | SACRIFICES | A +SCHIZOBLITZING | SCHIZOBLITZ | SCHIZOBLITZED | SCHIZOBLITZED | SCHIZOBLITZES | A +SPOILERING | SPOILER | SPOILERED | SPOILERED | SPOILERS | A +SUSTAINABILIZING | SUSTAINABILIZE | SUSTAINABILIZED | SUSTAINABILIZED | SUSTAINABILIZES | A +THWAPPING | THWAP | THWAPPED | THWAPPED | THWAPS | A +WAITING FOR | WAIT FOR | WAITED FOR | WAITED FOR | WAITS FOR | A + +class verb-inf: +[verb-intr-inf] +[verb-tr-inf] + +class verb-inf-1word: +[verb-inf] ms/has-no-spaces/ + +class verb-cont: +[verb-intr-cont] +[verb-tr-cont] + +template verb-cont-article: [verb-tr-cont, verb-intr-cont][][$0/-art] [$0/hyphenate/][] + +class verb-cont-1word: +[verb-cont] ms/has-no-spaces/ + +class verb-present: +[verb-intr-present] +[verb-tr-present] + +class verb-present-1word: +[verb-present] ms/has-no-spaces/ + +class verb-tr-perfect-1word: +[verb-tr-perfect] ms/has-no-spaces/ +# Convert a verb-present to archaic "-eth" ending. The conversions are meant to be a bit humorous. +regex present-to-eth: /$/:/, /ES:/ETH:/, /([AIOU])S:/$1ETH:/, /TS:/TETH:/, /(.)S:/$1$1ETH:/, /:$// +regex prepend-re: /^/:/, /(:*)/$1RE-/, /^:// +class verb-past: +[verb-intr-past] +[verb-tr-past] + +class verb-perfect: +[verb-intr-perfect] +[verb-tr-perfect] + +# Used only to test/demonstrate the non-redundancy algorithm. +class avoid: +FOO +BAR +BAZ +QUX + +# [all-vocab] attempts to include every word exactly once. It cannot be perfect. +class all-vocab: +[adjective] +[adverb] +[character-1word] +[interjection] +[noun-mass] +[noun-animal] +[noun-mineral] +[noun-interval] +[noun-unique] +[place-noart] +[prep-1word] +[verb-inf-1word] + +class all-vocab-f: +[all-vocab] ms/^(F)/$1/ + +class all-vocab-i: +[all-vocab] ms/^(I)/$1/ + +class all-vocab-h: +[all-vocab] ms/^(H)/$1/ + +class all-vocab-p: +[all-vocab] ms/^(P)/$1/ + +class all-vocab-t: +[all-vocab] ms/^(T)/$1/ +# ---------------------- CLASSLIKE TEMPLATES ----------------------- + +# Get out of recentmost class definition +templates: + +# Generate a character name that has been transformed for use in a +# SUP DAWG, ... meme. For example, +regex dawgify: /O\b/OH/gi, /\bA|A\b/UH/gi, /EA/EE/gi, /X/KS/gi, /CK/KK/gi, /C|CH/K/gi, /UR/R/gi, /IR/UR/gi, /ER/A/gi, /TH/D/gi, /EW/U/gi, /CU/KYU/gi, /EST/IST/gi, /({^AEIOU})\1/$1/gi, /Y\b/EE/gi, /WH/W/gi, /I([^AEIOU])E\b/IE$1/gi, /O([^AEIOU])E\b/OA$1/gi, /U([^AEIOU])E\b/YOO$1/gi +template dawgchar: [character][][$0/dawgify/][] +# For testing: +# [character][][$0] -> [$0/dawgify/] + +# -------------------- REGEXes FOR REPLACEABLES -------------------- + +# Abbreviate a trailing "ING" to "IN'" (meant for verbs) +regex abbrev-ing: /:$/ :/, /$/ /, /ING /IN' /, / $//, / :$/:/ + +# Add an article A or AN +regex add-article: /^/A /, /^A ({AEIOU})/AN $1/ + +# Transform a continuous verb, such as "RUNNING", into the plural +# of the actor ("RUNNERS"). Also turns "MOLPYING DOWN" into "MOLPIERS DOWN", +# and avoids turning "SINGING" into "SERSERS" or "SERSING": it does +# this by first adding a blank space to the end, then transforming -YING +# or -ING only if it is followed by a space, then removing the extra space +# at the end. +regex cont-to-actors: /:$/ :/, /$/ /, /YING /IERS /, /ING /ERS /, /EERS /ERS /, / $//, / :$/:/ +regex cont-to-actor: /:$/ :/, /$/ /, /YING /IER /, /ING /ER /, /EER /ER /, / $//, / :$/:/ + +# Return the first letter of the string: given "MORDOR", returns "M". +regex first-letter: /^(.).*/$1/ + +# Return the first "word" (any group of characters except a space) of a string, or the whole string if it has no spaces. +regex first-word: /^({^ }+) .*$/$1/ +regex second-word: /^{^ }+ //, /^({^ }+) .*$/$1/ +# Return the last "word" +regex last-word: /^.* ({^ }+)$/$1/ + +# Remove a '-' and everything after it, leaving only the former part. +# For example if the string is "404-NOT FOUND", this returns just the "404". +regex former-part: /{`}.*$// +# +regex middle-part: /^{^`}*{`}//, /{`}{^`}*$// +# Remove any initial text up to a '`' (with greedy matching), leaving +# only the latter part. For example if the string is "404-NOT FOUND", +# this returns just the "NOT FOUND". +regex latter-part: /^.*{`}// + +# Turn all 'R' and 'L' into 'W' +regex fudd: /{RL}/W/g + +# Turn spaces to hyphens '-' +regex hyphenate: / /-/g + +# Return the initial letters of all words in the string: given "REVEALER THE RECENT", returns "RTR". +regex initial-letters: /-/ /g, /^/ /, / (.){^ }*/$1/g, /^ // + +# From azule: tries to turn a noun into the comparative adjective form. Examples: THREAD -> THREADIER ; OVARY -> OVARIER ; MOLPHIN -> MOLPHINNIER +regex intensify: /(?:I?{EY}?|(?:ED)?|({AEIOU}?({GTN}?)))$/$1$2/, /$/IER/ + +# Letter multipliers. These are named based on the sample words AGILE +# (representing a words that starts with a vowel) or DEFILE (representing +# one that starts with a consonant + +# ...vC -> ...vCC : AGILE->AGGILE, DEFILE->DEFFILE +# Double first post-vowel consonant +regex lm-aggile: /({AEIOU})({^AEIOU})/$1$2$2/ + +# ...V -> ...VVVV : AGILE->AGIIIILE, DEFILE->DEEEEFILE +# Increase first vowel to 4x +regex lm-aaaagile: /({AEIOU})/$1$1$1$1/ + +# AGILE->AGGIIIILE, DEFILE->DEFFIIIILE +regex lm-aggiiiile: /({AEIOU})({^AEIOU})({^AEIOU}*)({AEIOU})/$1$2$2$3$4$4$4$4/ + +# Negate a (positive, bare) adjective by adding "AN UN" to the beginning +regex negate-adjective: /^/AN UN/ + +# Remove a first word, if any +regex remove-first-word: /^{^ }+ // + +# Remove everything up to the first vowel (Used in the "Bless you, ants. Blants." template) +regex remove-leading-consonants: /^.*?({AEIOU})/$1/ + +# If the input ends in 'S' return a null string, else return an 'S' +regex s-ending-invert: /TARDIS$/TARDI/, /$/S/, /^.*?({S}+)$/$1/, /SS// + +# Add 'SOVIET' to the beginning of something (which should probably be a +# [place]), then switch if it started with 'THE', move the article to +# the beginning. Thus, "ENGLAND" would become "SOVIET ENGLAND" and +# "THE BEACH" would become "THE SOVIET BEACH". +regex sovietize: /^/SOVIET /, /SOVIET THE/THE SOVIET/ + +# Spell out a word, for example "WORD" becomes "W-O-R-D" +regex spell-out: /({A-Z})/$1-/g, /- / /g, /-$// + +# Change an initial article 'THE' to 'THIS' +regex the-to-this: /^THE /THIS / + +template random-digit: [0@0.1, 1@0.111111, 2@0.125, 3@0.142857, 4@0.166667, 5@0.2, 6@0.25, 7@0.333333, 8@0.5, 9][] +template random_12: [@0.333, 1@0.5, 2][] + + + +template imper1: [verb-tr-inf] THE [noun-plural, noun-mass, adjec-noun][] +template imper2: [verb-tr-inf] [noun-plural] [preposition] THE [noun-singular, noun-mass, adjec-noun][] +template imper3: [verb-intr-inf] [preposition] THE [noun-singular, noun-mass, adjec-noun][] +template imper4: [place-name][$0/remove-the/][][verb-intr-inf] [$0/-pr-out] [$0/-art] [$1][] +template sentence-imperative: [imper1, imper2, imper3, imper4][] + +# ----------------------------- MEMES ----------------------------- + + +# From South Park episode "Gnomes" (1998) "1. Collect Underpants. / 2. ? / 3. Profit" +#-1. COLLECT UNDERPANTS. 2. ? 3. PROFIT +PHASE 1. [sentence-imperative] / / PHASE 2. [sentence-imperative] / / PHASE 3. [sentence-imperative] / / PHASE 4. ??? / / PHASE 5. [PROFIT@0.5, verb-inf]!!! +# "404 Not Found", A common error when browsing the World Wide Web +# "408 Request Timeout", errors happened on the OTT for a while (see OTT:1916:19#p3579895, OTT:1970:9#p3599612, OTT:1981:0|#p3604672, OTT:1993:36|#p3609728, etc.) +# "503 Service Unavailable", errors have affected the OTT several times due to spambot attacks +# We select one of three literal strings, cut [], and invoke the string twice using regexps to extract the two parts. +#-404 - NOT FOUND +[404-NOT FOUND@0.33, 408-REQUEST TIMEOUT@0.5, 503-UNAVAILABLE][][$0/former-part/] -- [noun-singular] [$0/latter-part/] + +# azule: xkcd #647 +#-9/11 HEPPENED BEFORE... +THE [ZANCLEAN@0.5, adjective-negative] [FLOOD@0.5, noun] HAPPENED BEFORE I WAS BORN, YET I'M OLD ENOUGH TO HAVE THIS CONVERSATION WITH YOU. + +# From "That's Why I assault Ren" (a manga about pedophilia, 2007), original phrase is "A cat is fine too" ; http://knowyourmeme.com/memes/a-cat-is-fine-too +#-A CAT IS FINE TOO +[noun-singular-article] IS [adjective] TOO + +# xkcd #1318, memeified by mrob27. +# First we define a template for each of the six sentences in the comic. +template xkcd1318a: [noun-plural] SUGGEST IT'S [adjective].[] +template xkcd1318b: IT'S [noun-singular-article].[] +template xkcd1318c: IT'S [adjective-article] [noun-singular].[] +template xkcd1318d: IT'S [noun-singular-article] [verb-tr-perfect] BY THE [noun-singular, adjective] [noun-plural].[] +template xkcd1318e: IT'S THAT PLUS [adjective] [noun-singular].[] +template xkcd1318f: IT'S [verb-tr-perfect] IN [noun-singular-article, noun-unique-article] THAT'S [verb-tr-perfect].[] +# +# Next, define a template that chooses at random one of the above six forms. +template xkcd1318-part: [xkcd1318a, xkcd1318b, xkcd1318c, xkcd1318d, xkcd1318e, xkcd1318f][] +# +# Then, make a random xkcd 1318 by doing [xkcd1318-part] six times, with an *ACTUALLY* in between each one. +#-ACTUALLY, MEASUREMENTS SUGGEST... +... *ACTUALLY*, [xkcd1318-part] *ACTUALLY*, [xkcd1318-part] *ACTUALLY*, [xkcd1318-part] *ACTUALLY*, [xkcd1318-part] *ACTUALLY*, [xkcd1318-part] *ACTUALLY*, [xkcd1318-part] *ACTUALLY*, ... +# "A few cards short of a full deck", etc. and probably rather old ; http://snowclones.org/2007/10/03/a-few-x-short-of-a-y/ +#-A FEW X SHORT OF A Y +... XE'S [JUST @0.5,]A FEW [noun-plural] [SHY@0.5, SHORT] OF [noun-singular-article] + +# Added by mrob27 +# Shakespeare (Richard III, 1591) "A horse, a horse! My kingdom for a horse" ; http://snowclones.org/2008/06/04/my-kingdom-for-an-x/ +# and noting that "my kingdom for an" now yields results from Google, thus we need not ensure the noun starts with a consonant +#-A HORSE, A HORSE! MY... +[noun-singular-article], [$0], MY KINGDOM FOR [$0] + +# Japanese meme: Image of a baby Manga-captioned with a two-part contrary zinger (example: "That's a lovely sweater ... / for me to puke on!!!") followed by the tag-line まさに外道!!! (masanigedou, "downright heresy") indicating that the baby is a demon for being so impolite ; http://knowyourmeme.com/memes/aka-san-gedo-beibi-%E5%A4%96%E9%81%93%E3%83%99%E3%82%A4%E3%83%93%E3%83%BC +#-AKA-SAN / GEDOU BEIBII +#[THAT@0.5, YOUR] [noun] WAS [PRETTY@0.25, MOLPISHLY@0.33,, adverb-positive] [adjective-positive] ... FOR A [noun-singular-negative]. *まさに外道!!!* + +# Zero Wing animation (2000); http://snowclones.org/2011/01/10/all-your-x-are-belong-to-us/ +#-ALL YOUR BASE ARE BELONG TO US +ALL YOUR [noun-singular] ARE BELONG TO [noun-singular, noun-plural, noun-mass, character] + +# Firefly TV series ("Trash" episode, 2003); the original quote was "Also, I can kill you with my brain." +#-ALSO, I CAN KILL ... +ALSO, I CAN [verb-tr-inf] YOU WITH MY [noun-singular]. + +# Added by @Link, not in AUTOMEME +# deviantART comic by Angela Dunn (2009) with words "Angie grab my boobs"; http://knowyourmeme.com/memes/x-grab-my-y +#-ANGIE GRAB MY... +[character] GRAB MY [noun-singular, noun-plural] + +# azule: xkcd #859 +#-AN UNMATCHED LEFT PARENTHESIS +[adjective][][$0/negate-adjective/] [noun-singular] CREATES AN UNRESOLVED TENSION THAT WILL STAY WITH YOU ALL [noun-interval] + +# Videogame "Genji: Days of the Blade" (2006), used as a live demo during Sony's unveiling of the PS3 console, showed the "Giant Enemy Crab" character; original game's text is "you attack its weak point for massive damage" ; http://knowyourmeme.com/memes/e3-sony-2006-giant-enemy-crab +#-ATTACK ITS WEAK POINT... +template decr1: ATTACK ITS WEAK POINT FOR [adjective] [noun-singular, noun-plural, noun-mass][] +[decr1] + +# Pokemon "Wild X Appeared!" (with X being any Pokemon Red + Blue character, e.g. EKANS or ZUBAT), later changed to "A wild X appeared!", present tense form also seen on Internet; http://knowyourmeme.com/memes/a-wild-x-appears-wild-x-appeared +#-A WILD PIKACHU APPEARS +A WILD [noun-singular] [APPEARED@0.5, APPEARS]! + +# "The Dark Knight" (Batman film, 2008) "Because he's the hero Gotham deserves, but not the one it needs right now" +#-BECAUSE HE'S THE HERO... +[place][$0/s-ending-invert/][][character] IS THE [HERO@0.3, noun, noun-unique] [$0] DESERVE[$1], BUT NOT THE ONE IT NEEDS RIGHT NOW. + +# Fanfictoon "Halflife: Full Life Consequences" (2006) "Because you are headcrab zombie" +#-BECAUSE YOU ARE HEADCRAB... +BECAUSE YOU ARE *[HEADCRAB@0.33, adjective] [noun-singular, noun-mass]* + +# 4chan meme "Become an hero", referring to suicide ; http://en.wiktionary.org/wiki/an_hero , http://www.nytimes.com/2008/08/03/magazine/03trolls-t.html +#-BECOME AN HERO +template decr2: BECOME AN [noun-singular, noun-plural, noun-mass][] +[decr2] + +# Bear Grylls, "Better Drink My Own [urine]", on the UK TV programme "Born Survivor", via reddit +#-BETTER DRINK MY OWN... +BETTER [verb-tr-inf] MY OWN [noun-singular, noun-mass, adjec-noun] + +# By Link; Elmer Fudd (character in Chuck Jones cartoons, ca. 1951 and later) "Be vewy vewy quiet, I'm hunting wabbits" +#-BE VEWY VEWY QUIET... +template decr3: [adjective][HUNTING@0.5, verb-tr-cont][noun-plural][]BE VEWY VEWY [$0/fudd/], I'M [$1/fudd/] [$2/fudd/][] +[decr3] + +# captioned image (2008) "Bitches dont know about my popsicle"; http://knowyourmeme.com/memes/bitches-dont-know-about-my-popsicle +#-BITCHES DON'T KNOW ABOUT... +[noun-plural] DON'T KNOW ABOUT MY [noun-singular, noun-plural, noun-mass] + +# In both of the originals (AUTOMEME and Link's AUTOMOME) this meme includes +# multi-word NOUNs. +# "Look Around You" mock educational programme (2002-2005), "Bless you ants. Blants."; At end of video: https://www.youtube.com/watch?v=gaI6kBVyu00 +#-BLESS YOU, ANTS. BLANTS. +BLESS YOU, [noun-plural, noun-mass, character, adjec-noun]. BL[$0/remove-leading-consonants/]. + +# From xkcd #442 +#-BOOM DE YADA +# We make an effort to form the desired number of syllables +# +# Replace a word or phrase with a number of I's for every syllable in it. This +# actually just counts the number of vowel-clusters, which almost always works. +# Some examples: +# MOLPY -> I TARDIS -> II ZANCLEAN FLOOD -> III HAMPLY -> II +# and note that "ZANCLEAN" might be wrong depending on how you pronounce it. +regex count-syllables: /{^AEIOUY}*{AEIOUY}+{^AEIOUY}*/i/g, /{^i}//g, /i/I/g +# +# Pick a noun, then count its syllables, and then turn the syllable-count into +# "THE" only if it is less than 3. The key here is the two-step regex: First +# it matches /III+/ and replaces with //, which makes the string null if it +# had three I's or more; then it does /I+/THE/ which turns the string +# into "THE" but only if there were I's present. +template noun2s: [noun][$0/count-syllables/][$1/III+//, /I+/THE /][][$2][$0][] +# +# $1: syllable count: PLANCK->I, WOWTREE->II, RAPTORSHARK->III +# $2: "THE " if $0 is II or less, else "" +# $3: " IS" if $0 is I or less, else "'S" +# so we get "THE PLANCK IS", "THE WOWTREE'S", "THE RAPTORSHARK'S" +template nounis: [noun, noun-mass, adjec-noun][$0/count-syllables/][$1/III+//, /I+/THE /][$1/II+//, /$/'S/, /I'S/ IS/][][$2][$0][$3][] +# Pick a noun-plural, and if it has 4 or syllables be happy, but if it has only 3 or fewer add 'THE' +template noun3s: [noun-plural][$0/count-syllables/][$1/IIII+//, /I+/THE /][][$2][$0][] +# +# Similar to noun3s except starting with an -ING verb +template verb3s: [verb-cont][$0/ING$/NGI/][$1/count-syllables/][$2/IIII+//, /I+/THE /][][$3][$0][] +# +template boomdeyada: [BOT-TER-IADA@0.1, BOOM-DE-YADA][] +# +# Put it all together. Note that in order to get the *same* [boomdeyada] twice, we need to involve the macro once and then copy it with the "[$0], [$0]" syntax. +[boomdeyada][]I LOVE [verb3s]. [I LOVE@0.5, AND ALL] [noun3s]. [nounis] PRETTY COOL. [$0], [$0]. + +# Eddard Stark (Game of Thrones character); original quote is "Brace yourselves; winter is coming". +#-BRACE YOURSELVES; WINTER... +BRACE [YOURSELF@0.5, YOURSELVES], [noun-singular, noun-mass, adjec-noun] IS COMING + +# Added by mrob27 +# Breakin' 2: Electric Boogaloo (1984); http://snowclones.org/2008/05/15/x-2-electric-boogaloo/ +# The replaceable is a movie title, so it could be anything though a single word seems most suitable. For the 'bag' reference, see [OTT:467:23|#p3342973] +#-BREAKIN' 2: ELECTRIC... +*[noun-singular, noun-mass, noun-plural, verb-tr-cont, verb-tr-inf] 2: ELECTRIC BAGALOO* + +# A valid, though extremely unlikely or absurd, sentence made from repeating the same word several times. See OTT:280:12#p3322793, OTT:280:20#p3322806 ; http://en.wikipedia.org/wiki/Buffalo_buffalo_Buffalo_buffalo_buffalo_buffalo_Buffalo_buffalo +#-BUFFALO BUFFALO BUFFALO... +template buffalow: [noun-1word, verb-inf-1word, verb-inf-1word, interjection][] +template buffalo1: [buffalow][][$0], [$0] [$0] [$0], [$0] [$0][] +template buffalo2: [buffalow][][$0] [$0], [$0] [$0] [$0], [$0] [$0][] +template buffalo3: [buffalow][][$0] [$0] [$0], [$0] [$0], [$0] [$0][] +[buffalo1, buffalo2, buffalo3]. +# azule: xkcd #598 +#-CAN YOU TRY TO LOOK... BLOCKIER? +template xkcd598a: [noun-singular-negative][]CAN YOU TRY TO LOOK... [$0/intensify/]?[] +template xkcd598b: CAN YOU TRY TO LOOK... [adjec-comp]?[] +template decr4: [xkcd598a, xkcd598b][] +[decr4] + +# By Link +# An example is in the M*A*S*H film (1970) "Captain Pierce went to Japan and all he got me was this lousy T-shirt" +#-CAPTAIN PIERCE WENT... +template went1: WENT TO [place][] +template went2: [verb-tr-past] THE [noun-plural][] +[I@0.2, character] [went1, went2], AND ALL I GOT WAS THIS LOUSY [HAT@0.17, T-SHIRT@0.2, FLIP-BOOK@0.25, noun-singular, noun-unique] + +# Photo of a cat peeking down from a hole in the ceiling (2003), later captioned with "Ceiling cat is watching you masturbate" (2006); http://knowyourmeme.com/memes/ceiling-cat +#-CEILING CAT IS WATCHING... +CEILING [noun-singular, character] IS WATCHING YOU [verb-tr-inf, verb-intr-inf] + + + + + +# azule: xkcd #285 "[Citation needed]", commonly seen on Wikipedia +#-CITATION NEEDED +%5b_[CITATION@0.3, noun-singular, noun-mass] [NEEDED@0.3, verb-tr-past]_%5d + +# webcomic/blog "Hyperbole and a Half", strip titled "Why I'll Never be an Adult" (2010) featuring the line "Clean *ALL* the things!" (cartoon image of person holding a broom with hand-written caption) ; http://knowyourmeme.com/memes/x-all-the-y +#-CLEAN ALL THE THINGS +template decr5: [verb-tr-inf] *ALL* THE [noun-plural, noun-mass, adjec-noun][] +[decr5] +I [verb-tr-past] *ALL* THE [noun-plural, noun-mass, adjec-noun] + +# Image macro of a surprised parson/face captioned with "Cock goes where?" or "Penis goes where?" ; http://knowyourmeme.com/memes/penis-goes-wherecock-goes-where +#-COCK GOES WHERE +[noun] GOES *WHERE?* + +# Added by mrob27. Matthew 6:28 (part of the Sermon on the Mount) "Consider the lilies of the field, how they grow; they toil not, neither do they spin", or Luke 12:24 "Consider the ravens: for they neither sow nor reap; which neither have storehouse nor barn; and God feedeth them..." ; http://snowclones.org/2011/01/06/consider-the-x/ +# The [consider3] template is based on Monty Python "Life of Brian" (1979), "I haven't got anything against the birds. Consider the lilies." +#-CONSIDER THE LILIES OF THE FIELD +template consider1: CONSIDER THE [noun-plural, adjec-noun][] +template consider1a: [consider1] OF [place][] +template consider2: AND WHY DO YOU WORRY ABOUT [noun-plural]? [consider1, consider1a], HOW THEY [verb-tr-inf]: THEY NEITHER [verb-tr-inf] NOR [verb-tr-inf].[] +template consider3: I HAVEN'T GOT *ANYTHING* AGAINST THE [noun-plural]! [consider1].[] +[consider1a, consider2, consider3] +template decr6: [consider1a][] + +# azule: xkcd #401 +#-COOL! I JUST GAVE A HELICOPTER... +[TREEISH@0.2, MOLPISH@0.25, NEAT@0.3, adjective-positive]! I JUST GAVE [noun-article, place] CANCER. + +# azule: xkcd #936 +#-CORRECT HORSE BATTERY STAPLE +[character][]EASY-TO-REMEMBER PASSWORD: [CORRECT@0.2, adjective] [$0/remove-the/] [noun] [noun] + +# Randall Munroe What-If book, p. 187 +#-COULD A (SMALL) ROCKET... +[place-name][adjective-article][]COULD [$1/^(AN? )/$1%28/]) [noun] (WITH [noun]) BE [verb-tr-perfect] TO [adjective-article] POINT [$0/-pr-in] [$0] WHERE IT WOULD ONLY NEED [adjective-article] [noun-mineral] TO GET TO [adjective] [adjec-noun]? + +# Friends TV show (1996) "Could I *be* wearing any more clothes?", snowclone associated with Chandler though it was Joey who said that line; http://friends.wikia.com/wiki/Running_Gags#Could_I_BE_any_more....3F +#-COULD I BE WEARING ANY MORE... +COULD [noun-plural, noun-mass, character, adjec-noun] *BE* ANY MORE [adjective]? + +# Randall Munroe What-If book, p. 199 +#-COULD YOU SURVIVE... +[place-name][]COULD YOU [verb-tr-inf] [noun-singular-article] BY [verb-tr-cont] YOURSELF [$0/-pr-in] [adjective-article] [$0/remove-the/]? + +# Film "Crouching Tiger, Hidden Dragon" (2000) +#-CROUCHING TIGER, HIDDEN... +[CROUCHING@0.7, verb-cont-1word] [RAPTORCAT@0.1, noun-singular], [HIDDEN@0.7, adjective, verb-tr-perfect-1word] [DRAGON@0.1, noun-singular] + +# From Link; Doctor Who (1988) "Crush the lesser races! Conquer the galaxy! Unimaginable power! Unlimited rice pudding! Et cetera! Et cetera!" +#-CRUSH THE LESSER... +[verb-tr-inf] THE [LESSER@0.67, adjective] [noun-plural]! [verb-tr-inf] THE [noun, adjec-noun]! UNIMAGINABLE [noun-mass, adjec-noun]! UNLIMITED [RICE PUDDING@0.5, noun-mass, noun-plural, adjec-noun]! ET CETERA, ET CETERA! + +# Star Trek (original TV series, 1966); http://snowclones.org/2007/08/06/dammit-jim-im-an-x-not-a-y/ +# notable for having been a snowclone from the very start +# DAMMIT JIM, I'M A DOCTOR... +template t-verb-actor-article: [verb-tr-cont, verb-intr-cont][][$0/-art] [$0/cont-to-actor/][] +template t-noun-singular-article: [noun-singular-article][] +template noun-or-actor: [t-verb-actor-article, t-noun-singular-article][] +DAMNIT [JIM@0.5, char-noart], I'M [noun-or-actor], NOT [noun-or-actor]! + +# Doctor Who "A Good Man Goes to War" (2011) "Demons run when..." +#-DEMONS RUN WHEN A GOOD MAN GOES TO WAR +[noun-plural] RUN WHEN [A GOOD@0.25, A MOLPISH@0.33, adjective-article] [noun] GOES TO [WAR@0.33, place] + +# By Azule: xkcd #1046 +#-DESTROY TOTALLY JUST STOPPED... +template unrealpre: [RAPTOR@0.1, ][] +template unrealsuf: [SOME@0.111, FUL@0.125, NESS@0.167, ITUDE@0.2, ED@0.25, ISH@0.333, MOLP@0.5, ][] +regex eed-ed: /({^AEIOU})EED/$1ED/g +template unrealword: [unrealpre][noun, adjective, place-noart, verb-cont][unrealsuf][] +[unrealword][]"[$0/eed-ed/]" TOTALLY JUST STOPPED SEEMING LIKE A REAL WORD. + +# Dial M for Murder (1954 film) +#-DIAL M FOR MURDER +template decr7: [noun-singular, noun-plural, noun-mass, character, adjec-noun] []DIAL [$0/first-letter/] FOR [$0][] +[decr7] + +# From Azule: an OTT running gag +#-DID ANYONE NOTICE... +DID ANYONE NOTICE THE [JAVASCRIPT@0.2, noun, adjec-noun]? + +# Official poster for film "Die Hard 2" (1990) featured the words "DIE HARDER", leading to the movie being called "Die Hard 2: Die Harder" which became a snowclone meme. +#-DIE HARD 2: ... +[verb-inf-1word] HARD 2: [$0] HARDER + +# A trolling phrase, from an unknown IRC channel in 2002, via 4chan ("HAHAHA DISREGARD THAT, I SUCK COCKS”) ; http://knowyourmeme.com/memes/disregard-that-i-suck-cocks +#-DISREGARD THAT, I... +DISREGARD THAT, I [verb-tr-inf] [noun-plural, noun-mass, adjec-noun] + +# Pantene shampoo commercial, "Don't hate me because I'm beautiful" ; http://snowclones.org/2007/09/11/dont-hate-me-because-im-y/ +#-DON'T HATE ME BECAUSE.. +DON'T [HATE@0.3, verb-tr-inf] ME BECAUSE I'M [FLUTTERBEEWINGISH@0.2, WINGISH@0.25, adjective] + +# Movie title (Doctor Strangelove) +#-DR. STRANGELOVE, OR HOW... +DR. [noun-singular, noun-mass, character], OR HOW I LEARNED TO STOP [WORRYING@0.1, verb-intr-cont] AND LOVE THE [noun-singular] + +# From balthasar_s ; the mother of all snowclones: Franz Boas (1911) "Another example of the same kind, the words for SNOW in Eskimo, may be given. ..." ; popularized by Benjamin Whorf "Science and Linguistics" (1949) "We [English speakers] have the same word for falling snow, snow on the ground, ... To an Eskimo, this all-inclusive word would be almost unthinkable....", see Geoffrey Pullum "The Great Eskimo Vocabulary Hoax" (1991) ISBN 0-226-68534-9 ; http://snowclones.org/2007/05/31/if-eskimos-have-n-words-for-snow-x-have-y-words-for-z/ +# +# An eloquent modern example is Douglas Adams, "So Long, and Thanks for All the Fish" (1984) : +# "He had read somewhere that the Eskimos had over two hundred different +# words for snow, without which their conversation would probably have +# got very monotonous. So they would distinguish between thin snow and +# thick snow, light snow and heavy snow, sludgy snow, brittle snow, snow +# that came in flurries, snow that came in drifts, snow that came in on +# the bottom of your neighbour's boots all over your nice clean igloo +# floor, the snows of winter, the snows of spring, the snows you +# remember from your childhood that were so much better than any of your +# modern snow, fine snow, feathery snow, hill snow, valley snow, snow +# that falls in the morning, snow that falls at night, snow that falls +# all of a sudden just when you were going out fishing, and snow that +# despite all your efforts to train them, the huskies have pissed on." +# +#-ESKIMOS HAVE 100 WORDS... +[noun-animal-plural] HAVE [OVER 27@0.33, 52@0.5, ABOUT A HUNDRED] WORDS FOR [noun-plural, verb-cont, noun-mass], BUT NONE FOR [noun-plural, verb-cont, noun-mass] +# From Link; Shakespeare "Julius Caesar" (1599) "Et tu, brute?" +#-ET TU, BRUTE +[character][]ET TU, [$0/remove-the/]? + +# azule: xkcd #208 +#-EVERYBODY STAND BACK. I KNOW REGULAR EXPRESSIONS. +template xkcd208a: [EVERYBODY@0.5, EVERYMOLPY], STAND BACK. I KNOW [adjective] [noun-plural].[] +template xkcd208b: [EVERYBODY@0.5, EVERYMOLPY], STAND BACK. I KNOW [verb-cont].[] +[xkcd208a, xkcd208b] + +# A parody of Catholic school scare tactics (e.g. threatening that a boy would lose his vision, etc.) rendered as a photo of a kitten captioned "every time you masturbate, God kills a kitten" in BarFly magazine (1999). The snowclone goes back at least as far as "It's A Wonderful Life" (1946) "Every time a bell rings an angel gets his wings." ; popularized in 2002 via a photo of Domo-Kuns chasing a kitten through a meadow and posted to FARK.com ; http://knowyourmeme.com/memes/every-time-you-masturbate-god-kills-a-kitten ; http://nancyfriedman.typepad.com/away_with_words/2010/12/snowclones-happen.html +#-EVERY TIME YOU... THINK OF THE KITTENS +EVERY TIME YOU [MAKE A PUN@0.2, verb-intr-inf], [RANDALL@0.3, THE GLR@0.4, character] [verb-tr-present] [noun-animal-art]. PLEASE, THINK OF THE [$3/-plural]. + +# A captioned "demotivational poster" featuring a seagull and an eagle with the line, "Excuse me sir, Can you spare a moment for Jesus Christ?" (2011), imitating a familiar opening pitch by Christian door-to-door evangelists; http://knowyourmeme.com/memes/excuse-me-sir-do-you-have-a-moment-to-talk-about-jesus-christ +#-EXCUSE ME SIR, CAN... +EXCUSE ME [SIR@0.5, MA'AM], DO YOU HAVE A MOMENT TO TALK ABOUT [character, noun-plural, noun-unique-the, noun-mass, adjec-noun]? + +# Cassius Clay (later known as Muhammad Ali) in 1963 "Float like a butterfly, sting like a bee" +#-FLOAT LIKE A... +template decr8: [verb-inf-1word] LIKE [A FLUTTERBEE@0.2, noun-singular-article], [verb-inf-1word] LIKE [A BEESNAKE@0.2, noun-singular-article][] +[decr8] + +#-FRIENDS DON'T LET FRIENDS DO DRUGS +[FRIENDS@0.5, noun-plural] DON'T LET [$0] [verb-tr-inf] [noun-plural, noun-mass, adjec-noun] + +# Randall Munroe What-If book, p. 107 +#-FROM WHAT HEIGHT... +FROM WHAT [DEPTH@0.33, DISTANCE@0.5, HEIGHT] WOULD YOU NEED TO [verb-tr-inf] [noun-article] FOR IT TO BE [verb-tr-perfect] WHEN IT [verb-tr-past] THE [noun]? + +# Song "Miracles" by Insane Clown Posse (2009) lyric "Fucking Magnets, How Do They Work?"; http://knowyourmeme.com/memes/fucking-magnets-how-do-they-work +#-FUCKING MAGNETS, HOW... +CH**RPING [noun-plural], HOW DO THEY WORK? + +# Azule: xkcd #137 +#-FUCK. THAT. SHIT. +# @Link chose the base words: CHIRP. THAT. MUSTARD. (which could be construed to be based on CHIRPING MUSTARD.) +[CHIRP@0.5, verb-tr-inf][MUSTARD@0.5, noun-singular][]*[$0/ /. /g]. THAT. [$1/ /. /g].* + +# Hugo acceptance speech by Randall Munroe (delivered by Cory Doctorow) (1024) "Gazebo. Ointment. Harpsichord. Credenza. Bungalow" +# Link OTTified this in a slightly different way +#-GAZEBO. OINTMENT. HARPSICHORD. CREDENZA. BUNGALOW. +template gazebo1: [GAZEBO@0.1, OINTMENT@0.12, HARPSICHORD@0.14, CREDENZA@0.16, BUNGALOW@0.18, noun, adjec-noun][] +[gazebo1]. [gazebo1]. [gazebo1]. [gazebo1]. [gazebo1]. + +# From the "Girls gone wild" videos, advertised heavily on late-night television starting in 1997 +#-GIRLS GONE WILD +IT'S [noun-animal-plural] GONE WILD[@0.3, %20II@0.3, %20III@0.3, %204@0.3, %205@0.3, %206@0.4, %207]! + +# Emma Lazarus "The New Colossus" (1883), a poem associated with the Statue of Liberty, "Give me your tired, your poor, / Your huddled masses yearning to breathe free" ; http://snowclones.org/2008/04/03/givebring-me-your-poor-your-tired-your-x/ +#-GIVE ME YOUR POOR, YOUR TIRED... +template laz-end-1: [verb-tr-inf] [noun-plural, noun-mass][] +template laz-end-2: [verb-intr-inf] [FREE@0.5, MOLPISHLY][] +template decr9: [BRING@0.5, GIVE] ME YOUR [adjective-negative], YOUR [adjective-negative], YOUR [adjective] [noun-plural] YEARNING TO [laz-end-1, laz-end-2][] +[decr9] + +# Randall Munroe What-If book, p. 77 +#-GIVEN HUMANITY'S CURRENT... +GIVEN [THE OTT'S@0.33, NEWPIXIA'S@0.5, OUR] CURRENT [noun-mass-positive] AND [noun-plural], IS IT POSSIBLE TO [verb-tr-inf] [adjective-article] [noun-singular]? + +# Califormia Milk Board advertisement tagline "Got Milk?" (1993) ; http://snowclones.org/2007/11/08/got-x/ +#-GOT MILK? +GOT [noun-mass, noun-mass, noun-plural, adjec-noun]? + +# various fashion journalism statements e.g. "the new neutrals", "the new black" ; http://snowclones.org/2007/07/01/x-is-the-new-y/ +#-GRAY IS THE NEW BLACK +template newblack1: [noun-singular, noun-mass, adjec-noun] IS THE NEW [noun-singular, noun-mass, adjec-noun][] +template newblack2: [noun-plural] ARE THE NEW [noun-plural][] +[newblack1, newblack2] + +# From Moby Dick (chapter 100), "Ship, ahoy! Hast seen the White Whale?" +#-HAST SEEN THE WHITE WHALE? +[CASTRAFTLE AHOY! @0.15, RAFTCASTLE AHOY! @0.05, ]HAST [SEEN@0.5, verb-tr-past] THE [adjective] [WHALPY@0.33, noun-singular]? + +# Bob Hope biography "Have tux, will travel" (1954), then "Have Gun -- Will Travel" (1950's), thence to Robert Heinlein "Have Spcaesuit..." ; http://snowclones.org/2007/07/20/have-x-will-travel/ +#-HAVE GUN WILL TRAVEL +HAVE [noun, adjec-noun], WILL [TIME-TRAVEL@0.1, TRAVEL@0.4, verb-inf] + +# "Haters gonna hate", possibly from 3LW song "Playas gon' play" (2000) which has a few other lines matching the snowclone; http://knowyourmeme.com/memes/haters-gonna-hate +# I lengthened it to "hating haters gonna hate" because it's funnier. +# %%% I've had to special-case the MOLPYING->MOLPIERS case, which I +# can do because the vocabulary is defined right here in this file. +# A better way would be to add the actor form ("HIDERS FROM CORINNE") +# as a 6th form of the verb multiclasses, then use the multiclass isomorph +# syntax [$0/-actor] to transform the words. +# To test, use 'automeme -n 100235 | grep GONNA | grep -v NEED | sort | uniq' +#-HATING HATERS GONNA HATE +[verb-tr-cont, verb-intr-cont] [$0/cont-to-actors/] GONNA [$0/-inf] + +# Doctor Who "The Eleventh Hour" (2010) original dialogue is "Hello. I'm the Doctor. Basically...run." +#-HELLO, I'M THE DOCTOR.... +HELLO, I'M [character]. BASICALLY, [RUN@0.4, verb-intr-inf]! + +# The Princess Bride (1987), Inigo Montoya's line "My name is Inigo Montoya. You killed my father. Prepare to die." +#-HELLO, MY NAME IS INIGO... +HELLO. MY NAME IS [character]. YOU [verb-tr-past] MY [noun-singular, noun-plural, noun-mass, adjec-noun]. PREPARE TO [DIE@0.4, verb-intr-inf]. + +# "Hello Yes, this is dog", a LOLcat image of a black lab with a telephone receiver; http://knowyourmeme.com/memes/yes-this-is-dog +#-HELLO? YES, THIS IS DOG +HELLO? YES, THIS IS [noun-singular, noun-mass, character, adjec-noun] + +# From Link; Carly Rae Jepsen song "Call me Maybe" (2012), "Hey, I just met you, and this is crazy, But here's my number, so call me maybe" +#-HEY, I JUST MET YOU... +HEY, I JUST [verb-tr-past] YOU, AND THIS IS CRAZY / BUT HERE'S MY [noun], SO [verb-tr-inf] ME MAYBE + +# HES, OTT:2090:15|#p3646617, "'Hide the OTTer' sounds like a fun game. +#-HIDE THE OTTER SOUNDS... +"[verb-tr-inf] THE [noun]" SOUNDS LIKE [A FUN@0.6, A MOLPISH@0.4, adjective-article] [HOTDOG@0.4, GAME@0.6, noun]. + +# Randall Munroe What-If book, p. 174 +#-HOW CLOSE WOULD YOU HAVE TO BE... +HOW CLOSE WOULD YOU HAVE TO BE TO A SUPER[noun] TO GET [adjective-article] DOSE OF [noun-animal] [noun-mass]? + +# Randall Munroe What-If book, p. 91 +#-HOW DANGEROUS IS IT... +regex remove-space-hyphen: /{- }//gi +[place-name][noun-mass][$1/remove-space-hyphen/][]HOW [adjective] IS IT, REALLY, TO [BE@0.5, verb-inf] [$0/-pr-in] [$0/-art] [$0/remove-the/] DURING [$2/add-article/][STORM@0.5, FLOOD]? + +# "How do I shot web?" on a picture of Spider-Man, probably originating on Something Awful forums; derivatives often deliberately lack prepositions; http://knowyourmeme.com/memes/how-do-i-shot-web +#-HOW DO I SHOT WEB? +HOW DO I [verb-tr-past] [noun-singular, noun-plural, noun-mass, character, adjec-noun]? + +# Randall Munroe What-If book, p. 179 +#-HOW FAST CAN YOU HIT... +HOW [adverb] CAN YOU [verb-tr-inf] A [noun-singular] WHILE [verb-cont] AND [verb-inf]? + +# Randall Munroe What-If book, p. 86 +#-HOW FAST WOULD I HAVE TO BIKE... +HOW [adverb] WOULD I HAVE TO [verb-inf] FOR MY [noun] TO [verb-inf] THE WAY [noun-singular-article] [verb-present] WHILE [verb-cont]? + +# Randall Munroe What-If book, p. 112 +#-HOW HARD WOULD A PUCK... +[place-name][$0/-pr-in][]HOW [adverb] WOULD [noun-article] HAVE TO BE [verb-tr-perfect] TO BE ABLE TO [verb-tr-inf] THE [noun-animal] [IMMEDIATELY@0.33, STRAIGHT@0.5, BACKWARD] [$1/in-to-into/] [$0]? + +# Randall Munroe What-If book, p. 168 +#-HOW HIGH CAN A HUMAN... +HOW [FAST@0.25, FAR@0.33, HIGH@0.5, LONG] CAN A [noun-animal] [verb-tr-inf] SOMETHING? + +# Yahoo answers "How is babby formed? How girl get pragnent"; http://knowyourmeme.com/memes/how-is-babby-formed +#-HOW IS BABBY FORMED? +HOW IS [noun-singular, noun-mass, adjec-noun] FORMED? HOW [noun-singular, noun-mass, character, adjec-noun] GET [PRAGNENT@0.33, adjective]? + +# Randall Munroe What-If book, p. 78 +#-HOW LONG COULD A NUCLEAR... +[place-name][]HOW [LONG@0.5, FAR] COULD [adjective-article] [noun] [verb-inf] [$0/-pr-in] [$0]? + +# Randall Munroe What-If book, p. 143 +#-HOW MUCH FORCE POWER... +template yoda1: HOW MUCH [adjective, noun-animal] [noun-mass] CAN [character] [verb-tr-inf]?[] +template yoda2: HOW MANY [adjective, noun-animal] [noun-plural] CAN [character] [verb-tr-inf]?[] +[yoda1, yoda2] + +# Randall Munroe What-If book, p. 204 +#-HOW QUICKLY WOULD THE OCEANS... +HOW [adverb] WOULD THE [SEA@0.25, OCEANS@0.3, noun-plural] [verb-tr-inf] IF [adjective-article] [noun-mineral] 3 Q IN [LENGTH@0.33, SIZE@0.5, RADIUS] WERE CREATED IN THE MIDDLE OF [place-name], THE [adjec-super] PART OF THE [$1]? HOW WOULD [place-name] CHANGE AS THE [noun-mass] WAS BEING [$2/-perfect]? + +# Video game "Vega Strike", a line attributed to the Rlaan: "Hulls pop like vibrant seeds. Splashing photons in a void. I am sticky." +#-HULLS POP LIKE VIBRANT SEEDS... +# %%% right now if it chooses "A VOID" it gets what ever -pr-in belongs to the (unused) [place-name]. For now I don't really care. +[place-name][][noun-plural] POP LIKE [VIBRANT@0.15, adjective] [SEEDS@0.25, noun-plural]. SPLASHING [noun-plural] [$0/-pr-in] [A VOID@0.5, $0]. I AM [STICKY@0.25, adjective]. +# 4chan /b/ (2008) "I accidentally 93MB of .rar files", derivatives omit the verb; http://knowyourmeme.com/memes/i-accidentally +#-I ACCIDENTALLY 93MB OF... +I ACCIDENTALLY [noun-singular-article], IS THIS [BAD@0.33, DANGEROUS@0.5, ENDISH]? + +# from Link, v 2.3 (unknown origin) +#-I AM BEST... +I AM *[BEST@0.3, MOLPIEST@0.3, adjec-est] [noun-singular, noun-mass, adjec-noun]*, THE [$0] [$1] EVER! + +# Jordan Sparks (1971) lyric "I am woman, hear me roar"; http://en.wikipedia.org/wiki/I_Am_Woman +#-I AM WOMAN +I AM [character], HEAR ME [ROAR@0.5, verb-intr-inf] + +# Tupac Shakur, interview on KMEL (1996), "I didn't choose the thug life, the thug life chose me." +#-I DIDN'T CHOOSE... +I DIDN'T CHOOSE THE [noun-singular, noun-mass] LIFE; THE [$0] LIFE CHOSE ME + +# "Most interesting man" campaign for Dos Equis beer "I don't always drink beer, but when I do, I prefer Dos Equis -- Stay thirsty, my friends."; http://knowyourmeme.com/memes/the-most-interesting-man-in-the-world +#-I DON'T ALWAYS DRINK... +template doseq1: [verb-intr-inf][] +template doseq2: [verb-tr-inf] [noun-mass, noun-plural, adjec-noun][] +I DON'T ALWAYS [doseq1, doseq2], BUT WHEN I DO, I [PREFER@0.2, verb-tr-inf] [noun-plural, noun-mass, adjec-noun] + +# azule: xkcd #595 +#-I DON'T THINK ARC-WELDING... +I DON'T THINK [verb-tr-cont] [noun-singular-article] COUNTS AS [SEXY@0.3, adjective-positive]. + +# azule: xkcd #616 +#-I DON'T KNOW WHAT YOU... +I DON'T KNOW WHAT YOU JUST SAID BECAUSE I WAS THINKING ABOUT [verb-intr-cont, noun-mass, place-name, noun-unique, noun-plural]. + +# Randall Munroe What-If book, p. 102 +#-IF AN ASTEROID... +[place-name][$0/-art][]IF [$1] [$0/remove-the/] WERE VERY [adjective] BUT SUPER[adjective], COULD YOU REALLY [verb-inf] [$0/-pr-in] [$1/some-to-them/] LIKE [character]? + +# azule: xkcd #1317 +#-I FEEL PARALYZED BY OVER... +I FEEL PARALYZED BY [OVERWHELMING EXISTENTIAL DREAD@0.33, THE SADNESS@0.5, T**** ****D]. ...AND YET FOR SOME REASON I'M ~*REALLY*~ EXCITED ABOUT [verb-intr-cont, noun-plural, verb-tr-cont, noun-mass]? + +# Randall Munroe What-If book, p. 61 +#-IF EVERY HUMAN SOMEHOW SIMPLY... +[place-name][]IF EVERY [MOLPY@0.33, OTTER@0.5, HUMAN] SOMEHOW SIMPLY [verb-past] COMPLETELY [$0/-pr-out] [$0], HOW LONG WOULD IT BE BEFORE THE LAST [adjective] [noun] WOULD [verb-inf]? + +# Randall Munroe What-If book, p. 114 +#-IF EVERYONE ON THE PLANET STAYED... +[place-name][]IF [EVERYONE@0.5, EVERYMOLPY] [$0/-pr-in] [$0] [verb-past] AWAY FROM EACH [OTHER@0.5, OTTER] FOR A [FEW@0.5, COUPLE OF] [noun-interval-plural], WOULDN'T THE COMMON [noun] BE [verb-tr-perfect]? + +# Randall Munroe What-If book, p. 84 +#-IF EVERYONE PUT LITTLE TURBINE... +IF [EVERYONE@0.5, EVERYMOLPY] PUT LITTLE [noun-mass] [noun-plural] ON THE [noun-plural] OF THEIR [noun-plural] AND [noun-plural], HOW MUCH [noun-mass] WOULD WE [verb-tr-inf]? WOULD WE EVER [$7] ENOUGH [$6] TO [verb-tr-inf] THE [adjec-noun] OF THE [$2]? + +# Randall Munroe What-If book, p. 27 +#-IF EVERY PERSON ON EARTH... +[place-name][]IF EVERY [PERSON@0.2, MOLPY@0.5, OTTER] [$0/-pr-in] [$0] [AIMED@0.3, verb-tr-past] A [noun] AT [noun-the] AT THE SAME TIME, WOULD IT CHANGE [adjec-noun]? + +# Star Wars IV: A New Hope (1977) Darth Vader's line "I find your lack of faith disturbing" +#-I FIND YOUR LACK OF FAITH... +I FIND YOUR LACK OF [noun-plural, noun-mass, adjec-noun] DISTURBING + +# Motown song "If loving you is wrong, I don't want to be right" (1972); http://snowclones.org/2007/10/31/if-x-is-wrong-i-dont-want-to-be-right/ +#-IF LOVING YOU... +IF [verb-cont, verb-cont, verb-cont, verb-cont, character, noun-mass, noun-singular-the] IS WRONG, I DON'T WANT TO BE RIGHT +IF [verb-tr-cont] [YOU@0.3, character, noun-mass, noun-plural, noun-singular-article, adjec-noun] IS WRONG, I DON'T WANT TO BE RIGHT + +# Randall Munroe What-If book, p. 83 +#-IF MY PRINTER COULD... +IF MY [noun] COULD LITERALLY [verb-tr-inf] [noun-mass, noun-plural], WOULD IT HAVE [A SEAISH@0.5, THAT BIG AN] EFFECT ON [place-name]? + +# 1977 film based on H.G.Wells "Empire of the Ants"; original quote is "I, for one, welcome our new insect overlords", which the oft-cited Simpsons episode was referencing; http://knowyourmeme.com/memes/i-for-one-welcome-our-new-insect-overlords +#-I, FOR ONE, WELCOME OUR... +I, FOR ONE, WELCOME OUR NEW [noun-singular] OVERLORDS + +# "Billy Madison" (1995) "If peeing in your pants is cool, consider me Miles Davis." +#-IF PEEING IN YOUR PANTS... +IF [verb-intr-cont] IN [YOUR PANTS@0.3, place] IS [adjective], [THEN I'M@0.5, CONSIDER ME] [character, adjective, verb-tr-perfect]. +IF [verb-tr-cont] YOUR [noun-plural] IS [adjective], [THEN I'M@0.5, CONSIDER ME] [character, adjective, verb-tr-perfect]. + +# Randall Munroe What-If book, p. 77 +#-IF PEOPLE HAD WHEELS... +IF [noun-animal-plural] HAD [noun-mineral-plural], AND COULD [verb-inf], HOW WOULD WE DIFFERENTIATE THEM FROM [noun-plural]? + +#ZoomanSP [OTT:2220:8|#p3731295], "If square-glasses guy is the bftf representation of balthasar_s, who is the OTT equivalent of kxa?" +#-IF SQUARE-GLASSES GUY IS THE BFTF.... +IF [character] IS THE [BFTF@0.2, place-noart, noun-mass] REPRESENTATION OF [character], WHO IS THE [OTT@0.2, place-noart, noun-mass] EQUIVALENT OF [character]? + +# Randall Munroe What-If book, p. 183 +#-IF TWO IMMORTAL PEOPLE... +template whatif183: [place-name][][adjective-article] [noun]LIKE [$0/remove-the/][] +[whatif183][]IF TWO [adjective] [noun-plural] WERE [PLACED@0.3, verb-tr-perfect] [ON@0.5, BY] [RIVAL@0.33, OPPOSITE@0.5, OPPOSING] [noun-plural] OF [$0/postproc-some/], HOW LONG WOULD IT TAKE THEM TO [verb-tr-inf] EACH OTHER? A KILO[noun-interval]? A MEGA[noun-interval]? TWENTY-SEVEN UMPTY[noun-interval]? + +# OTT-specific meme by @Link +# Captioned photo of a bear (with snow on its face) and caption "I fucking love cocaine" (2009); http://knowyourmeme.com/memes/cocaine-bear +#-I FUCKING LOVE... +I CH**RPING LOVE [noun-plural, noun-mass, adjec-noun] + +# azule, An OTT running gag starting at OTT:49:39#p3305676 +#-I WAITED A HALF HOUR... (not "I WAITED HALF AN HOUR...) +*I [WAITED@0.6, verb-tr-past] HALF [AN HOUR@0.1, noun-interval-art] FOR ONE [DARKENING@0.5, adjective, verb-tr-cont] [PIXEL@0.5, noun-singular].* + +# azule: xkcd #349 +#-IF WE MAKE IT BACK... +IF WE MAKE IT BACK ALIVE, YOU'RE NEVER [verb-tr-cont] ANYTHING AGAIN. + +# azule: xkcd #180 +#-IF YOU DIE IN CANADA, ... +IF YOU [DIE@0.3, verb-intr-inf] IN [place], YOU [$0] IN *REAL LIFE*! + +# Randall Munroe What-If book, p. 73 +#-IF YOU SUDDENLY BEGAN... +IF YOU SUDDENLY BEGAN [verb-cont] STEADILY AT 1 [CUEBALL@0.5, NEWPAGE] PER [noun-interval], HOW EXACTLY WOULD YOU [verb-inf]? WOULD YOU [verb-inf] OR [verb-inf] FIRST? + +# Azule: xkcd #1171 +# Jay-Z song "99 Problems" (2004) lyric "If you're havin' girl problems I feeb bad for you son, I've got 99 problems but a b*tch ain't one" +#-I GOT 99 PROBLEMS BUT... +I GOT 99 [PROBLEMS@0.7, noun-animal-plural], SO I USED [noun-plural]. NOW I HAVE 100 [$0]. + +# @mrob27: The regexp here removes the article A or AN from the noun-singular-article +# "I can has X; you can has my X" has countless examples, many in captioned photos in the style of the original "I can has cheezburger" genre, linked to the creation of the website by that name ( icanhas.cheezburger.com ) in reference to a captioned cat (2007); the lolcat style had already been popular on 4chan; http://en.wikipedia.org/wiki/I_Can_Has_Cheezburger%3F +#-I HAS X; YOU CAN HAS MY X +I HAS [noun-singular-article]. YOU CAN HAS MY [$0/remove-article/] + +# "I have reported you to AOL for stealing pictures, as it is a crime." goes back to at least 2005 ( http://www.neowin.net/forum/topic/360276-put-a-pic-on-my-msn-dis-pic-illigal/ ) and is linked to the "AOL Police" meme, an old running gag. ; http://wiki.unmod.org/index.php?title=4chan#AOL_Police ; http://www.lurkmore.com/wiki/AOL_Police +#-I HAVE REPORTED YOU... +I HAVE REPORTED YOU TO [character] FOR [STEALING@0.5, verb-tr-cont] [noun-plural, noun-mass] AS IT IS A CRIME + +#-I HATE THIS F*CK*NG PLACE, #commented, because I don't understand, why this, +#[all-vocab-i] [all-vocab-h] [all-vocab-t] [all-vocab-f] [all-vocab-p] + +# azule: xkcd #821 +#-I KNOW IT'S NATURAL AND ALL... +[place-name][]I KNOW IT'S NATURAL AND ALL, BUT I REALLY WISH [noun-plural] [$0/-pr-in] [$0] WOULDN'T TRY TO [verb-tr-inf] ME. + +# Azule: xkcd #405 +#-I *LIKE* MY HAT +I *LIKE* MY [HAT@0.25, noun]. + +# Eddie Izzard "Glorious" stand-up act (1997) "I like my women like I like my coffee... covered in beeees!", but clearly originating much earlier ; http://en.wikiquote.org/wiki/Eddie_Izzard +#-I LIKE MY WOMEN... +I LIKE MY [MEN@0.25, WOMEN@0.33, noun-plural, noun-mass, adjec-noun] LIKE I LIKE MY [noun-plural, noun-mass]: COVERED IN [noun-plural, noun-mass, adjec-noun] + +# LOLcat caption "I made you a cookie, but I eated it"; http://knowyourmeme.com/memes/i-made-you-a-cookie-but-i-eated-it +#-I MADE YOU A COOKIE... +I MADE YOU [noun-singular-article], BUT I [verb-tr-past] IT + +# azule: xkcd #481 +#-I'M A MORON. +I'M [noun-singular-article]. I... I DIDN'T KNOW. + +# Azule: xkcd #974 +#-I'M DEVELOPING A SYSTEM... +I'M DEVELOPING A SYSTEM TO [PASS YOU@0.3, verb-tr-inf] ARBITRARY [CONDIMENTS@0.2, noun-mineral-plural]. + +# A variant of "when I say X I really mean Y" ; http://snowclones.org/2007/03/30/when-i-say-x-what-i-really-mean-is-y/ +#-I'M GOING TO ... +I'M GOING TO [verb-tr-inf] [MY@0.5, THIS] [noun-singular], AND BY '[$0]' I MEAN '[verb-tr-inf]', AND BY '[$1] [$2]' I MEAN '[noun-mass, noun-plural, adjec-noun]'. + +# Image of Dragonball Z character "Cell" with caption "IMMA CHARGIN MAH LAZER"; http://knowyourmeme.com/memes/shoop-da-whoop-im-a-firin-mah-lazer +#-IMMA CHARGIN MAH LAZER +IMMA CHARGIN MAH [noun-singular, noun-plural, noun-mass, adjec-noun] + +# Starcraft screenshot (2003) with words "im in ur base killing all ur d00dz"; also "I'm in your base killing your dudes" or similar; http://knowyourmeme.com/memes/in-ur-base ; http://snowclones.org/2007/10/19/im-in-ur-x-ying-ur-z/ +#-I'M IN UR BASE... +I'M IN [YOUR@0.3, UR@0.5, YR] [noun-singular, noun-mass, adjec-noun], [verb-tr-cont] [$0] [noun-plural, noun-mass, adjec-noun] + +# Robert Young in an aspirin advertisement (1970s), or Peter Bergman in a Vicks Formula 44 advertisement (1986) "I'm not a doctor, but I play one on TV" ; http://snowclones.org/2007/08/17/im-not-an-x-but-i-play-one-on-tv/ +#-I'M NOT A DOCTOR, BUT... +[place-name][]I'M NOT [noun-or-actor], BUT I [PLAY@0.33, verb-tr-inf] ONE [$0/-pr-in] [$0]. + +# azule: xkcd #178 +#-I'M NOT REALLY INTO... +I'M NOT REALLY INTO [noun-plural, noun-mass]. + +# 2001: A Space Odyssey (1968) "I'm sorry, Dave. I'm afraid I can't do that." +#-I'M SORRY DAVE, I'M... +I'M SORRY, [character]. I'M AFRAID I CAN'T [DO@0.15, verb-tr-inf] THAT. + +# Superbowl XLIV (2015) halftime show Katy Parry backup dancer in shark costume flubbed moves and became a meme; "I'm such a Left Shark when it comes to dancing."; http://knowyourmeme.com/memes/super-bowl-xlix-halftime-shark +#-I'M SUCH A LEFT SHARK WHEN IT... +#I'M SUCH A LEFT [RAPTORSHARK@0.5, noun-animal-1word] WHEN IT COMES TO [verb-cont-1word] + +# alt-text of xkcd 1450 +#-I'M WORKING TO BRING ABOUT +I'M WORKING TO [CREATE@0.25, BRING ABOUT@0.33, verb-tr-inf] [adjective-article] [noun] THAT WILL ETERNALLY [verb-tr-inf] [EVERY@0.5, ANY][ONE@0.5, MOLPY] WHO [FAILS@0.5, FAILED] TO [verb-tr-inf] THE [char-1word]'S [noun-animal] PEOPLE. + +# From Link, v 2.3 +# LOLspeak used in forum discussions when the speaker has succeeded in doing something (typically making the post) before some anticipated event, such as the thread being locked or removed by a moderator; in the latter case "in b4 404" is common. ; http://knowyourmeme.com/memes/in-b4 +#-IN B4 404 +IN B4 [503@0.2, 408@0.25, adjective] [MUSTARD@0.2, SADNESS@0.25, noun-singular, noun-plural, noun-mass, adjec-noun] + +# azule: xkcd #714 +#-IN MY PORN, PEOPLE F*** +IN MY [PORN@0.3, SLASH-FICTION@0.2, noun], PEOPLE *[verb-inf]*. + +# Russian reversal jokes (http://en.wikipedia.org/wiki/Russian_reversal) from the 1960's; later associated with Yakov Smirnoff, e.g. Miller Lite ad (1985) "In Russia, Party always finds you."; http://knowyourmeme.com/memes/in-soviet-russia +#-IN SOVIET RUSSIA... +[place-russia-name, place-russia-name, place-russia-name, place-name][][$0/-pr-in] [$0/sovietize/], [noun-singular, noun-mass, character, adjec-noun] [verb-tr-present] *YOU* + +# "Alien" (1979) "In space, no one can hear you scream." ; http://snowclones.org/2007/07/05/in-space-no-one-can-hear-you-x/ +#-IN SPACE, NO ONE CAN HEAR... +[place-name][][$0/-pr-in] [$0], [NO-ONE@0.5, NOMOLPY] CAN [SEE@0.5, HEAR] YOU [verb-inf]. + +# Beginning in the 1950's, if not earlier, products were marketed by an appeal to convenience. This meme came from ad copy for products that are dehydrated, and prepared by adding the water, e.g. "Instant coffee -- just add water". +#-INSTANT COFFEE -- JUST... +INSTANT [noun-singular, noun-plural, noun-mass, adjec-noun], JUST ADD [noun-plural, noun-mass, adjec-noun] + +# azule: xkcd #325 +# %%% The 'noun-singular-negative' is currently orphaned from the rest of the noun system; this is the only meme that attempts to use it. +#-INSTEAD OF OFFICE... +template xkcd325a: INSTEAD OF [noun-mass, noun-singular], [PACKAGE@0.5, noun-singular] CONTAINED [noun-mass-negative, noun-singular-negative]. WOULD NOT [BUY@0.5, verb-intr-inf] AGAIN.[] +template xkcd325b: [PACKAGE@0.5, noun-singular] CONTAINED [noun-mass-positive, noun-singular]. WOULD [BUY@0.5, verb-intr-inf] AGAIN[] +[xkcd325a, xkcd325b] + +# Randall Munroe What-If book, p. 200 +#-IN THE MOVIE 300 THEY... +template moviename1: [noun, verb-cont][] +template moviename2: [noun, verb-cont] [2@0.2, III@0.25, 4@0.33, 5@0.5, VI][] +template moviename3: [adjective-article] [noun, verb-cont-1word][] +template moviename4: THE [adjective, verb-cont-1word] [noun, adjec-noun][] +template moviename5: [verb-cont] [preposition] [noun-plural, noun-mass][] +template moviename6: [noun-article] [OF@0.4, preposition] [place, noun-plural, noun-mass][] +template moviename: [moviename1, moviename2, moviename3, moviename4, moviename5, moviename6][] +IN THE [OTHERCOMIC@0.33, MOVIE@0.5, HOTDOG] *"[moviename]"* THEY [verb-tr-inf] [noun-plural] INTO [place-name] AND THEY SEEMINGLY [verb-tr-inf] [noun-unique-the]. IS THIS POSSIBLE, AND HOW MANY [$3] WOULD IT TAKE? +# Based on Neil_Boekend, OTT:2094:27#p3648403 +#-IN YOUR MIND, REPLACE... +IN YOUR MIND, REPLACE [noun] WITH [noun]. + +# From Link; Doctor Who episode "The Deadly Assassain" (1976) Tom Baker "I reject your reality and substitute my own" ; later requoted by 1984 film "The Dungeonmaster" and TV serires "Mythbusters" +#-I REJECT YOUR REALITY... +I REJECT YOUR [noun, noun-plural, adjec-noun] AND SUBSTITUTE MY OWN + +# Friends (1996) character Phoebe "I see what you did there"; http://knowyourmeme.com/memes/i-see-what-you-did-there +# also seen as a caption on the same Futurama image of Fry described in the "Not sure if..." snowclone. +#-I SEE WHAT YOU DID THERE +I SEE WHAT [YOU@0.5, character] [verb-tr-past] THERE + +# LOLcat caption "Is it can be hugs tiem now plees?"; http://knowyourmeme.com/memes/is-it-can-be-hugs-tiem-now-plees +#-IS IT CAN BE HUGS... +IS IT CAN BE [noun-singular, nounz] TIEM NAO PLEES? + +# Randall Munroe What-If book, p. 68 +#-IS IT POSSIBLE TO BUILD A JETPACK... +[verb-cont][]IS IT POSSIBLE TO [verb-tr-inf] [noun-article] USING [DOWNWARD@0.5, UPWARD]-[$0/hyphenate/] [noun-plural]? + +# Randall Munroe What-If book, p. 153 +#-IS THERE ENOUGH ENERGY... +[place-name][]IS THERE ENOUGH [noun-mass] TO [verb-tr-inf] THE ENTIRE CURRENT [noun-animal] POPULATION [$0/-pr-out] [$0]? + +# from azule, based on xkcd #1190 frame 833 +#-IT CAN DO WHATEVER IT WANTS... +IT CAN DO WHATEVER IT WANTS. IT'S [THE SEA@0.5, noun-singular-the, noun-mass]. + +# 4chan /b/ user (2007) "I think halo is a pretty cool guy. Eh kills aleins and doesnt afraid of anything."; http://knowyourmeme.com/memes/pretty-cool-guy +#-I THINK HALO IS A PRETTY... +I THINK [character] IS A PRETTY [TREEISH@0.2, MOLPISH@0.3, adjective] [XUY@0.1, noun-singular]. 'XEH [verb-tr-present] [noun-plural, noun-mass, character, adjec-noun] AND DOESN'T [ENDISH@0.3, AFRAID OF] ANYTHING + +# From @Link, in vers. 3.4 +# Probably from Mario videogames, there are several examples, such as "It's a-me, Luigi, and you-a gonna die!" +# %%% would like to add random short phrases here, perhaps similarly to in the boom-de-yada meme +#-IT'S-A-ME, LUIGI +#IT'S-A-ME, [character]! + +# The Adventures of Superman (TV series, 1952) "Look! Up in the sky! It's a bird. / It's a plane. / It's Superman!" +#-IT'S A PLANE +IT'S [noun-singular-article]. IT'S [noun-singular-article]. IT'S *SUPER[noun-singular-1word]!* + +# Pokemon videogames (1996) ; http://knowyourmeme.com/memes/its-super-effective +#-IT'S SUPER EFFECTIVE +template pokemon1: [PIKACHU@0.2, character] USED [noun-mass, verb-inf]! [IT'S SUPER EFFECTIVE!@0.5, IT'S NOT VERY EFFECTIVE...@0.7, ...BUT IT FAILED!][] +template pokemon2: [LINK@0.2, character] USED EMERGENCY [KITTEN@0.2, LINK@0.25, noun]! IT'S A SUPER [$1]![] +[pokemon1, pokemon2] + +# Joseph Barker (1854) "there are tortoises all the way down"; Stephen Hawking (1988) attributing to Bertrand Russell "But it's tortoises all the way down!"; and many others; http://snowclones.org/2011/01/26/its-x-all-the-way-down/ ; http://en.wikipedia.org/wiki/Turtles_all_the_way_down +# "except that every 13th and 14th..." from @mrob27 at OTTercon +#-IT'S TURTLES ALL... +template turtle1: IT'S [noun-plural, noun-mass, adjec-noun] ALL THE WAY DOWN[] +template turtle2: IT'S [noun-plural] ALL THE WAY DOWN, EXCEPT THAT EVERY 13TH AND 14TH ONE IS [noun-singular-article][] +[turtle1@0.7, turtle2]. +# "It's over. is finished" possibly imitates Frodo's "It's Over" line after the climax of his quest in The Lord of the Rings. +#-IT'S OVER. +IT'S OVER. [noun-singular, noun-mass, character, adjec-noun] IS FINISHED. + +# Descartes (1637); http://snowclones.org/2011/01/05/i-x-therefore-i-am/ +#-I THINK, THEREFORE I AM +I [THINK@0.5, verb-intr-inf], THEREFORE I [verb-intr-inf] + +# Elder Scrolls V: Skyrim (2011) "I used to be an adventurer like you, then I took an arrow in the knee."; http://knowyourmeme.com/memes/i-took-an-arrow-in-the-knee +#-I USED TO BE AN... +I USED TO BE [noun-singular-article] LIKE YOU, THEN I TOOK [noun-singular-article] IN THE KNEE + +# Pirates of the Caribbean: Dead Man's Chest (2008) line "I got a jar of dirt! I got a jar of dirt! and guess what's inside it!" ; http://knowyourmeme.com/memes/ive-got-a-jar-of-dirt +#-I'VE GOT A JAR OF DIRT... +I'VE GOT A JAR OF [noun-plural, noun-mass, noun-mass]! I'VE GOT A JAR OF [$0]! AND GUESS WHAT'S INSIDE IT! + +# "A Few Good Men" (1992 film) original lines are "I want the truth! / You can't handle the truth." ; http://knowyourmeme.com/memes/you-cant-handle-the-truth +#-I WANT THE TRUTH... +"I WANT THE [noun-singular, noun-mass, adjec-noun]!" / "YOU CAN'T HANDLE THE [$0]!" + +# Doctor Who (reboot) episode "The Eleventh Hour" (2010) original dialogue is "Yeah, it's cool. Bow ties are cool." ; http://knowyourmeme.com/memes/bow-ties-are-cool +#-I WEAR A BOWTIE.. +I WEAR [noun-animal-art, noun-mineral-art] NOW. [$0/-plural] ARE [COOL@0.5, TREEISH@0.5, MOLPISH]. + +# "I went to a fight and a hockey game broke out" +#-I WENT TO A FIGHT AND A HOCKEY GAME BROKE OUT. +template hgevent1: [place-name][][$0/-art] [$0/remove-the/][] +template hgevent2: [noun-article]-[verb-cont-1word][] +I WENT [TO SEE@0.5, TO] [hgevent1@0.5, hgevent2] AND [noun-article] [ALMOST @0.5, ]BROKE OUT. + +# Monty Python "Hungarian Phrasebook" sketch, John Cleese: "I will not buy this record, it is scratched." +#-I WILL NOT BUY THIS... +I WILL NOT [verb-tr-inf] THIS [noun-singular, noun-mass, adjec-noun] -- IT IS [noun-singular-article, noun-mass, adjective, character, adjec-noun] + +# Azule: An OTT running gag started around NP49 +#-I WAITED HALF AN HOUR... +*I [WAITED@0.6, verb-tr-past] HALF [AN HOUR@0.1, noun-interval-art] FOR ONE [DARKENING@0.7, verb-tr-cont] [PIXEL@0.5, noun-singular].* + +# azule: xkcd #1 +#-I WONDER WHERE I'LL FLOAT NEXT +I WONDER WHERE I'LL [verb-intr-inf, verb-tr-inf] NEXT? + +# from webcomic "Toothpaste For Dinner" via 4chan (2006); original quote was "JESUS CHRIST IT'S A LION! GET IN THE CAR!" +#-JESUS CHRIST IT'S A LION... +GREAT LORD RANDALL IT'S [noun-singular-article] GET IN THE [CAR@0.33, CASTRAFTLE@0.15, RAFTCASTLE@0.05, noun-singular, noun-mass] + + +# "Keep calm and carry on", British WWII public safety poster by the Ministry of Information; http://knowyourmeme.com/memes/keep-calm-and-carry-on +#-KEEP CALM AND CARRY ON +template decr10: KEEP CALM AND [MOLPY@0.2, verb-inf-1word] ON[] +template decr11: REMAIN [CALM@0.2, adjective] AND [verb-inf-1word] [noun-mass, noun-plural][] +[decr10] +[decr11] +# Invented by mrob27, just as an excuse to use the [moviename] template more often +#-LEADING AT THE BOX OFFICE +LEADING AT THE OFFICE BOX THIS WIP: 1. *[moviename]* , 2. *[moviename]* , 3. *[moviename]* , 4. *[moviename]* , 5. *[moviename]* + +# Randall Munroe What-If book, p. 126 +#-LET'S ASSUME THERE'S LIFE ON... +[place-name][]LET'S ASSUME THERE'S [LIFE@0.3, noun-animal-art] [$0/-pr-in] THE NEAREST [adjective] [$0/remove-the/] AND THAT XEY HAVE [noun-mass] COMPARABLE TO OURS. IF THEY LOOKED AT OUR [$4] RIGHT NOW, WHAT WOULD THEY SEE? + +# Wizard of Oz (1939); http://snowclones.org/2007/05/22/x-y-and-z-oh-my/ +# A lot of the substitutions don't fit the original meter and thus make for a poor snowclone; so you might want to disable this one. +#-LIONS AND TIGERS AND... +[noun-plural] AND [noun-plural] AND [noun-plural, noun-mass, adjec-noun], OH MY! + +# azule: xkcd #703 +#-LISTEN UP! THE FIRST RULE... +*LISTEN UP!* THE FIRST RULE OF [REDUNDANCY@0.2, noun, adjec-noun] CLUB IS THE FIRST RULE OF [$0] CLUB. + +# "LOLI HAET PIZZA" (presumed a typo of "LOL I haet pizza"), later "LOEV" also became common, sometimes appears as an image caption showing an anime girl and the thing they LOEV (or HAET), or a boy with the word SHOTA instead of LOLI ; https://encyclopediadramatica.es/Loli_Haet_Pizza +#-LOLI HAET PIZZA +[LOLI@0.3, SHOTA@0.2, character] [LOEV@0.8, HAET] [noun-singular, noun-plural, noun-mass, character, adjec-noun] + +# Poem "Ozymandias" by Percy Bysshe Shelley (1818), "My name is Ozymandias, king of kings: Look on my works, ye Mighty, and despair!" +#-LOOK ON MY WORKS, YE... +[noun-animal-art, noun-mineral-art][]MY NAME IS [character], [$0/remove-article/] OF [$0/-plural]: LOOK ON MY [noun-plural, noun-mass], YE [adjective, verb-cont-1word], AND [DESPAIR@0.25, verb-intr-inf]! +template decr12: LOOK ON MY [noun-plural, noun-mass], YE [adjective, verb-cont-1word], AND [DESPAIR@0.25, verb-intr-inf]![] +[decr12] + +# TV Show "Firefly" episode "The Message" (2003) character Hoban 'Wash' Washburne quote "Man walks down the street in that hat, people know he's not afraid of anything." +#-MAN WALKS DOWN THE STREET... +[place-name][][OTTER@0.5, MOLPY] [WALKS@0.3, verb-present] DOWN [$0/-art] [$0/remove-the/] IN THAT [BRAINSLUG@0.2, SAFETY HAT@0.25, HAT@0.33, noun], PEOPLE KNOW XE'S NOT AFRAID OF ANYTHING. + +# Mattell Teen Talk Barbie (1992), a talking doll that says "Math class is tough." and "Want to go shopping? Okay, meet me at the mall." ; http://snowclones.org/2008/02/19/x-is-hard-let’s-go-shopping/ +#-MATH IS HARD, LET'S GO SHOPPING +template decr13: [verb-cont] IS HARD, LET'S GO [verb-cont].[] +[decr13] + +# By Link, a running joke in the OTT originating with early theories explaining xkcd 1190 "Time" +# %%% azule: Yes, I meant to say "running joke in the OTT", not "OTC" :) +#-MAYBE MEGAN IS PREGNANT... +MAYBE [character] [IS PREGNANT@0.2, HAS CANCER@0.25, HAD AN ABORTION@0.33, GOT MARRIED@0.5, GOT DIVORCED]! MAYBE [THE OTC@0.2, noun-singular-the, noun-mass, place] IS A METAPHOR FOR [THIS@0.1, THAT@0.1, noun-plural, noun-mass]! + +# Possibly "maximum volume yields maximum results" +#-MAXIMUM VOLUME YIELDS... +MAXIMUM [noun-plural, noun-mass, adjec-noun] YIELDS MAXIMUM [noun-plural, noun-mass, adjec-noun] + +# From japanese.stackexchange.com/questions/8125/are-snowclones-common-in-japanese +# 見ろ! 人がゴミのようだ! Look! People, seems like waste/garbage! +# 見ろ! X が Y のようだ! Look! X seems like Y! +#-MIRO! HITOGAGOMINOYOUDA! + +# Angelastic, OTT:753:4|#p3370725 "Molpy molpy molpy molpy molpy molpy molpy molpy grapevine grapevine" imitating Jonto Picking's "Badgers" (see http://en.wikipedia.org/wiki/Badgers_(animation) ); it was soon lengthened to 12 "molpy"s to fit the song, now usually referencing @yappobiscuit's parody at OTT:757:14#p3371215 +#-MOLPY MOLPY MOLPY... GRAPEVINE +[MOLPY@0.2, noun-1word] [$0] [$0] [$0] [$0] [$0] [$0] [$0] [$0] [$0] [$0] [$0] [GRAPEVINE@0.2, noun-1word] [$1] + +# from azule +#-MONEY DOESN'T GROW ON TREES. +[noun-plural] DON'T [GROW@0.5, verb-intr-inf] ON [TREES@0.25, BAOBABS@0.33, noun-plural]. + +# xkcd #1190 "Time", frame 2119 +#-MORE WORLD. MAYBE DIFFERENT. +MORE [noun-mass, noun-singular]. MAYBE [DIFFERENT@0.5, adjective]. + +# From Psalms 23:5 ("The Lord is my shepherd"), KJV has "... thou anointest my head with oil; my cup runneth over. ; http://snowclones.org/2007/11/13/my-x-runneth-over/ +#-MY CUP RUNNETH OVER +[verb-present-1word][]MY [noun] [$0/present-to-eth/] OVER + +# Added by @Link +# song "Milkshake" by Kelis (2003), lyric is "My Milkshake Brings All the Boys to the Yard", parodied on Family Guy, then on YouTube; http://knowyourmeme.com/memes/my-milkshake-brings-all-the-boys-to-the-yard +#-MY MILKSHAKE BRINGS... +MY [noun-singular] BRINGS ALL THE [noun-plural] TO [THE YARD@0.5, place] + +# "Firefly" TV show episode "The Message", character River Tam, "My food is problematic" +#-MY FOOD IS PROBLEMATIC +MY [noun, adjec-noun] IS PROBLEMATIC. + +# Possibly Monty Python "Dirty Hungarian Phrasebook" (1970) "My hovercraft is full of eels" +#-MY HOVERCRAFT IS FULL... +MY [noun-singular, noun-mass] IS FULL OF [noun-plural, noun-mass, adjec-noun] + +# 4chan (2007) "My [girlfriend] just [censored] me; Shit was SO cash"; http://knowyourmeme.com/memes/shit-was-so-cash-copypasta +#-MY GIRLFRIEND JUST... +MY [noun-commodity, noun-mass] JUST [verb-tr-past] ME; M**STARD WAS SO [CASH@0.5, adjective] + +# A common LOLcat caption snowclone +#-MY X, LET ME SHOW... +MY [noun-singular, noun-mass], LET ME SHOW YOU IT + +# Hemingway (For Whom the Bell Tolls, 1940) +#-NEVER SEND TO KNOW FOR... +NEVER SEND TO KNOW FOR WHOM THE [noun-singular] [verb-intr-present, verb-tr-present]; IT [$1] FOR THEE + +# @Kieryn, OTT:723:24#p3367381 ""ni ni ni ni ni chupacabra ping pong ball" +# Meme added by @Link (mrob27 added more NI's and the fixed-probability literals) +#-NI NI NI NI NI... +NI NI [NI@0.33, NI NI@0.5, NI NI NI] [CHUPACABRA@0.2, noun-singular, noun-mass] [PING-PONG BALL@0.2, noun-singular, noun-mass, adjec-noun] + +# From azule; Statement (often seen in film credits) from the American Humane Association or ASPCA "No animals were harmed in the making of this film" +#-NO ANIMALS WERE HARMED +NO [MOLPIES@0.1, noun-animal-plural] WERE [HARMED@0.5, verb-tr-perfect] IN THE MAKING OF THIS [MEME@0.3, noun]. + +# Probably "No, John. You are the demons" from fanfiction "DOOM: Repercussions of Evil" (2002) ; http://knowyourmeme.com/memes/doom-repercussions-of-evil +#-NO JOHN YOU ARE THE DEMONS +NO, [noun-singular, noun-mass, character], YOU ARE THE [noun-singular, noun-mass, adjec-noun] + +# azule: xkcd #11 +#-NONE OF THE PLACES... +NONE OF THE PLACES I [FLOATED@0.5, verb-intr-past] HAD [noun-plural]. + +# Captioned image of an elephant seal with a blue bucket, captioned "Noooo they be stealin' my Bucket" ; http://knowyourmeme.com/memes/lolrus +#-NOOOO THEY BE STEALIN'... +NOOOO THEY BE [verb-tr-cont] MY [noun-singular, noun-plural, noun-mass, adjec-noun] + +# From japanese.stackexchange.com/questions/8125/are-snowclones-common-in-japanese +# 能登かわいいよ能登 Noto am cute noto +# X かわいいよ X X is a cute X +#-NOTO KAWAIYONOTO +#[character, noun] IS A CUTE [$0] + +# Futurama episode "The Lesser of Two Evils" (2000) image of Fry squinting his eyes, captioned by this snowclone; an early example seems to be "Not sure if trolling / or just stupid" ; http://knowyourmeme.com/memes/futurama-fry-not-sure-if +#-NOT SURE IF TROLLING... +NOT SURE IF [verb-intr-cont] OR JUST [verb-intr-cont, adjective] + +# Probably very old, a way to describe someone as being "stupid", e.g. "He wasn't the sharpest knife in the drawer" ; http://snowclones.org/2007/10/03/not-the-xest-y-in-the-z/ +#-NOT THE MOST X Y IN THE Z +[place-name][]... XE WASN'T THE [adjec-super] [noun-singular] [$0/-pr-in] [$0] + +# azule: Wikipedia template found at the top of articles, "Not to be confused with [[other-thing]]" +#-NOT TO BE CONFUSED WITH... +template azconf1: [noun]. *NOT TO BE CONFUSED WITH _[noun]_.*[] +template azconf2: [verb-cont]. *NOT TO BE CONFUSED WITH _[verb-cont]_.*[] +[azconf1, azconf2] + +# A line from the Bhagavad Gita, "Now I am become Death, the destroyer of worlds.", popularized after J. Robert Oppenheimer cited it in reference to the atomic bomb +#-NOW I AM BECOME... +[verb-cont][$0/cont-to-actor/][]NOW I AM BECOME [ENDISHNESS@0.25, character, noun-singular, noun-mass, adjec-noun], THE [$1/hyphenate/] OF [noun-plural, noun-mass, adjec-noun] + +# A common quote template, found in Seinfeld and some movies +#-NOW IF YOU'LL EXCUSE... +NOW IF YOU'LL EXCUSE ME, I HAVE [noun-singular-article, noun-plural, noun-mass, adjec-noun] TO [verb-tr-inf] + +# A drill for touch-typing practice (1889) "Now is the time for all good men to come to the aid of the party" , later versions substitute "their country" for "the party" +#-NOW IS THE TIME FOR ALL... +NOW IS THE TIME FOR ALL [TREEISH@0.33, MOLPISH@0.5, GOOD] [noun-animal-plural] TO COME TO THE AID OF [noun-singular-the, place] + +# "Aliens" (1986) Hicks (or Ripley) "[I say we take off and] nuke the [entire] site from orbit. It's the only way to be sure." +#-NUKE 'EM FROM ORBIT. IT'S... +template decr14: [verb-tr-inf] ['EM@0.5, IT] FROM [THE MOON@0.3, ORBIT@0.5, place]. IT'S THE ONLY WAY TO BE [SURE@0.7, adjective].[] +[decr14] + +# Captioned image of Happy Cat ( http://knowyourmeme.com/memes/happy-cat ), badly cropped, with words "Oh God How Did This Get Here I Am Not Good With Computer" (2005) ; http://knowyourmeme.com/memes/oh-god-how-did-this-get-here-i-am-not-good-with-computer +#-OH GOD HOW DID THIS GET... +OH GLR HOW DID [THIS@0.5, noun-plural, noun-mass, character, adjec-noun] GET HERE I AM NOT GOOD WITH [noun-plural, noun-mass] + +# This is LOLspeak and a little too generic to identify an origin. +#-OH HAI, I XED YOUR Y +OH HAI, I [verb-tr-past] YOUR [noun-singular, noun-plural, noun-mass, adjec-noun] + +# Lord of the Rings "One does not simply walk into Mordor"; http://knowyourmeme.com/memes/one-does-not-simply-walk-into-mordor +#-ONE DOES NOT SIMPLY WALK... +ONE DOES NOT SIMPLY [verb-intr-inf] INTO [MORDOR@0.3, place]. + +# J.R.R. Tolkien, "Lord of the Rings" (1954) "One ring to rule them all, one rind to find them / one ring to bring them all and in the darkness bind them" +#-ONE RING TO RULE THEM ALL... +[place-name][]ONE [noun-singular] TO [RULE@0.75, verb-tr-inf] THEM ALL, ONE [$1] TO FIND THEM / ONE [$1] TO [BRING@0.7, verb-tr-inf] THEM ALL AND [$0/-pr-in] [$0] BIND THEM. + +# Aristotle (4th century BCE), "One swallow does not a summer make, nor one fine day; similarly one day or brief time of happiness does not make a person entirely happy."; http://en.wiktionary.org/wiki/one_swallow_does_not_a_summer_make +#-ONE SWALLOW DOES... +ONE [noun-singular] DOES NOT [noun-singular-article] MAKE + +# "An Officer and a Gentleman" (1982) "The only two things from Oklahoma are steers and queers, and I don't see any horns on you boy" ; also known from "Full Metal Jacket" (1997) where the line is "Holy Dogshit! Only two things come from Texas, steers and queers. You don't look much like a steer, so that kind of narrows down doesn't it." +#-ONLY TWO THINGS COME... +ONLY TWO THINGS COME FROM [place]: [noun-plural, noun-mass, character, adjec-noun] AND [noun-plural, noun-mass, character, adjec-noun] + +# From azule: xkcd #1393 (Timeghost) +#-OOOOOOOOOOOOO... TIIIME IS PASSIIIING! +[noun, place-name][$0/\bTHE\b/Þ/g][$1/lm-aaaagile/][verb-cont][]...@$OO$@OO@$OOO$@O@$O$@... [$2/Þ/THE/g] IS [$3/lm-aggiiiile/]! + +# From Link; Shakespeare "Romeo and Juliet" (1597) "O Romeo, Romeo! wherefore art thou Romeo?" +#-O ROMEO, ROMEO! WHEREFORE.. +[character][]O [$0/remove-the/], [$1]! WHEREFORE ART THOU [$1]? + +# From azule +#-OTC: ONE TRUE COMIC +[noun][]OT[$0/initial-letters/]: ONE TRUE [$0] + +# Azule: xkcd 414 +#-OUR COPY OF THE KAMA... +OUR COPY OF THE [noun-unique, noun-mineral] HAS A COUPLE MISTRANSLATIONS. WHICH WE REFUSE TO FIX. + +# from japanese.stackexchange.com/questions/8125/are-snowclones-common-in-japanese +# パンが無いならお菓子を食べればいいじゃない It's not good if you eat sweets, if there is no bread +# X が Y なら Z すればいいじゃない It's not good if Z X is there is a Y +#-PAN GA NAINARA OKASHI O TABEREBA II JANAI + +# azule: xkcd #194 +#-PENISES: THEY ARE ABOUT ... +[noun-plural]: THEY ARE ABOUT THIS [BIG@0.25, SEAISH@0.33, adjective-positive]. NOW CAN WE *PLEASE*, AS [A CULTURE@0.25, THE OTT@0.33, A THREAD@0.5, A NEEDLE-PULLED THING], MOVE ON? + +# H. P. Lovecraft short story "The Call of Cthulhu" (1928), original phrase is "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn" (meaning "In his house at R'lyeh, dead Cthulhu waits dreaming.") +#-PH'NGLUI MGLW'NAFH ... +[character][place][]PH'NGLUI MGLW'NAFH [$0/remove-the/] [$1/remove-the/] WGAH'NAGL FHTAGN + +# Muppets sketch "Pigs in space" +#-PIGS ... IN SPACE! +[noun-plural, noun-mass, character] ... IN SPAAAACE! + +# Very old, e.g. "Boys' Life" magazine (Aug 1929) "You fellows go out there and play like you've never played before!" ; http://snowclones.org/2007/12/21/going-to-x-like-ive-never-xed-before/ +#-PLAY LIKE YOU'VE NEVER... +template neverbefore1: I'M GOING TO [verb-tr-inf verb-intr-inf] LIKE I'VE NEVER [$0/-perfect] BEFORE.[] +template neverbefore2: I'M GOING TO [verb-tr-inf] [noun-plural] LIKE I'VE NEVER [$0/-perfect] [$1] BEFORE.[] +[neverbefore1, neverbefore2] + +# Wikipadia funds campaign (2010) "Please Read: A Personal Appeal From Wikipedia Founder Jimmy Wales"; http://knowyourmeme.com/memes/events/2010-wikipedia-fundraising-campaign +#-PLEASE READ: A PERSONAL... +PLEASE READ: A PERSONAL APPEAL FROM [noun-singular] FOUNDER [character]. + +# NetNanny ad with words "Pornography? On *my* computer?"; http://knowyourmeme.com/memes/x-in-my-y +#-PORNOGRAPHY? ON... +[noun-plural, noun-mass, adjec-noun]? [IN@0.5, ON] *MY* [noun-singular, noun-mass]? + +# From a games magazine article with a DOOM (1993) screenshot and the caption "PROTIP on DOOM: To defeat the Cyberdemon, shoot at it until it dies."; this may have started the "Protip" running gag ( http://knowyourmeme.com/memes/protip ) +#-PROTIP: TO DEFEAT THE... +PROTIP: TO [DEFEAT@0.15, verb-tr-inf] THE [noun-singular, noun-mass], [verb-tr-inf] IT UNTIL IT [verb-intr-present] + +# @mrob27: This replaces two memes in the original: +# PUSH BUTAN, RECEIVE [noun-singular, noun-plural, noun-mass] +# PUSH BUTTON, RECEIVE [noun-singular, noun-plural, noun-mass] +# thus making the overall likelihood half as much +# Prank caption (appearing as graffiti) written under the pictorial instructions for an electric hand dryer: "Push Button" (under the picture of a hand/finger pushing the dryer's button) / "Receive Bacon" (under a picture of the jet of hot air, depicted as a set of red wavy lines, above the hands) ; earliest known Internet reference is from 2004 ; http://knowyourmeme.com/memes/push-button-receive-bacon +#-PUSH BUTTON, RECEIVE BACON +template decr15: PUSH [BUTAN@0.5, BUTTON], RECEIVE [noun-singular, noun-plural, noun-mass][] +[decr15] + +# photo upload prank fad on YTMND and 4chan /b/ (2006) "Put Shoe on Head" ; http://knowyourmeme.com/memes/put-shoe-on-head +#-PUT SHOE ON HEAD +template decr16: PUT [noun-singular, noun-mass] ON [HEAD@0.5, noun-singular, noun-mass][] +[decr16] + +# azule: xkcd #1025 +#-RACCOON SEX DUNGEON .. DOT TUMBLR DOT COM +[noun-animal-singular] [verb-tr-cont] [DUNGEON@0.3, noun-unique-the] ... DOT CHIRPING MUSTARD DOT COM. + +# Possibly from the "Ramirez, Do Everything!" meme: inspired by "Call of Duty: Modern Warfare 2" (2009), typical examples are "Ramirez, rip that tank apart with your hands!" and "Remirez, take down that chopper with your throwing knife" ; http://knowyourmeme.com/memes/ramirez-do-everything +#-RAMIREZ, X THAT Y WITH YOUR Z! +[RAMIREZ@0.2, char-1word], [verb-tr-inf] [noun-singular-that, noun-plural-the]... WITH YOUR [noun-singular, noun-plural, noun-mass, adjec-noun]! + +# azule: xkcd #378 +# %%% This needs the Xzibit treatment to handle the noun-plural case differently so I can always have a singular form for the C-X M-C part +#-REAL PROGRAMMERS USE ... +template xkcd378a: _REAL_ [noun-plural] USE [noun-article, noun-mass, noun-plural].[] +template xkcd378b: EXCUSE ME, BUT _REAL_ [noun-plural] USE [noun-article, noun-mass, noun-plural]. OH YEAH! GOOD OL' C-X M-C M-[$1/remove-article/]...[] +[xkcd378a, xkcd378b] + +# From Azule: an OTT meme started around NP1602 +template redun-subj-1: [noun-mass] IS[] +template redun-subj-2: [noun-plural] ARE[] +#-REDUNDANCY IS MOLPISH +[REDUNDANCY IS@0.2, REDUNDAKITTY IS@0.1, redun-subj-1, redun-subj-2] [MOLPISH@0.5, MOLPFISH@0.1, adjective-positive]. + +# azule, from OTT starting at OTT:871:20#p3384779 +#-REDUNDANT SPOILER IS REDUNDANT. +REDUNDANT [noun] IS REDUNDANT. + +# At least as old as humor book "Save an alligator, shoot a preppie" (1981); also recently "eat" and "ride" are commonly-seen verbs. +#-SAVE AN ALLIGATOR... +template decr17: SAVE [noun-singular-article], [EAT@0.12, RIDE@0.15, verb-tr-inf] [noun-singular-article][] +[decr17] + +# Known from Heroes (2006) "Save the Cheerleader, Save the World" but undoubtedly much older. +#-SAVE THE CHEERLEADER... +template decr18: [SAVE@0.5, verb-tr-inf] THE [noun-singular, noun-plural, noun-mass], [$0] THE WORLD[] +[decr18] + +# azule: xkcd #54 +#-SCIENCE. IT WORKS, BITCHES. +[noun-mass, noun-singular-the, verb-cont]. IT WORKS, CH**RPIES. + +# azule: xkcd #1037 +#-SCIENTISTS CREATE LIFE IN LAB +[character] AND [character] CREATE [LIFE@0.2, noun-singular, noun-mass] IN LAB: "THE TRICK WAS [CH*RPING@0.2, verb-intr-cont]!" + +# From the original AUTOMEME, origin unknown +#-SCREAMING... +SCREAMING [noun-singular, character]: [character] DOESN'T LIKE IT + +# azule: xkcd #10 +#-SEMENCOFFEE... +SEMENCOFFEECANCERHELPIMTRAPPEDINA[noun-1word]FACTORYSTARSANDBACONBABIESONICE... + +# UNC-CH slang "shit happens" (1983), documented in "Yale Book of Quotations" ; http://nancyfriedman.typepad.com/away_with_words/2010/12/snowclones-happen.html +#-SHIT HAPPENS +template shithappens1: [adjective] [noun, adjec-noun] HAPPENS.[] +template shithappens2: [noun, adjec-noun] HAPPENS.[] +[shithappens1, shithappens2] + +# Simpsons character Montgomery Burns, "Smithers, release the hounds" +#-SMITHERS, RELEASE THE HOUNDS! +[SMITHERS@0.3, character][][$0/remove-the/], RELEASE THE [RAPTORCATS@0.1, RAPTORSHARKS@0.1, noun-plural]! + +# deviantArt group MudKipClub (2003), "so i herd you like mudkips", in reference to the Pokemon character, with spelling changed later; http://knowyourmeme.com/memes/i-herd-u-like-mudkips +#-SO I HERD U LIEK... +SO I HERD U [LIEK@0.25, verb-tr-inf] [noun-plural, noun-mass, adjec-noun] + +# From "Hitchhiker's Guide to the Galaxy" (Fit the Third, 1978), later used as a title for the 3rd novel +#-SO LONG AND THANKS... +SO LONG AND THANKS FOR ALL THE [noun-plural, noun-mass, adjec-noun] + +# "The Big Lebowski" (1998) "Sometimes you eat the bear, and sometimes, well, he eats you." +#-SOMETIMES YOU EAT THE BEAR... +SOMETIMES YOU [verb-tr-inf] THE [noun-singular], SOMETIMES THE [$1] [$0/-present] YOU + +# From Link; "Star Trek" TV series (1966) opening titles +#-SPACE: THE FINAL FRONTIER... +template sttos_dur: FIVE-[noun-interval][] +template sttng_dur: [CONTINUING@0.5, CONTINUONG][] +[place-name][][$0/remove-the/]: THE FINAL FRONTIER. THESE ARE THE VOYAGES OF THE STARCASTRAFTLE _[noun, adjec-noun]_. ITS [sttos_dur, sttng_dur] MISSION: TO EXPLORE [adjective] NEW [WORLDS@0.3, TIMES@0.5, AFTERWHENS], TO SEEK OUT NEW [noun-mass, adjec-noun] AND NEW [noun-plural, adjec-noun], TO [adverb] [verb-tr-inf, verb-intr-inf] WHERE NO [MOLPY@0.5, noun] HAS [$9/-perfect] BEFORE. +# A phrase attributed to Theodore Roosevelt (United State president, 1901-1909), specifcally with respect to foreign policy: "Speak softly and carry a big stick; you will go far."; http://en.wikipedia.org/wiki/Big_Stick_ideology +#-SPEAK SOFTLY AND... +template decr19: SPEAK [SOFTLY@0.4, adverb] AND CARRY [A SEAISH@0.4, adjective-article] [THWAPSTICK@0.2, noun-singular][] +[decr19] + +# "Spiderman, Spiderman, does whatever a spider can" +#-SPIDERMAN, SPIDERMAN, ... +[noun-singular-article][][$0/remove-first-word/]MAN, [$1]MAN, DOES WHATEVER [$0] CAN + +# azule: xkcd #109 +#-SPOILER ALERT... +SPOILER ALERT! [character] [KILLS@0.5, verb-tr-present] [character] WITH [place, noun-singular-article]! + +#-STICK IT IN YOUR TREBUCHET" SOUNDS LIKE... +"[verb-tr-inf] IT IN YOUR [noun]" SOUNDS LIKE SLANG FOR TELLING SOMEONE TO [GTCO@0.2, CH**RP OFF@0.25, verb-inf]. + +# GameFAQ's Random Insanity message board (original was “Ninjas! Thousands of them!”); knowyourmeme.com/memes/suddenly-bananas-thousands-of-them +#-SUDDENLY, NINJAS!... +SUDDENLY, [noun-plural]. THOUSANDS OF THEM! + +# azule: xkcd #149 +#-SUDO MAKE ME A... +template decr20: [MOLPY@0.1, SUDO] MAKE ME [noun-singular-article].[] +[decr20] + +# azule: xkcd #550 +#-SUP DAWG, I HERD U DIDN'T... +SUP [dawgchar], I HERD U DIDN'T LIEK [verb-tr-cont], BUT I ACCIDENTALLY IN YOUR [noun-singular]. + +# song "Take this job and shove it" (1978) ; http://snowclones.org/2007/05/22/take-this-x-and-shove-it/ +#-TAKE THIS JOB... +template decr21: TAKE THIS [noun] AND [verb-tr-inf] IT[] +[decr21] + +# "Coffee Talk with Paul Baldwin / Linda Richman", a serial sketch featuring Mike Myers on Saturday Night Live (1991-1994), a typical example was "I'm a little verklempt. ... Talk amongst yourselves ... I'll give you a topic ... The Progressive Era was neither progressive nor an era. Discuss.", or (a three-word form) "The Holy Roman Empire was neither holy nor Roman nor an empire." +#-TAWK AMONGST YOURSELVES... +template bawldwin2: THE [adjective] [noun-plural] WERE NEITHER [$0] NOR [$1]. DISCUSS.[] +template bawldwin3: [noun-singular-article][]THE [adjective] [adjective] [$0/remove-article/] WAS NEITHER [$1] NOR [$2] NOR [$0]. DISCUSS.[] +template decr22: [TAWK AMONGST YOA-XELVES. @0.5, ][I'LL GIVE YOO A TOAPIC... @0.5, ][bawldwin2, bawldwin3][] +[decr22] + +# "Look Around You" mock educational programme (2002-2005), "In the meantime, Thanks ants. Thants." ; https://www.youtube.com/watch?v=gaI6kBVyu00 +#-THANKS, ANTS. THANTS. +THANKS, [noun-plural, noun-mass, character, adjec-noun]. TH[$0/remove-leading-consonants/]. + +# Super Mario Bros. videogame (1985) "Thank you Mario! But our princess is in another castle"; http://knowyourmeme.com/memes/but-our-princess-is-in-another-castle +#-THANK YOU MARIO... +THANK YOU [character], BUT OUR [noun-singular, noun-mass] IS IN ANOTHER [noun-singular] + +# azule: xkcd #37 +#-THAT'S A SWEET ASS-CAR +THAT'S [A SWEET#0.5, adjective-article] ASS-[noun-singular]. + +# "Snakes on a Plane" (2006 film), "That's it! I have had it with these m**herf**king snakes on this m**herf**king plane!" +#-THAT'S IT! I HAVE HAD... +THAT'S IT! I HAVE HAD IT WITH THESE MOLPYCH**RPING [noun-plural] ON THIS MOLPYCH**RPING [CASTRAFTLE@0.11, RAFTCASTLE@0.04 noun-singular]! + +# Crocodile Dundee (1986) "That's not a knife. ... Now *that's* a knife!" ; http://snowclones.org/2007/09/21/thats-not-an-x-this-is-an-x/ +#-THAT'S NOT A KNIFE.... +THAT'S NOT [noun-singular-article] ... *THIS* IS [$0] + +# Neil Armstrong (1969), upon stepping on the Moon, "That's one small step for [a] man, one giant leap for Mankind." +#-THAT'S ONE SMALL STEP... +THAT'S ONE RIVERISH [noun-singular] FOR [noun-singular-article], ONE SEAISH [$0] FOR [$1/remove-article/]KIND + +# by @azule, based on the ALT text of xkcd #1401 and "trebuchat" OTTifications on NP2048 +#-THE NICE THING ABOUT HEADCANNONS... +[noun-animal-plural, TREBUCHET, TREBUCHAT][]THE NICE THING ABOUT HEAD[$0/lm-aggile/] IS THAT IT'S REALLY EASY TO GET [OTHER PEOPLE@0.5, OTTERS] TO BELIEVE IN THEM. + +# Advertisement "The best part of waking up is Folgers in your cup" +#-THE BEST PART OF WAKING... +THE [MOLPIEST@0.25, adjec-super] PART OF [MOLPYING UP@0.2, verb-cont] IS [noun-mass, noun-plural, adjec-noun] IN YOUR [noun] + +# Harry Truman (U.S. predident) "The buck stops here" sign (1945), referring to the political practice of "passing the buck" +# From balthasar_s and BlitzGirl via Link +#...THE BUCK STOPS HERE +THE [noun] [STOPS@0.7, ****DS@0.3, verb-intr-present] HERE + +# Portal videogame (2007), "The cake is a lie" ; http://knowyourmeme.com/memes/the-cake-is-a-lie +#...THE CAKE IS A LIE +THE [noun-singular, adjec-noun] IS A LIE + +# Fight Club (1999); http://snowclones.org/2011/01/04/the-first-rule-of-x-is-you-dont-talk-about-x/ +#-THE FIRST RULE OF... +THE FIRST RULE OF [noun-mass, adjec-noun] IS, YOU DON'T TALK ABOUT [$0] +THE FIRST RULE OF [noun-singular, adjec-noun] CLUB IS, YOU DON'T TALK ABOUT [$0] CLUB + +# captioned image (2003) "The internet is serious business"; http://knowyourmeme.com/memes/the-internet-is-serious-business +#-THE INTERNET IS SERIOUS BUSINESS +[noun-singular, character] IS SERIOUS [noun-singular] + +# "The rent is too damn high", (2010) slogan of a NYC resident and 3rd-party politician; http://knowyourmeme.com/memes/the-rent-is-too-damn-high-jimmy-mcmillan +#-THE RENT IS TOO... +[THE@0.5, THIS] [noun-singular] IS TOO CH**RPING [HIGH@0.3, adjective] + +# "There is a windmill in my beard. Your argument is invalid." http://captionsearch.com/image.php?id=254 +# which is a derivative of the older and less-specific "Your argument is invalid"; http://knowyourmeme.com/memes/your-argument-is-invalid +#-THERE IS A WINDMILL... +THERE IS [noun-singular-article] IN MY [BEARD@0.33, noun-singular, noun-mass], YOUR ARGUMENT IS INVALID + +# Tom Hanks in "A League of Their Own" (1992); http://snowclones.org/2008/04/22/theres-no-crying-in-x/ +#-THERE'S NO CRYING IN BASEBALL +[place-name][]THERE'S NO [E****ISHNESS@0.33, SADNESS@0.5, CRYING] [$0/-pr-in] [$0] + +# Isaiah 48:22 (or 57:20-21) "There is no peace, says The Lord, for the wicked." +#-THERE IS NO PEACE... +THERE IS NO [noun-mass, noun-singular, adjec-noun][, SAID THE GLR,@0.25, , SAID RANDALL,@0.33, ] FOR THE [adjective]. + +# Star Wars Ep. IV (1977); http://snowclones.org/2008/03/04/these-are-not-the-x-youre-looking-for/ +# and note that "AREN'T" is true to the original, rather than the now-popular "ARE NOT" +#-THESE AREN'T THE DROIDS... +THESE AREN'T THE [noun-plural] YOU'RE [verb-cont] FOR + +# Rap "Ridin'" by Chamillionaire (2006) lyric "They see me rollin', they hatin" ; http://knowyourmeme.com/memes/they-see-me-rollin +# To test use 'automeme -n 100235 | grep 'THEY SEE ME' | sort | uniq' +#-THEY SEE ME ROLLIN'... +[verb-cont][verb-cont][]THEY SEE ME [$0/abbrev-ing/], THEY [HATIN'@0.33, $1/abbrev-ing/] + +# YTMND page with words "They're taking the hobbits to Isengard!", originally from Lord of the Rings (The Two Towers) words spoken by Legolas, OTTified by BlitzGirl at OTT:1483:11#p3462281 ; http://knowyourmeme.com/memes/theyre-taking-the-hobbits-to-isengard +#-THEY'RE TAKING THE HOBBITS... +THEY'RE TAKING THE [MOLPIES@0.2, noun-plural] TO [ISENGARD@0.33, ᘝᓄᘈᖉᐣ@0.45, place]! + +# "Dr. Tran" web animated cartoon series, episode "Roybertito's" (2008) quote "This cheese is burning me!" +# thence to xkcd forums wordfilter mapping "lol" to "¡This cheese is burning me!"; later reprised as a "mod madness" wordfilter in 2009 and 2011 +# thence to the "CueMegAll" chat site for OTTers by @Eternal Density, which included automatic wordfiltering of *everything* typed, turning most words into similarly-spelled words that appear in the "Time" comic dialogue, plus some special mappings that reference OTT inside jokes or other xkcd references including old Madness filters +# From @Link, version 3.4 +#-THIS CHEESE IS BURNING ME +#¡THIS [noun, noun-mass, adjec-noun] IS [verb-tr-cont] ME! + +# Parody of a Chick Publications tract featuring a man saying "Look at this lousy peanut butter sandwich!", parodied by Something Awful forums with caption "This is an ass sandwich. It is made of ass and poo" ; http://knowyourmeme.com/memes/sandwich-chef +#-THIS IS AN ASS... +THIS IS [adjective-article] [noun-singular]. IT IS MADE OF [noun-singular, noun-plural, noun-mass, adjective, adjec-noun] AND [noun-singular, noun-plural, noun-mass, adjective, adjec-noun]. + +# Another xkcd 137 adaptation from Azule +#-THIS IS VERY IMPORTANT... +#[t:ott-darkening, t:ott-metaphor, t:xkcd11, t:xkcd51, t:xkcd180, t:xkcd821c2, t:xkcd859] THIS IS VERY IMPORTANT, SO I WANT TO SAY IT AS CLEARLY AS I CAN: *[CHIRP, verb_tr-inf--negative/ /. /g]. THAT. [MUSTARD, noun-singular--negative/ /. /g].* + +# From Link v. 2.3 (origin unknown) +#-THIS IS X Y. I MUST... +THIS IS [adjective] [noun-singular], I MUST [verb-tr-inf] IT + +# From the original AUTOMEME (origin unknown) +# A highly-retweeted tweet from user Horse_ebooks (2012), "'This is not acceptable!'' I screamed as Kathy drowned" +#-THIS IS NOT ACCEPTABLE... +"[THIS IS NOT ACCEPTABLE@0.2, interjection]!" I SCREAMED AS [character] [verb-intr-past] + +# xkcd 1190 "Time" frame 1006 character "Megan" quote "Yeah. / But that's what the first part of not ending looks like."; and frames 1072-3 character "Cueball" quote "Yeah. / But that's what the first part of understanding everything looks like." +#-THIS IS WHAT THE FIRST PART... +[YEAH. BUT @0.5, ][THAT'S@0.5, THIS IS] WHAT THE FIRST PART OF [verb-tr-cont] [noun-plural, noun-mass, adjec-noun] LOOKS LIKE. + +# "This is why we can't have nice things" (an admonition by a parent to a child who has damaged something) predates the internet, and appeared in e.g. Paula Poundstone HBO special "Cats, Cops and Stuff" (1990) ; image macros of an angry cat began to appear in 2008 in response to off-topic posts or threadjacking ; http://knowyourmeme.com/memes/this-is-why-we-cant-have-nice-things +#-THIS IS WHY WE CAN'T HAVE NICE THINGS +[character, noun-mass-the, noun-singular-the][][$0/the-to-this/] IS WHY WE CAN'T HAVE [MOLPISH@0.2, NICE@0.25, adjective] THINGS. + +# Partnership for a Drug-Free America (1987) "This is your brain. This is your brain on drugs. Any questions?" ; http://snowclones.org/2009/06/24/this-is-your-brain-on-x/ +#-THIS IS YOUR BRAIN... +THIS IS YOUR [BRAIN@0.35, noun-singular]. AND THIS IS YOUR [$0] ON [noun-plural, noun-mass, adjec-noun]. ANY QUESTIONS? + +# A popular image macro from 2003 or earlier, originally "This looks shopped / I can tell from some of the pixels and from seeing quite a few shops in my time." ; http://knowyourmeme.com/memes/this-looks-shopped +#-THIS LOOKS SHOPPED... +THIS [LOOKS@0.5, IS] [PHOTOSHOPPED@0.2, SHOOPED@0.1, OTTIFIED@0.25, OTCOLORISED@0.33, adjective, verb-tr-perfect]. I CAN TELL BY THE [noun-singular, noun-plural, noun-mass, adjec-noun] AND FROM HAVING SEEN A LOT OF [noun-plural, noun-mass, adjec-noun] IN MY DIP + +# Randall Munroe What-If book, p. 131 +#-THIS MAY BE A BIT... +THIS MAY BE A BIT [adjective-negative], BUT... IF SOME[ONE@0.33, OTTER@0.5, MOLPY]'S [noun] SUDDENLY [VANISHED@0.3, verb-past], HOW LONG WOULD THEY [verb-inf]? + +# A threadjacking attempt on the Team Xbox forums (2002), original quote is "This thread is now about duckies and bunnies. Discuss." ; http://knowyourmeme.com/memes/threadjacking +#-THIS THREAD IS NOW... +template threadjack1: THIS [NEEDLE-PULLED THING@0.5, noun-singular] IS NOW ABOUT [adjective] [noun-plural, character, adjec-noun][.@0.5, . DISCUSS.][] +template threadjack2: THIS [NEEDLE-PULLED THING@0.5, noun-singular] IS NOW ABOUT [noun-plural, character, adjec-noun] AND [noun-plural, character, adjec-noun][.@0.5, . DISCUSS.][] +[threadjack1, threadjack2] + +# From Azule, currently commented out because I would need to add several templates and make others into named templates. +#-THUS ENDS TIME +# [t:xkcd51, t:xkcd109-sub, t:xkcd208, t:xkcd414, t:xkcd550, t:xkcd859, t:xkcd1013, t:xkcd1017, t:xkcd1110a, t:xkcd1171, t:xkcd1190f1018, t:xkcd1278, t:xkcd1393, t:xkcd1401] ...THUS ENDS TIME. + +# Shakespeare "Hamlet" (1600) "To be or not to be, that is the question" +#-TO BE OR NOT TO BE ... +TO [verb-tr-inf, verb-intr-inf] OR NOT TO [$0], THAT IS THE QUESTION + +# azule: xkcd #1131 +template x1131s1: [NUMBERS@0.5, noun-plural] CONTINUE[] +template x1131s2: [noun-article] CONTINUES[] +# %%% @Azule had "noun-compar" here, but it is undefined. +#-TO SURPRISE OF PUNDITS +TO THE SURPRISE OF [PUNDITS@0.3, noun-animal-plural, character], [x1131s1, x1131s2] TO BE THE BEST SYSTEM FOR DETERMINING WHICH OF TWO THINGS IS [LARGER@0.3, adjec-comp]. + +# From Link; The Wizard of Oz (1939) "I've got a feeling we're not in Kansas anymore" +#-TOTO, I'VE GOT A FEELING WE'RE... +[place-name][][character], I'VE GOT A FEELING WE'RE NOT [$0/-pr-in] [$0] ANYMORE + +# Probably "Trolling is a art", a phrase which describes itself inasmuch as posting the phrase might be considered trolling (for responses correcting 'a' to 'an') +#-TROLLING IS A ART +[verb-cont] IS A [ART@0.5, noun-1word] + +# Salon magazine Twitter account (2010) "Very important for Obama to do him job" ; http://gawker.com/5910716/very-important-for-obama-to-do-him-job-explaining-salons-greatest-moment +#-VERY IMPORTANT FOR OBAMA... +VERY IMPORTANT FOR [character] TO [DO@0.4, verb-tr-inf] XIM [JOB@0.5, noun-singular, noun-mass, adjec-noun] + +# by azule, based on an OTT meme that started around NP1549 +#-VITAL HOTDOG FUNCTION +*[adjective] [noun-singular, noun-plural, noun-mass, adjec-noun, verb-tr-cont]* IS [A HIDDEN TRACK ON@0.25, THE NAME OF@0.33, THE LATEST SINGLE OFF OF] THE [LATEST@0.3, NEWEST] [VHF@0.5, VITAL HOTDOG FUNCTION] ALBUM. + +# "The Treasure of the Sierra Madre" (book 1935, film 1948) "Badges? [...] We don't need badges. I don't have to show you any stinking badges." , made famous by "Blazing Saddles" (1974) "Badges? We don't need no stinking badges." ; http://snowclones.org/2007/07/27/x-we-dont-need-no-stinkin-x/ +#-WE DON'T NEED NO STINKIN'... +[CH**RPING@0.33, STINKING@0.5, verb-cont-1word][][noun-plural, noun-mass, adjec-noun]? WE DON'T NEED NO [$0/abbrev-ing/] [$1]. + +# azule: xkcd #51 +#-WE HAD A MALARIA PARTY... +WE HAD [noun-mass-neg-article] PARTY, BUT IT TURNED OUT NOT TO BE VERY [MOLPISH@0.5, adjective-positive]. + +# Frank Herbert "Dune" (1965) "Usul, we have wormsign the likes of which even God has never seen!" +# Added by @Link (not in AUTOMEME) +#-USUL, WE HAVE WORMSIGN... +[character], WE HAVE [noun-1word]SIGN THE LIKES OF WHICH EVEN [RANDALL@0.33, THE GLR@0.5, THE OTA] HAS NEVER SEEN! + +# Legend of Zelda character Tingle, "Tingle, Tingle! Kooloo-Limpah! ...These are the magic words that Tingle created himself. Don't steal them!" +#-TINGLE, TINGLE! KOOLOO-LIMPAH... +# ---> This meme is near the end because I am using EDnames + +# Azule, OTT:2062:19#p3636039 "Well, anything *could* be a meme, including this sentence I just wrote." +#-WELL, ANYTHING COULD BE... +WELL, ANYTHING *COULD* BE [A MEME@0.2, noun-singular-article], INCLUDING THIS [SENTENCE@0.1, noun] I JUST [verb-tr-past]. + +# This is probably from Heather Chandler in "Heathers" (1988), "Well, f*** me gently with a chainsaw." +#-WELL, FUCK ME... +WELL CH**RP ME [adverb] WITH [noun-singular-article] + +# azule: xkcd #528 +#-WELL, IT'S BETTER THAN VISTA +WELL, IT'S MOLPIER THAN [noun-singular-neg-art, noun-mass-negative]. + +# Jaws (1975) "We're gonna need a bigger boat"; http://snowclones.org/2008/02/06/were-gonna-need-a-bigger-x/ +#-WE'RE GONNA NEED... +WE'RE GONNA NEED A MORE [SEAISH@0.3, adjective] [noun-singular] + +# Folgers instant coffee advertising campaign (late 1970's) "We are here at where we've secretly replaced the fine coffee they usually serve with Folgers Crystals. Let's see if anyone can tell the difference!" +#-WE'VE SECRETLY REPLACED... +WE'VE SECRETLY REPLACED [character]'S [noun-singular, noun-mass] WITH [noun-singular-article, noun-mass]. LET'S SEE IF XE NOTICES... + +# BBC educational programme "Look Around You" (2002-2005), full line was "But what is water? It's a difficult question, because water is impossible to describe. One might ask the same about birds. What are birds? We just don't know."; https://www.youtube.com/watch?v=Kh0Y2hVe_bw +#-WHAT ARE BIRDS? WE... +WHAT *ARE* [noun-plural]? WE JUST DON'T KNOW. + +# possibly "Whatever floats your boat", though not confirmed; http://snowclones.org/2007/12/10/whatever-xs-your-y/ +#-WHATEVER FLOATS YOUR BOAT +WHATEVER [verb-tr-present] YOUR [CASTRAFTLE@0.19, RAFTCASTLE@0.06, SHIPCASTLE@0.33, noun-singular, noun-plural, noun-mass] + +# "What happens on tour, stays on tour", an unspoken pact originating in rugby union teams whilst on an overseas trip, later adapted to "What happens on the road,..." by rock bands and crews, then to "What happens here, stays here" in reference to Las Vegas, more popularly repeated as "What happens in Vegas, stays in Vegas." +#-WHAT HAPPENS ON TOUR... +WHAT HAPPENS IN [place], STAYS IN [$0]. + +# Randall Munroe What-If book, p. 119 +#-WHAT IF A GLASS OF WATER WAS... +WHAT IF [noun-mineral-art] OF [noun-mass] WERE, ALL OF A SUDDEN, LITERALLY HALF [noun-mass, adjective, verb-perfect]? + +# Randall Munroe What-If book, p. 187 +#-WHAT IF A SPACECRAFT SLOWED... +WHAT IF A [noun-animal] [verb-past] [WITH@0.5, BY] [adjec-noun] TO JUST A FEW [noun-plural] USING [noun-plural] LIKE [adjective-article] [noun]? WOULD THAT [ENHANCE@0.33, E****@0.5, NEGATE] THE NEED FOR [adjective-article] [noun]? + +# Randall Munroe What-If book, p. 23 +#-WHAT IF EVERYONE ACTUALLY... +[place-name][]WHAT IF [EVERYONE@0.5, EVERYMOLPY] ACTUALLY HAD ONLY ONE [noun], A RANDOM [noun] SOMEWHERE [$0/-pr-in] [$0]? + +# Randall Munroe What-If book, p. 10 +# Note two-step process to handle "SOME A"/ "AN A" treatment as in Colossal Caves meme +#-WHAT IF I TOOK A SWIM IN A TYPICAL SPENT... +template spentfuelpool: [place-name][]WHAT IF I TOOK A [WALK@0.33, HIKE@0.5, SWIM] [$0/-pr-in] [$0/-art] A TYPICAL [adjective] [noun] [$0/remove-the/]? WOULD I NEED TO [verb-inf] TO ACTUALLY [verb-tr-inf] [adjective-article] AMOUNT OF [noun-plural, noun-mass]?[] +[spentfuelpool][][$0/postproc-some/] + +# Randall Munroe What-If book, p. 88 +#-WHAT IF YOU STRAPPED C4 TO... +WHAT IF YOU [verb-tr-past] [noun-mass] ON [noun-article]? COULD THIS BE [adjective-article] [noun], OR WOULD IT BE AS [adjective-negative] AS IT SOUNDS? + +# Doctor Who episode "The Five Doctors", The Castellan's line "No, not the mind probe!" +#-WHAT? NO, NOT THE MIND _PROBE_! +WHAT! NO, NOT THE [MIND@0.3, noun-singular, noun-mass] _[PROBE@0.3, noun-singular, noun-mass]_! + +# Randall Munroe "What-If" book, p.195 +#-WHAT PLACE ON EARTH WOULD ALLOW YOU... +[place-name][$0/-art][]WHAT [$0/remove-the/] [ON EARTH@0.33, IN NEWPIXIA@0.5, IN TIME] WOULD ALLOW YOU TO [verb-inf] THE LONGEST BY [verb-cont] [$0/-pr-out] [$1/some-to-them/]? WHAT ABOUT USING [A SQUIRPY@0.3, adjective-article] [noun-mineral]? + +# Randall Munroe What-If book, p. 77 +#-WHAT SORT OF LOGISTIC... +WHAT SORT OF [adjective] [noun-plural, noun-mass] WOULD YOU ENCOUNTER IN TRYING TO [verb-tr-inf] AN ARMY OF [noun-animal-plural]? + +# By Link, v. 0.3.1 (origin unknown) +#-WHAT THE FUCK? YOU ARE... +WHAT THE CH**RP? YOU ARE [noun-singular, noun-mass, character]. AND [adjective] + +# Randall Munroe What-If book, p. 52 +#-WHAT WOULD HAPPEN IF A HAIR DRYER +template hairdryer: [place-name][]WHAT WOULD HAPPEN IF A [noun] WITH [CONTINUOUS@0.3, adjective] [POWER@0.3, noun-mass, adjec-noun] WERE [verb-tr-perfect] AND PUT [$0/-pr-in] [$0/-art] [A MUSTARDPROOF@0.2, AN AIRTIGHT@0.25, A WATERTIGHT@0.33, adjective-article] 1$X$1$X$1-CUEBALL [$0/remove-the/]?[] +[hairdryer][][$0/postproc-some/] + +# Randall Munroe What-If book, p. 1 +#-WHAT WOULD HAPPEN IF EARTH AND ALL... +WHAT WOULD HAPPEN IF [place-name] AND ALL [TEMPORAL@0.2, adjective] OBJECTS SUDDENLY STOPPED [verb-cont], BUT THE [noun] RETAINED ITS [adjec-noun]? + +# Randall Munroe What-If book, p. 43 +#-WHAT WOULD HAPPEN IF EVERYONE ON EARTH STOOD... +[place-name][]WHAT WOULD HAPPEN IF [EVERYONE@0.5, EVERYMOLPY] [$0/-pr-in] [$0] [verb-past] AS CLOSE TO EACH OTHER AS THEY COULD AND [verb-past], EVERYONE [verb-cont] AT THE SAME INSTANT? + +# Randall Munroe What-If book, p. 35 +#-WHAT WOULD HAPPEN IF YOU MADE A PERIODIC... +[noun-animal-plural, noun-mineral-plural][$0/-art][]WHAT WOULD HAPPEN IF [YOU@0.5, character] [verb-tr-past] [adjective-article] [noun] [WITH@0.5, OUT OF] [noun]-SHAPED [$0], WHERE EACH [$1/remove-article/] WAS [MADE@0.3, verb-tr-perfect] [WITH@0.5, BY] [verb-cont-article] [noun]? + +# Randall Munroe What-If book, p. 131 +#-WHAT WOULD HAPPEN IF YOU TRIED TO FLY A... +WHAT WOULD HAPPEN IF YOU TRIED TO [verb-tr-inf] A NORMAL [adjective] [noun] [ABOVE@0.33, THROUGH@0.5, UNDER] DIFFERENT [adjective] [noun-plural]? + +# Randall Munroe What-If book, p. 7 +#-WHAT WOULD HAPPEN IF YOU TRIED TO HIT... +WHAT WOULD HAPPEN IF YOU TRIED TO [verb-tr-inf] A [noun] [verb-tr-perfect] AT 90 PERCENT THE [SPEED@0.2, MOLPISHNESS@0.25, adjec-noun] OF [noun-mass]? + +# Randall Munroe What-If book, p. 192 +#-WHEN -- IF EVER -- WILL... +WHEN -- IF EVER -- WILL THE [noun-mass, adjec-noun] OF THE [noun] SURPASS THAT OF [character, place-name, place-name, place-name]? + +# Randall Munroe What-If book, p. 146 +#-WHICH US STATE... +WHICH [adjective] [noun] IS ACTUALLY [verb-tr-perfect] THE MOST? + +# from azule, based on xkcd #1340 +#-WHOA, IT'S 2014-03-10! +WHOA, IT'S [FRAME@0.33, NP@0.5, NEWPIX] [random_12][random-digit][random-digit][random-digit]! UNDER [GLR@0.25, MSCHA@0.33, GEEKWAGON@0.5, AUBRONWOOD]'S SYSTEM, THAT [$0] WILL ~NEVER HAPPEN AGAIN!!~ + +# azule: xkcd #979 +#-WHO WERE YOU, DENVERCODER9? WHAT DID YOU SEE? +[character][]WHO WERE YOU, [$0/remove-the/]? ~*WHAT DID YOU SEE?!*~ + +# "With friends like {you/that/these}, who needs enemies?", also seen in other languages (e.g. Spanish "Con amigos así ¿quién necesita enemigos?"; German "Behüte mich Gott vor meinen Freunden, mit den Feinden will ich schon fertig werden.") +#-WITH FRIENDS LIKE... +WITH [noun-plural] LIKE [THIS@0.5, THESE], WHO NEEDS [noun-plural, noun-mass, adjec-noun]? + +# Doge (2012) a photo of a Shiba Inu dog (named Kabosu) with "interior monologue" captions in Comic Sans and various colours; http://knowyourmeme.com/memes/doge +#-WOW - SO SCARE - ... +[WOW@0.5, NEAT] - SO [noun-singular] - MANY [adjective] - SUCH [verb-cont] - VERY [noun-singular] - MUCH [adjective] - [SEA IS BIG@0.33, RIVER IS SMALL@0.5, HAIL RANDALL] + +# http://nancyfriedman.typepad.com/away_with_words/2010/12/snowclones-happen.html +#-X IS SO LAST-Y +[verb-cont] IS [JUST @0.5,]SO *LAST [noun-interval]*. + +# Photo of "Chappelle's Show" character Tyrone Biggums with caption "YA'LL GOT ANY STEAM DEALS" (2010) , "any more" added in subsequent image macros on Reddit ; http://knowyourmeme.com/memes/yall-got-anymore-of +#-Y'ALL GOT ANY MORE... +Y'ALL GOT ANY MORE OF THEM [noun-plural]? + +# editorial in the New York Sun (1897), "Yes Virginia, there is a Santa Claus" ; http://snowclones.org/2007/10/12/yes-virginia-there-is-an-x/ +#-YES VIRGINIA, THERE IS... +[VIRGINIA@0.2, character][]YES [$0/remove-the/], THERE *IS* [noun-unique-article, noun-unique-article, noun-singular-article]. + +# Very common snowclone, going back at least to Arthur Baer (1938) "You can take a boy out of the country but you can't take the country out of a boy." +#-YOU CAN TAKE A BOY OUT OF... +[place-name][]YOU CAN TAKE [character, noun-singular-the] [$0/-pr-out] [$0], BUT YOU CAN'T TAKE [$0] OUT OF [$1] + +# "You can't have your cake and eat it too" +#-YOU CAN'T HAVE YOUR CAKE... +YOU CAN'T [verb-tr-inf] YOUR [noun-mass, noun-singular] AND [verb-tr-inf] IT TOO + +# Infocom "Hitchhiker's Guide to the Galaxy" text adventure game (1984), "You have destroyed most of a small galaxy. Please pick your words with greater care."; http://www.imdb.com/title/tt0436395/quotes +#-YOU HAVE DESTROYED MOST OF... +YOU HAVE [verb-tr-past] MOST OF A RIVERISH [noun-commodity]. PLEASE PICK YOUR [noun-plural, noun-mass] WITH GREATER CARE. + +# Matthew 26:52 (KJV has "for all they that take the sword shall perish with the sword." +#-YOU LIVE BY THE SWORD, YOU DIE BY THE SWORD +YOU [LIVE@0.3, verb-inf] BY THE [PUNSAW@0.25, THWAPSTICK@0.3, noun], YOU [DIE@0.3, verb-inf] BY THE [$1] + +# azule: xkcd #231 +#-YOU'RE A KITTY! +YOU'RE [noun-singular-article]! + +# Reddit demotivator "You wouldn't download a car" (captioned "F*ck you / I would if I could"), a parody of “Piracy Parody Ad” (2007) by roboslobproductions on YouTube, itself a parody of the MPAA "You Wouldn't steal a car / You wouldn't steal a handbag / ..." ad campaign; http://knowyourmeme.com/memes/piracy-its-a-crime +#-YOU WOULDN'T DOWNLOAD A CAR +YOU WOULDN'T [DOWNLOAD@0.5, verb-tr-inf] [A CASTRAFTLE@0.21, A RAFTCASTLE@0.08, noun-singular-article] + +# Photo of Xzibit (Alvin Nathaniel Joiner) captioned with "Yo dawg I herd you like cars so we put a car in yo car so you can drive while u drive" (2008), a parody of the show "Pimp My Ride" wherein Xzibit often put absurd things (like a badminton net or an aquarium) into the car being customized for a person who presumably liked badminton or fish; http://knowyourmeme.com/memes/xzibit-yo-dawg +# The original starts with a plural noun ("cars") and changes to singular "... put a car in your car"; but could also me memeified with all plurals e.g. "... out some cars in your cars"; this latter form works with mass nouns: +# HERD U LIEK ... SO WE PUT ... IN YR +# MEMES A MEME MEME +# HOTDOGS SOME HOTDOGS HOTDOG +# MUSTARD SOME MUSTARD MUSTARD +template wawlpy1: [noun-animal-art, noun-mineral-art, noun-interval-art][][$0/-plural] SO WE PUT [$0] IN YOUR [$0/remove-article/][] +template wawlpy2: [noun-animal-art, noun-mineral-art, noun-interval-art][][$0/-plural] SO WE PUT SOME [$1] IN YOUR [$0/remove-article/][] +template wawlpy3: [noun-mass] SO WE PUT SOME [$0] IN YOUR [$0][] +#-YO DAWG, I HEARD YOU LIKE... +YO WAWLPY, I HEARD YOU LIKE [wawlpy1, wawlpy2, wawlpy3] SO YOU CAN [verb-intr-inf] WHILE YOU [$1] + +# 2009 MTV VIdeo Music Awards, Kanye West "Yo Taylor, I'm really happy for you, Imma let you finish but Beyonce had one of the best videos of all time..." +#-YO TAYLOR, I'M REALLY HAPPY... +YO [character], I'M REALLY HAPPY FOR YOU, IMMA LET YOU FINISH, BUT [character] HAD ONE OF THE [MOST TREEISH@0.33, MOLPIEST@0.5, MOST WOWTERFUL] [noun-plural] OF ALL TIME + +# A very old metaphor template, used to describe the significance of something by alluding to a well-known and analagous thing in another domain: e.g. "pink is the navy blue of India", "Stanford is the Harvard of the West", "mrob27 is the the Leonardo DiCaprio of the OTTscars". Probably very old, and hard to track to an origin; http://snowclones.org/2007/12/18/x-is-the-y-of-z/ +#-X IS THE DARK MATTER OF Y +template darkmatter1: [noun-singular-the, character] IS THE [noun-singular, noun-mass, adjec-noun] OF [noun-the][] +template darkmatter2: [noun-plural] ARE THE [noun-plural, noun-mass, adjec-noun] OF [noun-the][] +[darkmatter1, darkmatter2] + +# mrob27's variant +IF [noun-plural] ARE THE [noun-plural] OF [noun-the], AND [$1] ARE THE [noun-plural] OF [noun-the], WHY ARE WE STILL [verb-tr-cont] [$0]? + +# Habbo hotel (2006) organized protests in response to mods' suspected racial bias "Pool's closed due to AIDS"; http://knowyourmeme.com/memes/pools-closed +[POOL@0.5, noun-singular, noun-mass]'S CLOSED DUE TO [noun-plural, noun-mass, character, adjec-noun] + +# 4chan "Tits or GTFO" (2006); http://knowyourmeme.com/memes/tits-or-gtfo +# and noting 'GTFO' changed to 'GTCO' (that is, changing F****K to CH**RP) +[noun-plural, noun-mass, adjec-noun] OR GTCO + +# From the original AUTOMEME (origin unknown) +[adjective] [noun-plural] ARE *SUPERIOR* + +# Here we replace any initial THE with THIS +# %%% Link's version randomly uses 'THIS' or 'THAT' at the beginning +# "This, guys, is the cancer that is killing /b/" +[noun-singular-the, noun-mass-the, character][][$0/the-to-this/] IS THE [BACONSEMENCOFFEEBABYCANCER@0.2, noun-singular, noun-mass, adjec-noun] THAT IS [E****ING@0.33, KILLING@0.5, CH**RPING] [noun-plural, noun-mass, character] + +# Generic euphemism for sexual double-entendre (e.g. Monty Python's Flying Circus season 1 episode 3, Eric Idle, "Is your wife a...goer...eh? Know what I mean? Know what I mean? Nudge nudge. Nudge nudge. Know what I mean? Say no more..."), as an Internet meme more commonly associated with Mr. Bean (Rowan Atkinson), see also OTT:1992:37 ; http://knowyourmeme.com/memes/if-you-know-what-i-mean +[character] IS "[verb-tr-cont] [noun-singular-article, noun-singular-the, place, character]"... IF YOU KNOW WHAT I MEAN + +# From the original AUTOMEME (origin unknown) Possibly "Open your f***ng eyes. Open them" +[verb-tr-inf] YOUR CH**RPING [noun-plural]. [$0] THEM. + +# A common LOLcat caption, "Xcat is X" where X is an adjective (e.g. "Happycat is happy") or a noun ("Lampcat is a lamp"), original unknown but probably 2007 ; http://english.turkcebilgi.com/Lolcat +# If it's a noun we want the article ("a lamp") only in the second substitution at the end, for adjectives we do not want the article at all. We accomplish this [noun-singular-article, adjective] followed by a cut [], then use a regexp that removes an initial word, if any, in the first substitution. +[noun-singular-article, adjective][][$0/remove-first-word/]MEOWLPY IS [$0] + +# from Link, v. 2.4 (unknown origin) "{} THE {}" +[verb-tr-inf] THE [noun-plural, noun-mass, adjec-noun]! + +# A children's rhyme, "Lenny and Lisa, sitting in a tree, K-I-S-S-I-N-G" +[verb-cont][][character] AND [character], SITTING IN A [NEAT @0.33, WOW@0.5,]TREE, [$0/spell-out/] + +# From the "Warhammer" games, the battle-cry of the followers of Khorne: "Blood for the Blood God! Skulls for the Throne of Khorne!" +# The awkward construction at the beginning is to make a noun into an adjective: +# [noun-plural] # Select a noun, e.g. "SWORDS" +# [$0/-art] # Get the singular article form: "A SWORD" +# [$1/remove-first-word/] # Remove the article: "SWORD" +# We then use the artcle-less singular noun as an adjective, "SWORD GOD". And we do it all over again with another noun for the THRONE part. +# %%% This could be made a lot clearer if we could auto-generate a third column in a multiclass using a template and/or regexp based on one of the other columns. +[noun-animal-plural, noun-mineral-plural, noun-interval-art][$0/-art][$1/remove-first-word/][noun-animal-plural, noun-mineral-plural, noun-interval-art][$3/-art][$4/remove-first-word/][][$0] FOR THE [$2] GOD! [$3] FOR THE [$5] THRONE! + +# A game loosely based on the "wild mass guess" page ( http://tvtropes.org/pmwiki/pmwiki.php/WMG/TimeLord ), wherein the rules consist merely of naming a person or character, and a place or object they are associated with. ; http://www.telltalegames.com/community/discussion/16916/name-here-is-a-time-lord-game +[character] IS A TIME LORD AND [noun-singular-the, place] IS XIS TARDIS + +# Borat "In my country, they would go crazy for these two. ... This one... not so much... ", later memified to "X is Y. Z? ... not so much." +[noun-singular-article, noun-mass, character, adjec-noun] IS [adjective]. [noun-singular-article, noun-mass, character, adjec-noun]? NOT SO MUCH. + +#trzymam kredens +I CAN'T [SLEEP@0.2, verb-inf] BECAUSE I HAVE TO [HOLD@0.1, verb-tr-inf] MY [CREDENZA@0.2, noun-mineral]. + +# +template decr: DECREE: [decr1, decr2, decr4, decr5, decr6, decr7, decr8, decr9, decr10, decr11, decr12, decr13, decr14, decr15, decr16, decr17, decr18, decr19, decr20, decr21, decr22][] +template decrimp: DECREE: [imper1, imper2, imper3, imper4][] +template decrall: [decr@0.6, decrimp][] + +# ----------------------- GEEK-OUT TEMPLATES ----------------------- + +# Demonstrating the avoidance algorithm. To test, un-comment this meme and do: +# automeme -n 9111 -v | grep '[a-z]' | sort | uniq +# [avoid] [avoid] [avoid] [avoid] + +# "Story" templates used to evaluate and test the recursion mechanism. +# "equine verbs: they're what you roasting roast", based on "Verb: It's what you do." +# VERB: IT'S WHAT YOU DO +template verbmeme: [verb-tr-cont][$0/-inf][][adjective] [VERBS@0.3, noun-plural]: THEY'RE WHAT YOU [$0/hyphenate/] [$1/hyphenate/][] +# This regex takes the second word *except* for its colon +regex verbmeme-word2: /^.* ({^ }+):.*$/$1/ +[character][character][][$0] AND [$1] WERE STANDING BY A [noun] THAT HAD SOMETHING WRITTEN ON IT IN BEANISH. I ASKED [$1] WHAT IT SAYS. [$1] TURNED TO LOOK AT [$0]. I ASKED [$0], AND XE ANSWERED, *"[verbmeme]."*. "REALLY, [$0]?" I REPLIED, "[$3/last-word/]? WHY NOT [verb-tr-inf] THEM?" [$1] LOOKED BACK AT ME AND REPLIED, "BECAUSE [$5/-cont] [$3/verbmeme-word2/] IS [****DISH@0.5, adjective-negative]." + +# xkcd #1318, memeified by mrob27. +# First we define a template for each of the six sentences in the comic. +template xkcd1318a: [noun-plural] SUGGEST IT'S [adjective].[] +template xkcd1318b: IT'S [noun-singular-article].[] +template xkcd1318c: IT'S [adjective-article] [noun-singular].[] +template xkcd1318d: IT'S [noun-singular-article] [verb-tr-perfect] BY THE [noun-singular, adjective] [noun-plural].[] +template xkcd1318e: IT'S THAT PLUS [adjective] [noun-singular].[] +template xkcd1318f: IT'S [verb-tr-perfect] IN A [noun-singular] THAT'S [verb-tr-perfect].[] +# +# Next, define a template that chooses at random one of the above six forms. +template xkcd1318-part: [xkcd1318a, xkcd1318b, xkcd1318c, xkcd1318d, xkcd1318e, xkcd1318f][] +# +# Then, make a random xkcd 1318 by doing [xkcd1318-part] six times, with an *ACTUALLY* in between each one. +#... *ACTUALLY*, [xkcd1318-part] *ACTUALLY*, [xkcd1318-part] *ACTUALLY*, [xkcd1318-part] *ACTUALLY*, [xkcd1318-part] *ACTUALLY*, [xkcd1318-part] *ACTUALLY*, [xkcd1318-part] *ACTUALLY*, ... +# TV series "That Mitchell and Webb Look", recurring sketch "Numberwang" (2006) +#-THAT'S NUMBERWANG +template wang1: [random-digit][] +template wang2: [random_12][random-digit][] +template wang3: [random-digit][random-digit][] +template wang4: [random_12][random-digit][random-digit][] +template wangnt: [wang1, wang2, wang3, wang4][] +template wangnum: [wangnt][][$0/^0+//, /^$/0/][] +# template 'wangshow' takes elements from the xkcd 1318 meme and adapts them into a show tagline. +# the maths quiz that simply everyone is talking about +# the maths quiz that's simply everyone +# the numbers show that simply everyone, is talking about? yes. +# the maths quiz for everyone from 8 to 8 hundred and eighty eight. +# examples: +# IT'S A DILGUNNERANG +# -> THE SHOW THAT'S A DILGUNNERANG +# IT'S THAT PLUS EPSILONISH XIP +# -> THE SHOW THAT'S THAT PLUS EPSILONISH XIP +# MOLPYBARAS SUGGEST IT'S OTTERRIFIC +# -> THE SHOW MOLPYBARAS SUGGEST IS OTTERRIFIC +template wangshow: [xkcd1318-part][]THE [MATHS@0.5, NUMBERS] [QUIZ@0.5, SHOW] [$0/^IT'/THAT'/, /SUGGEST IT'/SUGGEST I/][] +[IT'S@0.3, WELCOME TO@0.5, THIS IS] NUMBERWONGGH, [wangshow] HERE WITH US TODIP FOR THE FIRST TIME ARE [char-1word] WHO IS FROM [place-name], AND [char-1word] WHO IS ALSO FROM [place-name]. RIGHT, [LET'S BEGIN@0.5, WE START THIS ROUND] WITH [$2]. / [wangnum]? / THAT'S NUMBERWONGGH! [$4]? / [wangnum]. / YES, [$8] IS NUMBERWONGGH. [$2]? / [wangnum]. / [interjection], NO, [$9] IS ACTUALLY [noun-mass-negative], SORRY! + +# Descriptions of the "Complex maze" from "Colossal Caves" adventure (1976) ; http://en.wikipedia.org/wiki/Colossal_Cave_Adventure#Maze_of_twisty_little_passages +# There are exactly twelve phrases in the original, fitting this template: +# +# YOU ARE IN A [foo] [foo] [foo] PASSAGES, ALL DIFFERENT. +# +# where the three "[foo]"s comprise a permutation of "LITTLE", "TWISTY", and +# "MAZE OF", or with "TWISTING instead of "TWISTY" to get 12 combinations +# instead of just six. +# To make this meme we need to exploit the automatic duplication-avoidance +# feature of automeme. First, here is the implementation of the +# straight (un-memeified) Colossal Cave phrases: +# +template maze-adj: [LITTLE@0.33, TWISTING@0.5, MAZE OF][] +template maze-ing: [maze-adj] [maze-adj] [maze-adj][] +template maze-y: [maze-ing][][$0/TWISTING/TWISTY/][] +#YOU ARE IN A [maze-ing, maze-y] PASSAGES, ALL DIFFERENT. +# +# To memeify it, we want to substitute "MAZE" with a randomly-chosen +# [place]. Since a regex cannot refer to another replaceable, we instead +# change the "MAZE" to a backquote "`" (which does not occur anywhere in +# the lexicon), then use the /former-part/ and /latter-part/ regexes to +# separate it into two phrases so we can interpose the [place-name] +# where "MAZE" was. We also OTTify LITTLE while we're at it. As usual in +# complex cases like this, all but the last step is performed before a cut []. +# (If we also wanted to change LITTLE to a random adjective, we could repeat +# the process we used for MAZE.) +# +template maze-permut: [place-name][$0/remove-the/][maze-ing, maze-y][$2/MAZE/`/, /LITTLE/RIVERISH/][][$0/-pr-in] `[$0/-art] `[$3/former-part/][$1][$3/latter-part/][] +# Examples of [maze-permut] : +# IN `AN `RIVERISH OTC OF TWISTING +# ON `A `TWISTING RIVERISH TOWER OF +# IN `SOME `RIVERISH TWISTY DUNES OF +# The preposition and article (1st and 2nd parts) match the place not the adjective: in the first example "AN" is matched to "OTC". +# I use '`' as the separator to handle hyphenated places, e.g. "YOU ARE IN A RIVERISH TWISTY CASSINI-MADAGASCAR OF HAMPLIES, ALL RELATED." +# +# Extract the three parts and add an article to the 3rd +template maze-some: [maze-permut][$0/former-part/][$0/middle-part/][$0/latter-part/][$3/add-article/][]YOU ARE [$1][$2][$4] [noun-plural], ALL [adjective].[] +# Examples of [maze-some] : +# YOU ARE ON A A RIVERISH RIVER OF TWISTY PASTPOSTS, ALL SEAISH. +# YOU ARE IN AN A TWISTING AFTERWHEN OF RIVERISH DECREES, ALL AWESOMEFUL. +# YOU ARE IN SOME A TWISTING RIVERISH MOUNTAINS OF KEYBOARDS, ALL WOWTERFUL. +# The first article will be SOME if needed to match the place; the second article (e.g. "A" in the "YOU ARE IN AN A TWISTING..." example) matches the following word, be it an adjective or placename. +# +# Finally we postprocess to remove the duplicate article: If the first article is A or AN, remove it, else we remove the 2nd article after the SOME. +[maze-some][][$0/postproc-some/] + +# My "nerd-sniping monstrosity" from NP2058. Purely as a demonstration of +# the capabilities of regular expressions to do cool things in totally +# incomprehensible ways, this templace selects two [character] names, +# multiplies the number of letters together and shows the answer in decimal +# and binary. +# +# Count the number of letters in a word (up to 999) +regex count-letters: /{A-Z}/I/gi, /{^A-Z}//g, /IIIII/V/g, /VV/X/g, /X$/X0/, /XXXXX/L/g, /LL/C/g, /C0/C00/, /CV/C0V/, /CI/C0I/, /CCCCC/D/, /DCCCC/9/, /DCCC/8/, /DCC/7/, /DC/6/, /D/5/, /CCCC/4/, /CCC/3/, /CC/2/, /C/1/, /LXXXX/9/, /LXXX/8/, /LXX/7/, /LX/6/, /L/5/, /XXXX/4/, /XXX/3/, /XX/2/, /X/1/, /VIIII/9/, /VIII/8/, /VII/7/, /VI/6/, /V/5/, /IIII/4/, /III/3/, /II/2/, /I/1/ +HELLO, I AM [character], AND MY NAME HAS [$0/count-letters/] LETTERS! +# +# Count letters in Roman Numerals (999 max) +regex count-ltrs-roman: /{A-Z}/I/gi, /{^A-Z}//g, /IIIII/V/g, /VV/X/g, /XXXXX/L/g, /LL/C/g, /CCCCC/D/ + +# Count letters and give the answer in "BinaRo", which is "Binary Roman Numerals": A=1, B=2, C=4, D=8 and so on, up to 63 +regex count-binaro: /{A-Z}/A/gi, /{^A-Z}//g, /AA/B/g, /BB/C/g, /CC/D/g, /DD/E/g, /EE/F/ +# +# Multiply a binary-Roman number by 2 (up to 255*2) +regex binaro-x2: /H/I/g, /G/H/g, /F/G/g, /E/F/g, /D/E/g, /C/D/g, /B/C/g, /A/Bg/ +# +# Given two binaro numbers demarcated like "DA_CB_", return a single (non-reduced) binaro string equal to their product. (There are better ways to do this) +regex multiply: /({B-E}*)A_({A-F}*)_({A-K}*)/$1_$2_$3$2/, /({CDE}*)B_({A-F}*)_({A-K}*)/$1_$2_$3$2$2/, /({DE}*)C_({A-F}*)_({A-K}*)/$1_$2_$3$2$2$2$2/, /({E}*)D_({A-F}*)_({A-K}*)/$1_$2_$3$2$2$2$2$2$2$2$2/, /E_({A-F}*)_({A-K}*)/$2$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1/, /_{A-F}*_({A-K}*)/$1/ +# +# Turn a binaro number into a equal string of A's +regex binaro-expand: /G/FF/g, /F/EE/g, /E/DD/g, /D/CC/g, /C/BB/g, /B/AA/g +# +# Count letters, answer in (normal) binary. +regex count-binary: /{A-Z}/A/gi, /{^A-Z}//g, /$/ /, /AA/B/g, /B /B0/, /BB/C/g, /C0/C00/, /CA/C0A/, /CC/D/g, /D0/D00/, /DB/D0B/, /DD/E/g, /E0/E00/, /EC/E0C/, /EE/F/g, /F0/F00/, /FD/F0D/, /FF/G/g, /G0/G00/, /GE/G0E/, /GG/H/g, /H0/H00/, /HF/H0F/, /HH/I/g, /I0/I00/, /IG/I0G/, /[A-K]/1/g, / // +# +template zombie-character: ZOMBIE-[character][] +# +# Pick two words, return them along with a data field comprising their letter-counts in binaro +template twoform: [zombie-character][zombie-character][][$0/hyphenate/] [$1/hyphenate/] [$2/count-binaro/]_[$3/count-binaro/]_[] +# +# Demonstrate multiplication and binary numeric output. +[twoform][$0/first-word/][$0/second-word/][$0/last-word/][$3/multiply/][$4/binaro-expand/][]I'M [$1], AND I'VE BEEN LEARNING MATHS FROM LMJB1964. THIS IS MY FRIEND [$2], AND THE NUMBER OF LETTERS IN MY NAME MULTIPLIED BY THAT IN XES NAME IS [$5/count-letters/], [$5/count-ltrs-roman/] IN ROMAN NUMERALS, OR [$5/count-binary/] IN BASE 2. + +# Japanese news interview (2014) young man who says "being in the snow with my lover like this immerses me in a special feeling. I like it." (originally "恋人といる時の雪って特別な気分に浸れて僕は好きです") next to girlfriend who appears embarrassed ; http://knowyourmeme.com/memes/special-feeling-%E7%89%B9%E5%88%A5%E3%81%AA%E6%B0%97%E5%88%86 +#BEING IN THE SNOW WITH MY LOVER... +# @@Link and @@azule: ignore this! +#[verb-cont] WITH MY [noun] GIVES ME A [SPECIAL@0.25, MOLPISH@0.33, adjective-positive] FEELING. + +# Scene from "Death Note" manga Ch. 53 (2005), or episode 24 of the anime series (2007), showing character Light Yagami (Kira) with caption "JUST AS PLANNED!", became a popular image macro from 2005, seen on 4chan starting 2007 ; http://knowyourmeme.com/memes/just-as-planned +template event1: THE [noun-plural, noun-mass] [verb-tr-past] THE [noun][] +template event2: [noun-singular-article] IS [verb-cont][] +template keikaku1: 計画[通り@0.7, されていないと][] +template keikaku2: [JUST@0.7, NOT] AS PLANNED[] +[event1, event2] ... [keikaku1, keikaku2] + +# (More Japanese memes are at: knowyourmeme.com/search?page=2&q=japanese + +# A big example I created for azule, which will probably go in the +# documentation someday +# +# regex remove-leading-the: /^THE // +# +# # Some names with THE, some without, some have multiple words +# class oznames: +# DOROTHY GALE +# GLINDA (THE GOOD WITCH OF THE NORTH) +# THE SCARECROW +# TOTO +# THE WICKED WITCH OF THE WEST +# +# class names-no-the: +# # Take anything starting with THE but remove the THE +# [oznames] ms/remove-leading-the/ +# # Take most of the rest (ugly) +# [oznames] ms/^({A-SU-Z})/$1/ +# [oznames] ms/^(T{A-GI-Z})/$1/ +# # We would still miss THEODORE +# +# templates: +# # Do it one way +# 'SUP [names-no-the]? (template1) +# +# # Do it the other way +# [oznames][]'SUP [$0/remove-leading-the/]? (template2) + +# An approximation of Eternal Density's random title generator. The original +# is online at mustardriver.webfactional.com/hyperwaitforce/randomname/ +# +# Names consist of one or more syllables drawn from a list, with +# apparently no elision or modification of adjacent letters. Also +# with low probability 'rach' or 'ette' is added to the beginning or +# end... or possibly syllable frequency varies by syllable -- for +# example, "zor" might be less common than "tor" -- but I haven't +# done a thorough analysis. +class ednamsyl: +AN +AX +BALL +BIN +BOB +BUN +CAN +CHA +COM +CUE +DAN +DOM +DRAG +EL +ETTE +FREE +GAN +GON +HAT +HUD +IQUE +JER +JON +KIT +LAR +LEE +LEET +LIP +LOR +MAN +MAR +MEG +MEL +MIN +NA +NAR +NAS +ON +OOZ +PLUG +RA +RACH +RAG +RAP +ROS +RY +SAL +SKIT +SNAG +TAD +TAL +TAN +TAP +TAX +TAY +TER +THAT +TOR +UK +VAN +WHAL +WO +YUB +ZOORT +ZOR + +# The distribution of names by syllable-count seems to suggest this type of +# generation function: Start with one syllable. Then flip a coin 4 times; for +# each "heads" add another syllable, but for 'tails' do nothing. With low +# probability, add an ending ('rach' or 'ette') to the beginning and/or end. +template edname: [ednamsyl][ednamsyl@0.5, ][ednamsyl@0.5, ][ednamsyl@0.5, ][ednamsyl@0.5, ][] + +# Simple two-syllable EDname +template ednam2syl: [ednamsyl][ednamsyl][] + +class edactype: +ANTI +BIO +BLITZ +BUG +CARBO +CLAP +COUNTER +CUSTARD +DANGER +DINO +DISCO +DOOM +ELECTRO +FAIRY +FAN +FUTURO +FUZZY +HEXA +HEXADECI +HIGH +MAGNETO +MAL +MAXI +MEGA +MIME +MINI +MOLP +MOON +NECRO +NEGA +POP +PRIMO +PROTO +QUACK +RAPTOR +SPIDER +SQUISHY +SUPER +TECHNO +TEMPORO +ULTRA +VICE +XENO +ZERO + +class edactor: +ADMIRAL +BAKER +CAPTAIN +COLONEL +DEFEATER +DESTROYER +DIRECTOR +DISCOVERER +EMPEROR +EMPRESS +EXECUTIONER +EXECUTOR +EXPERT +FOUNDER +GENERAL +GRADUATE +HELPER +HERO +KING +KNIGHT +LADY +LIBRARIAN +LORD +MAKER +MOME +OCCUPANT +POPE +PREEMPTOR +PRESIDENT +QUEEN +REVEALER +RULER +SAVER +SINGER +VENDOR +VIPER +WIZARD + +# Special places (unique domains) +class edplspec: +%5bCLASSIFIED INFORMATION%5d +ACCIDENTAL DYNAMITE +ACCIDENTAL TNT +ALL MUD +CAT KIND +DISCO +DOWN UNDER +ENCOM +HUMANITY +# Original had "Humens" +HUMANS +MAILBOXES +NOWHERE +OLD EARTH +SOME BACKWATER PLANET +SPACE +SUFFICIENT VELOCITY +THE ARENA +THE BLACK +THE CONTINUUM +THE CORE +THE FUTURE +THE IMPERIUM +THE OTHER SIDE +THE OVERFLOW +THE PAST +THE RING +THE SPOT +THE THUNDERDOME +THE UTTER EAST +TIME +YESTERDAY'S LEFTOVERS +# The original had "Zombie Goasts" +ZOMBIE GHOSTS + +class edplace: +CASTLE +CAVE +CITY +CLOUD +DOME +FOREST +GLADE +HILL +ISLAND +LAND +MOUNTAIN +OCEAN +PALACE +POOL +PORT +REGION +RIVER +ROAD +ROCK +SEA +STAR +STREET +VILLAGE +VOLCANO +WATERFALL +WORLD + +# A 'domain' is a named place, like "ANYUBTAN CASTLE" or "RALOR VILLAGE" +template edomain: [edname] [edplace][] + +template edthing: [edplspec@0.5, edomain][] + +# edtitle +templates: +[edname], [edactype]-[edactor] OF [edthing] + + +# Legend of Zelda character Tingle, "Tingle, Tingle! Kooloo-Limpah! ...These are the magic words that Tingle created himself. Don't steal them!" +#-TINGLE, TINGLE! KOOLOO-LIMPAH... : this meme is near the end because I am using EDnames +[character], [$0]! [ednam2syl]-[ednam2syl]! ...THESE ARE THE [MAGIC@0.6, adjective] WORDS THAT [$0] CREATED XIMSELF. DON'T [STEAL@0.25, verb-tr-inf] THEM! + +# The following templates are a translation ot the "Vilani Random Word Generator" at http://eaglestone.pocketempires.com/lang/vilani/vilanigen4.html + +# 0 39 78 99 120 141 162 180 190 200 204 208 212 216 +# 39 39 21 21 21 21 18 10 10 4 4 4 4 +# K G M D L SH KH N S P B Z R +# 216 177 138 117 96 75 54 36 26 16 12 8 4 +template vilani_i_cons: [K@0.18, G@0.22, M@0.15, D@0.18, L@0.22, SH@0.28, KH@0.185, N@0.28, S@0.38, P@0.25, B@0.33, Z@0.5, R][] + +# 0 67 84 143 184 192 208 216 +# 67 17 59 41 8 16 8 +# A E I U AA II UU +# 216 149 132 73 32 24 8 +template vilani_vow: [A@0.31, E@0.11, I@0.44, U@0.56, AA@0.25, II@0.67, UU][] + +# 0 76 101 139 165 180 191 216 +# 76 25 38 26 15 11 25 +# R N M SH G S K +# 216 140 115 77 51 36 25 +template vilani_f_cons: [R@0.35, N@0.18, M@0.33, SH@0.34, G@0.29, S@0.31, K][] + +template vilani_v: [vilani_vow][] +template vilani_cv: [vilani_i_cons][vilani_vow][] +template vilani_vc: [vilani_vow][vilani_f_cons][] +template vilani_cvc: [vilani_i_cons][vilani_vow][vilani_f_cons][] + +template vilani_bas: [vilani_v, vilani_cv, vilani_cv, vilani_vc, vilani_cvc][] +template vilani_alt: [vilani_cv, vilani_cv, vilani_cv, vilani_cvc, vilani_cvc][] + +template vilani: [vilani_bas][vilani_alt@0.5, ][vilani_alt@0.5, ][vilani_alt@0.5, ][vilani_alt@0.5, ][] + +# [vilani] [vilani] [vilani] [vilani] [vilani] \ No newline at end of file diff --git a/mem/npb.png b/mem/npb.png new file mode 100644 index 0000000..36db7c7 Binary files /dev/null and b/mem/npb.png differ diff --git a/mome.awk b/mome.awk new file mode 100644 index 0000000..52e8cf0 --- /dev/null +++ b/mome.awk @@ -0,0 +1,99 @@ +#// mome.awk +#// automome ONGification +#// 16.01.2015 +#// +#// Copyright (C) 2015 Balthasar Szczepański +#// +#// This program is free software: you can redistribute it and/or modify +#// it under the terms of the GNU Affero General Public License as +#// published by the Free Software Foundation, either version 3 of the +#// License, or (at your option) any later version. +#// +#// This program is distributed in the hope that it will be useful, +#// but WITHOUT ANY WARRANTY; without even the implied warranty of +#// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#// GNU Affero General Public License for more details. +#// +#// You should have received a copy of the GNU Affero General Public License +#// along with this program. If not, see . + +BEGIN{ + printf("")>outfile + for(i=0;i<256;++i) + { + ch=sprintf("%c",i) + hex=sprintf("%02X",i); + ch2hex[ch]=hex + } +} +{ + if(sub(/[AEIOUY]-N-G/,"[b]O-N-G[/b]",$0)>0) + { + print prepare($0) > outfile + exit + } + if(sub(/O+N+G+/,"[b]&[/b]",$0)>0) + { + print prepare($0) > outfile + exit + } + if(sub(/DON'T/,"D[b]ON'G[/b]T",$0)>0) + { + print prepare($0) > outfile + exit + } + if(sub(/[AEIOUY]NG/,"[b]ONG[/b]",$0)>0) + { + if($0!~/TH\[b\]ONG/) + { + print prepare($0) > outfile + exit + } + } + if(sub(/ON /,"[b]ONG[/b] ",$0)>0) + { + print prepare($0) > outfile + exit + } + if(sub(/O\.?$/,"[b]ONG[/b] ",$0)>0) + { + print prepare($0) > outfile + exit + } +}; +function urlencode(name, len,iii,escaped,ch) +{ + len=length(name) + escaped="" + for(iii=1;iii<=len;++iii) + { + ch=substr(name,iii,1); + if (ch ~ /[a-z]|[A-Z]|[0-9]/) + escaped = escaped ch + else + escaped = escaped "%" ch2hex[ch] + } + return escaped +}; +function prepare(rh) +{ + gsub(/\*\*/,"¤",rh) + gsub(/\*[^\*]+\*/,"±&±",rh) + gsub(/±\*/,"[i]",rh) + gsub(/\*±/,"[/i]",rh) + gsub(/¤/,"*",rh) + + gsub(/__/,"¤",rh) + gsub(/_[^_]+_/,"±&±",rh) + gsub(/±_/,"[u]",rh) + gsub(/_±/,"[/u]",rh) + gsub(/¤/,"_",rh) + + gsub(/\$\$/,"¤",rh) + gsub(/\$[^\$]+\$/,"±&±",rh) + gsub(/±\$/,"[size=80]",rh) + gsub(/\$±/,"[/size]",rh) + gsub(/¤/,"$",rh) + + return urlencode(rh " -- [url=http://1190.bicyclesonthemoon.info/ongtext?b=on][b]ong[/b]o[/url][url=http://mrob.com/time/automome/]mome[/url]") +} diff --git a/mome.pl b/mome.pl new file mode 100755 index 0000000..d0eabd5 --- /dev/null +++ b/mome.pl @@ -0,0 +1,974 @@ +#!/usr/bin/perl +# +# mome.pl +# automome +# 09.09.2014 +# +# mome.pl is actually mrob27's automome. +# (http://mrob.com/time/automome) +# which he released on the following license: +# # LICENSE +# # +# # This software, and the sample memes file that goes with it (which is at +# # http://mrob.com/time/automome/automeme-pl.txt ) are made available under +# # a Creative Commons Attribution-NonCommercial 4.0 International License. +# # License details are at http://mrob.com/cc-license.html + +use strict; + +# These are required for UTF-8 parsing, which is exemplified by: +# +# class foreign-words: +# π +# regex initial-letter: /^(.).*$/$1/ +# [foreign-words] starts with '[$0/initial-letter/] +# +# however on older OS's, like MacOS 10.4, using these 'use' statements +# sometimes causes false errors from Perl. +use utf8; +use open ':std', ':encoding(UTF-8)'; + +my $bapropos = q@ +automeme(1r) -- generate random bits of text using templates that match + popular internet 'memes' +@; + +my $g_memefile = "ott-snowclones.txt"; + +my $help = qq` +NAME + + automeme -- generate random bits of text using templates that match + popular internet 'memes' + +DESCRIPTION + +Given no argument, this script just prints out a string of text that +is generated using a randomly-selected template and filling in, after +the style of "Mad Libs". + +The meme definitions are in a file called "$g_memefile" in the +current directory or in ~/data/memes ; this can be changed with the -o +and -d options. + +OPTIONS + + -d foo/bar.txt - Read the meme definitions from "foo/bar.txt". You can + give any pathname; if nothing is found it prints an error + and exits. You can also give just a filename, in which + case it will look first in the current directory, then + in ~/data/memes + -lc 60 - Limit number of characters of any output lines to 60 + -n 27 - Make 27 lines of random memey goodness + -o - Use the original AUTOMEME snowclone database, + "automeme.txt", either in the current directory or in + ~/data/memes + -t '[noun]' - Instead of selecting templates from those provided + in the file, expand the given string as if it were a + template. + -v - Verbose: Print some debugging messages. + +FILE FORMAT + +A meme data file can include blank lines or comments starting with +'#', which will be ignored. A line starting with 'class', such as +'class adjective:', starts a list of words/phrases of a particular +category. A line starting with 'templates:' begins the meme templates +(snowclone definitions). The format of meme templates is demonstrated +by the examples in &examples(), which are executed if you pass the +arguments "-n 0". + +DEBUGGING + +To detect errors in the memes template file, use the command + + automeme -n 10000 -v | grep Error + +This tells it to generate a lot of memes and print error messages (-v), +the #grep# will filter out just the error messages. + +SEE ALSO + + fortune - The classic adage generator + magic-8-ball - Prognosticator + +`; + +my $unused_block_header = q` + +REVISION HISTORY + + 20140406 First version (cloned from #skel#). Get engine working. +Convert @Link's OTT meme database into this grammar. + 20140407 Fix a bug in rep2 index calculation; allow random selection between +two words with [FOO@0.27, BAR] + 20140408 Add -o option. + 20140409 Allow multiple regexps in history substitution; add +'[foo]ms/bar/baz/' generator for defining classes based on other classes. + 20140411 Fix a regexp bug; allow two fixed-probability literals + 20140415 Add cut operator '[]' + 20140427 UTF8 compliance. + 20140505 Add -lc option. + 20140723 Add multiclass syntax. + 20140725 In &rep3, check for the 'LITERAL@0.12, ' parts first, and +allow three such parts. Add more syntax examples to &examples() + Implement isomorph syntax. $1/foo/bar regexp syntax now allows +'g' modifier. + 20140730 &rep3 now accepts arbitrarily many random literal parts. +Add an explanatory block comment on multiclass. + 20140731 -v option shows an error message if an empty class +is used in a replaceable context. + 20140803 Add some more error detection. + 20140804 Template-expansion code (functions memeify, rep1, rep2 and rep3) +can now call itself recursively. + 20140804 Add named regex syntax (but only for the ms// selector when +building derived classes) + 20140805 Support named regexes in replaceables; add more error +detection. &rep3 now tries to make sure each string acquired from a +call to rep2 is different from any previous ones (within this +particular call to memeify). + 20140806 Add named templates and recursion. Add more error-checking. + 20140807 More error detection + 20140813 More restrictive test for 'class has no members' error + 20140830 Do not need the UTF-8 "use" statements. + 20140907 You can now give fixed probabilities to templates and/or +classes in a rep3 replaceable. + 20140908 Add -t option. + +BUGS and TO-DO + +A template can be given a name via label, allowing it to be invoked +the same way a class is named (as an option within a replaceable). +Labels must contain no spaces or other odd punctuation; if you want a +literal colon you can use %3a. If you want the template *only* for use +within another template, end its definition with a cut []. + Invoke a set of labeled templates with "[foo, bar, baz]" which will +cause one to be picked and a recursive call to rep3 + Use a labeled template as a macro/substring of a longer template +with just one label inside brackets e.g. "foo bar [baz]" + We'll want to be able to do "foo: [bar, baz][]" and invoke [foo] two +or more times in e.g. the Doge meme. This means at least 2 or 3 +recursive levels should be allowed. + Provide a way to indicate that a replaceable should *not* duplicate +an earlier one (or perhaps this should always be true by default for +certain classes of replaceables). + Use this construct to improve the Doge meme and deal with xkcd #1318 + +MULTICLASS and ISOMORPHS + +A *multiclass* is a set of classes whose members have a one-to-one +correspondence with each other. Here is an example of a multiclass +defining singular and plural nouns: + + multiclass noun[-singular, -plural]: + CAT | CATS + FISH | FISH + GOOSE | GEESE + +This defines classes "noun-singular" and "noun-plural". Each noun has +singular and plural forms, called "declensions". It is also useful to +define a multiclass for verbs, in which case we have "conjugations": + + multiclass verb-transitive[-present, -past]: + CARRY | CARRIED + SEE | SAW + THROW | THREW + +The general term for declension and conjugation is "inflection", so +each item in a line is a different inflection of the words next to it: +"CATS" is the plural inflection of "CAT" and "SAW" is the past +inflection of "SEE". + However, a multiclass is useful for things that are not inflections. +Consider the following examples: + + multiclass animal[-singular, -plural, -collective]: + CAT | CATS | CLOWDER + COW | HERD | CATTLE + FISH | FISH | SCHOOL + GOOSE | GEESE | FLOCK + + multiclass vehicle[-singular, -operator]: + BICYCLE | RIDER + CAR | DRIVER + SHIP | CAPTAIN + TRAIN | ENGINEER + +Here we use the multiclass to define *isomorphisms*, such as "FISH is +to SCHOOL as CAT is to _______" (what is the collecive noun for cats?) +and "CAR is to DRIVER as TRAIN is to _______" (what do you call the +driver of a train?). The different words in a row cannot be called +"inflections" so intead I call them "isomorphs". + To use a multiclass, first invoke a class member using its normal +class name, then get an isomorph using the history variable, a slash, +and the ending of the class name for the isomorph. For example, +the template: + + I SAW A [animal-collective] OF [$0/-plural]. + +which might generate the sentence "I SAW A SCHOOL OF FISH." + +`; + +my $hd = $ENV{"HOME"}; + +my $p_classname = "[-_a-z0-9]+"; +my $p_mul_names = "[-, _a-z0-9]+"; + +my $g_iterations = 1; +my $g_limit_characters = 9999; +my $g_verbose = 0; + +my %error_seen; +sub reg_error +{ + my($msg) = @_; + if ($error_seen{$msg}) { + } else { + print "*** Error: $msg\n" if ($g_verbose); + $error_seen{$msg} = 1; + } +} + +# Check a regexp pattern to determine if it is a valid Perl regexp. +sub validate_regexp +{ + my($pat, $nonfatal) = @_; + my($evstr); + + if (" $pat)" =~ m/[^\\][\$\@\%][^)]/) { + # Allow no variables + return 0; + } + + if (($pat =~ m/\|/) && ($pat =~ m|/|)) { + # Cannot handle, fail + ®_error("Pattern cannot use both '|' and '/'"); + return 0; + } elsif ($pat =~ m|/|) { + $evstr = "'foo' =~ m|$pat|"; + } else { + $evstr = "'foo' =~ m/$pat/"; + } + eval $evstr; + if ($@) { + # Failage + # die "val fail /$pat/\n"; + return 0; + } + # It must have succeeded + return 1; +} + +sub eval_repl +{ + my($l, $from, $to, $mod) = @_; + my($rv, $evstr); + + $rv = $l; + $evstr = '$rv =~ '; + if (($from =~ m/\|/) && ($from =~ m|/|)) { + # Cannot handle, just return original string + return $l; + } elsif ($from =~ m|/|) { + $evstr .= "s|$from|$to|$mod;"; + } else { + $evstr .= "s/$from/$to/$mod;"; + } + eval $evstr; + if ($@) { + # Failage + # die "repl fail /$from/$to/\n"; + return $l; + } + # It must have succeeded + return $rv; +} + +sub eval_match +{ + my($l, $pat, $mod) = @_; + my($rv, $evstr); + + $rv = 0; + $evstr = '$rv = ($l =~'; + if ($pat =~ m|/|) { + $evstr .= "m|$pat|$mod)"; + } else { + $evstr .= "m/$pat/$mod)"; + } + eval $evstr; + if ($@) { + # Failage + # die "match fail '$pat'\n"; + return 0; + } + # It must have succeeded + return $rv; +} + +my %class_pop; +my %class_member; + +my %named_regex; +my %named_template; + +# Add line of text to current class +sub add1 +{ + my($class, $l) = @_; + my($key); + + $class_pop{$class} += 0; # Make sure this is not the null string + # when defining the first element + $key = "$class $class_pop{$class}"; + $class_member{$key} = $l; + # print "class_member{$key} = $class_member{$key}\n"; + $class_pop{$class}++; +} + +my $g_mc_width; +my @mc_names; +my @mc_vars; +my %is_multiclass; +my %mc_isomorphs; +my %multiclass_basenames; + +# Define the names of each of the classes in a multiclass. +sub mc_setup +{ + my($base, $vars) = @_; + my($name, $b2, $var); + + $g_mc_width = 0; + foreach $var (split(/,/, $vars)) { + $var =~ s/ //g; + # print "mcs $g_mc_width $var\n"; + $name = $base . $var; + $mc_names[$g_mc_width] = $name; + $is_multiclass{$name} = 1; + $mc_vars[$g_mc_width] = $var; + $g_mc_width++; + } + + # Create the isomorph mappings + for $b2 (@mc_names) { + for $var (@mc_vars) { + $mc_isomorphs{"$b2/$var"} = $base . $var; + # print "mc_isomorphs{'$b2/$var'} = '$base$var'\n"; + } + } + + $multiclass_basenames{$base} = 1; +} + +# Add a list of items to all the classes in the current multiclass. The input +# is a line like "FOO | BAR | | BAZ" where the items are separated by +# '|'. Any blank items will cause empty strings to be put into the corresponding +# +sub mc_add +{ + my($l) = @_; + my($i, $class, $key, $var); + + $i = 0; + foreach $var (split(/\|/, $l)) { + if ($i < $g_mc_width) { + $var =~ s/^ +//; + $var =~ s/ +$//; + # print "mcs $i $var\n"; + $class = $mc_names[$i]; + $class_pop{$class} += 0; + $key = "$class $class_pop{$class}"; + $class_member{$key} = $var; + # print "class_member{'$key'} = '$var'\n"; + $class_pop{$class}++; + $i++; + } + } + # Make sure blanks are put in any columns that were left out + while ($i < $g_mc_width) { + $class = $mc_names[$i]; + $key = "$class $class_pop{$class}"; + $class_member{$key} = ''; + $class_pop{$class}++; + $i++; + } +} + +# Load data for vocabulary and snowclone templates +sub load_data +{ + my($dir, $fn, $fp, $l, $class, $key); + my($vocab, $mclass, $mdim, $p1, $p2); + + # %%% In future the meme database could be selected by an environment + # variable, command-line option and/or rc file. + $fn = "$g_memefile"; + + # Look for database in curdir or in ~/data/memes + if ($fn =~ m|^/|) { + # User gave absolute path + $fp = $fn; + } else { + # Relative path: look in . or in ~/data/memes + $dir = "."; + if (!(-f "$dir/$fn")) { $dir = "$hd/data/memes"; } + $fp = "$dir/$fn"; + } + die "No file '$fp'\n" if (!(-f $fp)); + + print "Reading meme definitions from $fp\n" if ($g_verbose); + open(my $IN, $fp); + while($l = <$IN>) { + chomp $l; + $l =~ s/[\t]/ /g; + $l =~ s/^ +//; + $l =~ s/ +$//; + $l =~ s/ +/ /g; + if ($l eq '') { + # Blank line -- ignore + } elsif ($l =~ m/^#/) { + # Comment delimiter -- ignore + } elsif ($l =~ m/^class +($p_classname):$/i) { + $class = $1; + $vocab = 1; $mclass = ''; + } elsif ($l =~ m/^multiclass +($p_classname) *\[($p_mul_names)\]:$/i) { + $mclass = $1; $mdim = $2; + # print "mc_setup($mclass, $mdim)\n"; + &mc_setup($mclass, $mdim); + $vocab = 1; $class = ''; # Suppress adding to simple class + } elsif ($l =~ m|^regex +($p_classname): *(/.+/.*/[gi]*) *$|i) { + $p1 = $1; $p2 = $2; + $named_regex{$p1} = $p2; + } elsif ($l =~ m|^regex +($p_classname)|i) { + ®_error ("Malformed regex definition '$1'"); + } elsif ($l =~ m|^regex +|i) { + ®_error ("Malformed regex declaration"); + } elsif ($l =~ m|^template +($p_classname): +(.*)\[\] *$|i) { + $p1 = $1; $p2 = $2; + $named_template{$p1} = $p2; + # print "named_template{$p1} = $p2\n"; + } elsif ($l =~ m|^template |i) { + ®_error("'template' keyword without classname, ':' or ending '[]'"); + } elsif ($l =~ m/^templates:$/) { + $class = 't:'; + $vocab = 0; $mclass = ''; + } elsif ($class ne '') { + my($fcl, $from, $to, $i, $key, $mod); + if ($vocab + && ($l =~ m|^\[($p_classname)\] *ms/([^/]+)/(.*)$|)) + { + $fcl = $1; $p1 = $2; $p2 = $3; + if ($named_regex{$p1} ne '') { + $p1 = $named_regex{$p1}; + } else { + $p1 = "/$p1/$p2"; + } + $p1 =~ tr/{}/[]/; + if ($p1 =~ m|/([^/]+)/([^/]*)/(i?)|) { + $from = $1; $to = $2; $mod = $3; + # print "foo1 |$fcl|$from|$to|\n"; + if ($class_pop{$fcl} <= 0) { + ®_error("No elements in [$fcl]"); + } elsif (&validate_regexp($from)) { + for($i=0; $i<$class_pop{$fcl}; $i++) { + $key = "$fcl $i"; + $l = $class_member{$key}; + if (&eval_match($l, $from, $mod)) { + # print "foo1 '$l' s/$from/$to/$mod"; + $l = &eval_repl($l, $from, $to, $mod); + # print "-> '$l'\n"; + &add1($class, $l); + } else { + # print "foo4 '$l' does not match /$from/\n"; + } + } + } else { + ®_error("Could not validate regex /$from/"); + } + } else { + ®_error("Could not parse regex $p1"); + } + } elsif ($vocab && ($l =~ m|^\[($p_classname)\] *$|)) + { + $fcl = $1; + if (($fcl ne $class) && ($class_pop{$fcl} > 0)) { + for($i=0; $i<$class_pop{$fcl}; $i++) { + $key = "$fcl $i"; + $l = $class_member{$key}; + &add1($class, $l); + } + } elsif ($class_pop{$fcl} <= 0) { + # print "foo2 no elements in [$fcl]\n"; + } else { + # print "foo3 could not validate /$from/\n"; + } + } else { + &add1($class, $l); + } + } elsif ($mclass ne '') { + &mc_add($l); + } + } + close $IN; +} # End of load_data + +# variables used within memeify, and re-instantiated by memeify when +# it calls itself recursively. See www.perlmonks.org/?node_id=66677 +our $g_rep2_index; +our $g_rep2_class; + +our @g_subst_history; +our $n_meme_substitutions; +our @g_sh_index; +our @g_sh_class; +our @g_sh_oa; +our %rep2_results; + +my $complexity; +my $base_template; + +# memeify takes a full meme template and expands it. Templates can invoke labeled sub-templates. The final result is returned as a string. +# memeify does not perform the final step of un-escaping %% literals. +sub memeify +{ + my($meme) = @_; + + local $g_rep2_index; + local $g_rep2_class; + + local @g_subst_history; + local $n_meme_substitutions; + local @g_sh_index; + local @g_sh_class; + local @g_sh_oa; + local %rep2_results; + + # print "memeify '$meme', n_meme_substitutions == $n_meme_substitutions\n"; + # print "foo1 gsh[0] == $g_subst_history[0]\n"; + + # Return a single substitution from a given class, chosen at random + sub rep1 + { + my($class) = @_; + my($i, $t); + + $i = int($class_pop{$class} * rand); + $t = $class_member{"$class $i"}; + return $t; + } + + # rep2 takes a list of classes OR a list of named templates, and either + # selects a class member or selects and executes a template. + # + # In the first form, it returns a substitution chosen from one or more + # classes given a list of those classes' names. The distribution + # will be even by individual class-member, not by class. For + # example, if you give the classes "fruits, vegetables" and if there + # are 14 vegetables and 11 fruits, then this function will return a + # vegetable 14/(14+11) = 56% of the time. + # + # In the second form, it chooses a named template given a list of template + # names, then executes the selected template by making a single recursive + # call to memeify. In this instance, each named template has an equal + # probability of being chosen. + sub rep2 + { + my($classes) = @_; + my($cls, $tpop, $ncls, $i, $na, $nr, $recurse); + my(@bases); + my(@cnames); + + $classes =~ s/,/ /g; + $classes = " $classes "; + $ncls = 0; $tpop = 0; $recurse = 0; + foreach $cls (split / /, $classes) { + if ($cls =~ m/^$p_classname$/) { + if ($class_pop{$cls}) { + if ($recurse) { + ®_error("Cannot mix named templates and literal-classes in a pick-list."); + } else { + $cnames[$ncls] = $cls; + $bases[$ncls] = $tpop; + $tpop += $class_pop{$cls}; + $ncls++; + } + } elsif ($multiclass_basenames{$cls}) { + ®_error("'$cls' is a multiclass basename, variant missing."); + } elsif ($named_template{$cls} ne '') { + if ($tpop > 0) { + ®_error("Cannot mix literal-classes and named templates in a pick-list."); + } else { + $recurse = 1; + $cnames[$ncls] = $cls; +# print "cnames[$ncls] = '$cls'\n"; + $ncls++; + } + } elsif (($cls =~ m/[a-z]/) && ($cls eq lc($cls))) { + ®_error("Class '$cls' has no members."); + } + } + } + + if ($recurse) { + # Pick one at random + $na = int($ncls * rand); + # Retrieve the template and memeify it! + $cls = &memeify($named_template{$cnames[$na]}); + return $cls; + } + + if ($ncls == 0) { + # We found none, so we'll just return the string + $classes =~ s/^ *//; + $classes =~ s/ *$//; + return $classes; + } + + $na = int($tpop * rand); + + # Find out what class we selected + $i=0; while (($na>=$bases[$i+1]) && ($i+1 < $ncls)) { $i++; } + + # Convert the absolute index into an index relative to the selected class + $nr = $na - $bases[$i]; + $cls = $cnames[$i]; + + # If we're drawing from a member of a multiclass, it makes sense to + # remember the class name and index for use in later isomorph + # substitution + if ($is_multiclass{$cls}) { + $g_rep2_index = $nr; + $g_rep2_class = $cls; + } else { + $g_rep2_index = -1; + $g_rep2_class = ''; + } + + # print "foo1 $cls: ncls $ncls tpop $tpop na $na nr $nr\n"; + + # We're done! + return $class_member{"$cls $nr"}; + } # End of rep2 + + # Call rep2 with a repetition-avoidance loop. Results are considered + # 'duplicate' if the result (output of rep2) is identical to a + # previous rep2 result, regardless of whether the argument (input to + # rep2) is the same or different. + sub avoid_rep2 + { + my($arg) = @_; + + # We iteratively call &rep2 until it manages to return a result that + # is distinct from any other &rep2 calls within this instance of + # &memeify. To avoid infinite looping, we try at most 27 times. + my($avoid_count) = 27; + my($rv); + + while ($avoid_count > 0) { + $rv = &rep2($arg); + if (($rep2_results{$rv}+0) == 0) { + # We found a new one! + $avoid_count = 0; + } else { + $avoid_count--; + } + } + $rep2_results{$rv} = 1; + + return $rv; + } + + # Return a replacement for one of the types of substitutions defined by the + # automeme grammar (see FILE FORMAT section in block comment above, and + # examples in &examples() routine below) + sub rep3 + { + my($arg) = @_; + my ($i, $rv, $from, $to, $rs, $mod, $gh_index, $gh_class, $oa, $t); + + # print "foo2 gsh[0] == $g_subst_history[0]\n"; + + $rv = ''; $oa = $arg; + $gh_index = -1; $gh_class = ''; + if ($arg eq '') { + # Cut: send cut signal back to caller + return '[]'; + } + + $i = 0; + while ($arg =~ s/^([^\$\@]*)\@([.0-9]+), *//) { + if ((rand() < $2) && ($i == 0)) { + # Return initial string (a template, class, or literal) + # with a fixed probability + $rv = $1; + if (($class_pop{$rv} > 0) || ($named_template{$rv} ne '')) { + $rv = &avoid_rep2($rv); + } + $i = 1; + } + } + + if ($i) { + # We got one of the randoms + } elsif ($arg =~ m|^\$([0-9]+) *(/.*/.*) *$|) { + # numbered 'variable' with (one or more) regexp replacement(s) + # demarcated by at least two slash characters '/' + $rv = $1; $rs = $2; + # Check for named regex + if ($rs =~ m|^/($p_classname)/$|) { + # With just two slashes, we expect a named regex. + $t = $1; + if ($named_regex{$t} ne '') { + $rs = $named_regex{$t}; + } elsif ($g_sh_class[$i] ne '') { + # Perhaps they're trying to do an isomorph + ®_error("I got '/$t/', but isomorph syntax has no trailing slash."); + } else { + ®_error("No named regex '$t'"); + } + } else { + # This is okay, it's probably a literal regex. + # ®_error("'$rs' is not of the named-regex form"); + } + if ($rv >= $n_meme_substitutions) { + ®_error("There is no '\$$rv' in history."); + } + $rv = $g_subst_history[$rv]; + $rs .= ', '; + # print "rep3 |$arg|$rv|$rs|\n"; + # Bite off the grep-forms one at a time. Each is expected to + # be of the form /foo/bar/x where the match 'foo' must be non-null, + # and the trailing modifiers 'x' can include 'g' or 'i' but nothing + # else. + while ($rs =~ m|^/([^/]+)/([^/]*)/([gi]*), *(.*)$|) { + $from = $1; $to = $2; $mod = $3; $rs = $4; + $from =~ tr/{}/[]/; + # print "rep3 '$rv' /$from/$to/"; + if (&validate_regexp($from)) { + $rv = &eval_repl($rv, $from, $to, $mod); + } else { + ®_error("Could not validate regex /$from/"); + } + # print " -> '$rv'\n"; + } + # See if we are left with anything; this is a syntax error. + if ($rs ne '') { + ®_error("Malformed or partial regex '$rs'"); + } + } elsif ($arg =~ m|^\$([0-9]+) */([^/]+)$|) { + # numbered 'variable' with isomorph substitution + $i = $1; $rs = $2; + # print "foo $i $g_sh_class[$i]\n"; + if ($g_sh_class[$i] eq '') { + # We cannot isomorph, just return the original + $rv = $g_subst_history[$i]; + if ($named_regex{$rs} ne '') { + ®_error("In '[\$$i/$rs]', the named regex needs a trailing slash."); + } else { + ®_error("'$g_sh_oa[$i]' is not a multiclass member."); + } + } else { + # Get isomorph class + $rv = $mc_isomorphs{"$g_sh_class[$i]/$rs"}; + # print "mc_isomorphs{'$g_sh_class[$i]/$rs' == $rv\n"; + if ($rv eq '') { + # They asked for a nonexistent isomorph + $rv = $g_subst_history[$i]; + # print "foo-err2\n"; + if ($named_regex{$rs} ne '') { + ®_error("Named regex '$rs' needs a trailing slash."); + } else { + ®_error("'$g_sh_class[$i]' has no isomorph '$rs'."); + } + } else { + $rv = $class_member{"$rv $g_sh_index[$i]"}; + } + } + } elsif ($arg =~ m|^\$([0-9]+) *$|) { + # numbered 'variable': return the Nth substitution from those we have + # generated so far for this meme. We return directly so as not to + # define another history item, which would be redundant. + return $g_subst_history[$1]; + } elsif ($arg =~ m|^\$([0-9]+)(.*)$|) { + ®_error("Unknown modifier '$2' on history variable"); + } else { + # default case: $arg contains one or more word classes + # implementation differs depending on whether equal weight is given per + # class or per class-member. + # %%% recursion passes through here; callers checked in rep2 + + $rv = &avoid_rep2($arg); + + $gh_index = $g_rep2_index; + $gh_class = $g_rep2_class; + } + + $g_subst_history[$n_meme_substitutions] = $rv; + $g_sh_index[$n_meme_substitutions] = $gh_index; + $g_sh_class[$n_meme_substitutions] = $gh_class; + $g_sh_oa[$n_meme_substitutions] = $oa; + $n_meme_substitutions++; + + return $rv; + } # End of rep3 + + $complexity++; + if ($complexity > 27) { + ®_error("Recursive template too complex: $base_template"); + return ""; + } + + # Do it! + $meme =~ s/\[([^]]+)\]/&rep3($1)/ge; + + # Detect a cut signal if any + $meme =~ s/^.*\[\]//; + + return $meme; +} # End of memeify + +sub mfy2 +{ + my($template) = @_; + my($rv); + + $complexity = 0; + $base_template = $template; + + $rv = &memeify($template); + + # De-escape any special literals + $rv =~ s/\%([0-9a-fA-F]{2})/chr(hex($1))/ge; + + return $rv; +} + +sub examples +{ + # Pass "-n 0" as arguments to see these demonstration test cases + + # Return an adjective + print (&mfy2("[adjective]") . "\n"); + + # Return a present-continuous (aka present progressive) or past-tense verb + print (&mfy2("[verb-tr-cont, verb-tr-past]") . "\n"); + + # Return a random noun, but half the time it's HODOR. In Perl + # @ inside "" is special so we use '' + print (&mfy2('[HODOR@0.5, noun-singular]') . "\n"); + + # Return NORTH 1/4 of the time, EAST 1/3 of the remaining time, + # SOUTH 1/2 of the remaining time, and WEST the rest of the time. + print (&mfy2('[NORTH@0.25, EAST@0.3333, SOUTH@0.5, WEST]') . "\n"); + + # Example of a full expansion + print (&mfy2('I CAN [verb-tr-inf] [HOTDOG@0.3, noun-singular] PLEEZ?') . "\n"); + + # This one uses the % escape character to include literal brackets [] in the result + print (&mfy2('%5b[CITATION@0.3, noun-singular, noun-mass] [NEEDED@0.3, verb-tr-past]%5d') . "\n"); + + # A few examples that use history substitition + print (&mfy2('I PUT [noun-mass] IN YOUR [$0]...') . "\n"); + + # This snowclone performs a sort of Pig Latin transformation. The prototype + # is "Bless you, ants. Blants." but we want it to work on plural nouns + # that start with a consonant. We use a regexp to remove any string of zero + # or more non-vowels from the beginning of $0. Note the use of braces {} + # to represent a character-class within the regexp. + print (&mfy2('BLESS YOU, [noun-plural, noun-mass, character]. BL[$0/^{^AEIUO}+//].') . "\n"); + + # Here we use a regexp to remove the article (or any initial word) from a + # noun-singular-article + print (&mfy2('I HAZ [noun-singular-article]. U CAN HAS MY [$0/^{^ }+ //].') . "\n"); + + # For the "Dial M for murder" template we need to choose the full word + # 'murder' before being able to extract its first letter. To achieve this + # we use the cut operation '[]', which causes the parser to evaluate + # the preceding portion and then discard it. + print (&mfy2('[noun-singular, noun-plural, noun-mass, character] []DIAL [$0/^(.).*/$1/] FOR [$0]') . "\n"); + + # Another example, where we select a [place] and then remove any initial 'THE' + print (&mfy2('[place][]PH\'NGLUI MGLW\'NAFH [character] [$0/^THE //] WGAH\'NAGL FHTAGN') . "\n"); + + # A sometimes flawed attempt at verb conjugation. The prototype is + # "Hating haters gonna hate", and we attempt to transform the continuous + # verb form ("hating") into the plural actor form ("haters") by matching the + # ING and changing it to ERS. We than attempt to form the infinitive ("hate") + # by simply removing ING, but that doesn't always work. Here we show a few + # exceptions + print (&mfy2('[verb-tr-cont, verb-intr-cont] [$0/YING/IERS/, /ING/ERS/] GONNA [$0/ING//, /LLAT$/LLATE/, /DOODL /DOODLE /, /HOTDOGG/HOTDOG/]') . "\n"); + + # Another attempt at verb transformation + print (&mfy2('[verb-intr-cont][verb-intr-cont][]THEY SEE ME [$0/ING/IN\'/], THEY [HATIN\'@0.67, $1/ING/IN\'/]') . "\n"); + + print (&mfy2('I WEAR [noun-mineral-art] NOW. [$0/-plural] ARE COOL.') . "\n"); + + print (&mfy2('[noun-animal-plural, noun-mineral-plural][$0/-art][$1/^{^ }+ //][][$0] FOR THE [$2] GOD!') . "\n"); + + # Demonstrating use of a meme subroutine ('[verbmeme]'), buth the main meme and the subroutine use $0, and the main meme extracts parts of the subroutine. + print (&mfy2('[character][character][][$1] TURNED TO LOOK AT [$0]. I ASKED [$0], AND XE ANSWERED, "[verbmeme]". "REALLY, [$0]?" I REPLIED, "[$2/^.* ({^ }+)$/$1/]? WHY NOT [verb-tr-inf] THEM?" [$1] LOOKED BACK AT ME AND REPLIED, "BECAUSE [$4/-cont] [$2/^.* ({^ }+):.*$/$1/] IS [****DISH@0.5, adjective-negative]."') . "\n"); + + # Demonstrating the avoidance algorithm. + print (&mfy2("[avoid] [avoid] [avoid] [avoid]") . "\n"); +} + +$| = 1; + +# Set defaults and parse arguments +my ($arg, $i, $g_literal_template); +while($arg = shift) { + if ($arg =~ m/^-[-]?h(elp)?$/) { + print $help; + exit(0); + } elsif ($arg eq '-d') { + # Use user-specified memebase + $g_memefile = shift; + } elsif ($arg eq '-lc') { + # Limit characters: max length for memes + $g_limit_characters = shift; + } elsif ($arg eq '-n') { + # Produce N memes + $g_iterations = shift; + } elsif ($arg eq '-o') { + # Use original memebase + $g_memefile = "automeme.txt"; + } elsif ($arg eq '-t') { + $g_literal_template = shift; + } elsif ($arg eq '-v') { + $g_verbose = 1; + } else { + print STDERR "Unrecognized argument '$arg'\n"; + exit(-1); + } +} + +# Read in the memes database +&load_data(); + +if ($g_iterations <= 0) { + &examples(); +} + +# Produce N memes +my ($m, $gg); +for($i=0; $i<$g_iterations; $i++) { + # Get memes until we have one that's short enough + $gg = 1; + while($gg) { + if ($g_literal_template ne '') { + $m = &mfy2($g_literal_template); + } else { + $m = &mfy2(&rep1('t:')); + } + $gg++; + if ($gg > 10000) { + print STDERR "I have tried 10000 times without finding a short enough result.\n"; + exit(-1); + } + if (length($m) < $g_limit_characters) { + $gg = 0; + } + } + print ("$m\n"); +} diff --git a/mpost.awk b/mpost.awk new file mode 100644 index 0000000..f312876 --- /dev/null +++ b/mpost.awk @@ -0,0 +1,76 @@ +#// mpost.awk +#// The tool to post to the mirror +#// 08.04.2015 +#// +#// Copyright (C) 2015 Balthasar Szczepański +#// +#// This program is free software: you can redistribute it and/or modify +#// it under the terms of the GNU Affero General Public License as +#// published by the Free Software Foundation, either version 3 of the +#// License, or (at your option) any later version. +#// +#// This program is distributed in the hope that it will be useful, +#// but WITHOUT ANY WARRANTY; without even the implied warranty of +#// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#// GNU Affero General Public License for more details. +#// +#// You should have received a copy of the GNU Affero General Public License +#// along with this program. If not, see . + +BEGIN{ + FS="=" + fora="http://1190.bicyclesonthemoon.info/ott" + useragent="\"bothasar_p (http://1190.bicyclesonthemoon.info/ott/; Time thread post bot)\"" +}; +{ + argtab[$1]=$2 +}; +END{ + printf ("username=%s",argtab["username"])>postfile + printf ("&password=%s",argtab["password"])>>postfile + printf ("&subject=%s",argtab["subject"])>>postfile + if("&addbbcode20" in argtab) + printf ("&addbbcode20=%s",argtab["addbbcode20"])>>postfile + printf ("&message=%s",argtab["message"])>>postfile + printf ("&post=%s","Submit")>>postfile + if("disable_bbcode" in argtab) + printf ("&disable_bbcode=%s",argtab["disable_bbcode"])>>postfile + if("disable_smilies" in argtab) + printf ("&disable_smilies=%s",argtab["disable_smilies"])>>postfile + if("disable_magic_url" in argtab) + printf ("&disable_magic_url=%s",argtab["disable_magic_url"])>>postfile + if("attach_sig" in argtab) + printf ("&attach_sig=%s",argtab["attach_sig"])>>postfile + if("notify" in argtab) + printf ("¬ify=%s",argtab["notify"])>>postfile + printf ("&creation_time=%s",argtab["creation_time"])>>postfile + printf ("&form_token=%s",argtab["form_token"])>>postfile + close(postfile) + + if(system("wget -q -t 3 --connect-timeout=60 --post-file=" postfile " -U " useragent " -O " tempfile " \""fora "/post\"")) + { + print "Submit fail." + exit 1 + } + + while((getline temp < tempfile)>0) + { + if (temp ~ /

information/) + { + success=1 + } + } + close(tempfile) + + if (success!=1) + { + print "Sent back to preview!" + exit INDELIVERABLE + } +} diff --git a/mpview.c b/mpview.c new file mode 100644 index 0000000..45c2cba --- /dev/null +++ b/mpview.c @@ -0,0 +1,137 @@ +// mpview.c (1190.bicyclesonthemoon.info/ct-if-v) +// Display one post +// 17.04.2015 +// +// Copyright (C) 2015 Balthasar Szczepański +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include +#include +#include +#include +#include + +// #define RM_PATH "/bin/rm" +#define CAT_PATH "/bin/cat" +#define MAWK_PATH "/usr/bin/mawk" + +#define NP_TOP_PATH "/eizm/www/time/aftertime/bftf/top" +#define NP_END_PATH "/eizm/www/time/aftertime/bftf/end" +#define INFO_PATH "/eizm/www/time/aftertime/bftf/info.htm" +#define POST_PATH "/eizm/mem/ong1/mpost/" +#define WAIT_PATH "/eizm/mem/ong1/mpost/wait/" + +#define AWK_MVIEW "/eizm/pro/ong1/mview.awk" +#define TEMP_PATH "/eizm/tmp/ong1/mpview." + +int main() +{ + s_cgi *cgi; + pid_t sub; + int r; + + char line[32]; + char filename[32]; + char postpath[256]; + char otherpath[256]; + char cat[8]; + char othercat[8]; + + char *arg; + + FILE *file; + + unsigned char fff; + + cgi=cgiInit(); + fff=(cgiGetValue(cgi,"fff")!=NULL); + + arg=cgiGetValue(cgi,"v"); + sprintf(line,"%s",arg?arg:"???"); + if(line[0]=='c' && line[1]=='t') + { + sprintf(filename,"%s",line+2); + sprintf(cat,"cat=%s","ct"); + sprintf(othercat,"%s","wt"); + sprintf(postpath,"%s%s",POST_PATH,filename); + sprintf(otherpath,"%s%s",WAIT_PATH,filename); + } + else if(line[0]=='w' && line[1]=='t') + { + sprintf(filename,"%s",line+2); + sprintf(cat,"cat=%s","wt"); + sprintf(othercat,"%s","ct"); + sprintf(postpath,"%s%s",WAIT_PATH,filename); + sprintf(otherpath,"%s%s",POST_PATH,filename); + } + else + { + printf("Status: 404 - Not found.\n\nNot this.\n"); + return 0; + // sprintf(filename,"%s","???"); + // sprintf(postpath,"%s","???"); + // sprintf(cat,"cat=%s","???"); + } + + file=fopen(postpath,"rt"); + if(file==NULL) + { + file=fopen(otherpath,"rt"); + if(file==NULL) + { + printf("Status: 404 - Not found.\n\nNot this.\n"); + return 0; + } + fclose(file); + sprintf(postpath,"/ct-if-v?v=%s%s%s",othercat,line+2,fff?"&fff=fff":""); + cgiRedirect(postpath); + return 0; + } + + fclose(file); + + printf("Content-type: text/html\n\n"); + printf("\n"); + printf("\n"); + printf("Chronotransponder test interface • Bicycles on the Moon\n"); + printf("\n"); + printf("\n"); + printf("\n"); + printf("\n"); + printf("\"1190.bicyclesonthemoon.info\"\n"); + printf("

Chronotransponder test interface

\n"); + + fflush(stdout); + sub=fork(); + if(sub==0) + { + r=execl(MAWK_PATH,MAWK_PATH,"-f",AWK_MVIEW,"-v","bg=1","-v",cat,"-v","s=1",postpath,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + { + printf("
\n",line); + printf("
\n"); + printf("%s %s POST NOT FOUND.\n",AWK_MVIEW,postpath); + printf("\n
\n"); + printf("
\n"); + } + + printf("back to the chronotrasponder test interface
\n",fff?"?fff=fff":""); + printf("
1190.bicyclesonthemoon.info\n"); + + return 0; +} diff --git a/mview.awk b/mview.awk new file mode 100644 index 0000000..7f9b713 --- /dev/null +++ b/mview.awk @@ -0,0 +1,34 @@ +#// mview.awk +#// Display one post +#// 04.10.2014 +#// +#// Copyright (C) 2014 Balthasar Szczepański +#// +#// This program is free software: you can redistribute it and/or modify +#// it under the terms of the GNU Affero General Public License as +#// published by the Free Software Foundation, either version 3 of the +#// License, or (at your option) any later version. +#// +#// This program is distributed in the hope that it will be useful, +#// but WITHOUT ANY WARRANTY; without even the implied warranty of +#// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#// GNU Affero General Public License for more details. +#// +#// You should have received a copy of the GNU Affero General Public License +#// along with this program. If not, see . + +BEGIN{ + FS="=" +}; +{ + eq=index($0,"=") + argtab[substr($0,1,eq-1)]=substr($0,eq+1) +}; +END{ + + print "
" + print "
"argtab["subject_h"]"
" + print "
author: "argtab["username_h"]" • sent: "argtab["timetext"]" • received: "argtab["d"]"."argtab["m"]"."argtab["y"]"
" + print "
"((argtab["HTML"]!="")?argtab["HTML"]:argtab["BBHTML"])"
" + print "
" +} diff --git a/npb.cpp b/npb.cpp new file mode 100644 index 0000000..8e9ccd1 --- /dev/null +++ b/npb.cpp @@ -0,0 +1,237 @@ +// npb.cpp +// NewpixbOTTification - The tool to add newpixbots to pictures +// 16.01.2015 +// +// Copyright (C) 2013 Balthasar Szczepański +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +// + +// Requires Dev Image Library (libdevil) (http://openil.sourceforge.net/) +// on Pentium III libdevil must be recompiled with +// --disable-ssl2 --disable-ssl3 +// (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=572954) + +#define INPIX_MUSTARD 1 +#define OUTPIX_MUSTARD 2 +#define NPBPIX_MUSTARD 3 +#define ARGUMENT_MUSTARD 4 +#define SEAISH_MUSTARD 5 +#define ANIMATED_MUSTARD 6 +#define FAIL 900 +#define OK 0 + +#define NPBPIX2 "/eizm/mem/ong1/npb.png" +#define X2 311 +#define X21 210 +#define Y2 475 +#define Y21 407 + +#include +#include +#include + +void mustard(int mustard); +void loadnpb(const char *path); +void npbottify0(const char *path); +void npbottify1(const char *path); +void npbottify2(const char *path); +int main (int argc, const char *argv[]); + +ILuint inPix, outPix, npbPix; +ILboolean q=true; +ILboolean inH=false; +ILboolean outH=false; +ILboolean npbH=false; +ILuint inX, inY, outX, outY; +ILubyte *newdata; + +int main (int argc, const char *argv[]) +{ + if(argc<3) + mustard(ARGUMENT_MUSTARD); + if (argc>=4) + { + if (argv[3][0]=='q' || argv[3][0]=='Q') + q=false; + } + + ilInit(); + if(!ilEnable(IL_ORIGIN_SET))mustard(FAIL); + if(!ilEnable(IL_FILE_OVERWRITE))mustard(FAIL); + ilClearColour(255,255,0,0); + ilGenImages(1, &inPix); + inH=true; + ilBindImage(inPix); + if(!ilLoadImage(argv[1]))mustard(INPIX_MUSTARD); + if(!ilConvertImage(IL_RGBA,IL_UNSIGNED_BYTE))mustard(INPIX_MUSTARD); + //if(!ilConvertPal(IL_PAL_RGBA32))mustard(FAIL); + + inX=ilGetInteger(IL_IMAGE_WIDTH); + inY=ilGetInteger(IL_IMAGE_HEIGHT); + if(ilGetInteger(IL_NUM_IMAGES)>1) + mustard(ANIMATED_MUSTARD); + + // if(inX<=X02&&inY<=Y02) + // npbottify0(argv[2]); + // else if(inX<=X12&&inY<=Y12) + // npbottify1(argv[2]); + else + npbottify2(argv[2]); + //ok + mustard(0); +} + +void loadnpb(const char *path) +{ + ilGenImages(1, &npbPix); + npbH=true; + ilBindImage(npbPix); + if(!ilLoadImage(path))mustard(NPBPIX_MUSTARD); + if(!ilConvertImage(IL_RGBA,IL_UNSIGNED_BYTE))mustard(NPBPIX_MUSTARD); + } + +void npbottify2(const char *path) +{ + unsigned long i,j; + outX=(X21+inX+2>X2)?(X21+inX+2):X2; + outY=(Y21+inY+2>Y2)?(Y21+inY+2):Y2; + ilGenImages(1, &outPix); + outH=true; + loadnpb(NPBPIX2); + newdata=ilGetData(); + ilBindImage(outPix); + if(!ilTexImage(outX,outY,1,4,IL_RGBA,IL_UNSIGNED_BYTE,NULL))mustard(OUTPIX_MUSTARD); + if(!ilClearImage())mustard(FAIL); + ilSetPixels(outX-X2,0,0,X2,Y2,1,IL_RGBA,IL_UNSIGNED_BYTE,newdata); + newdata=ilGetData(); + for(i=outX-X21-inX-2;i. +// + +// Requires cgilib (http://www.infodrom.org/projects/cgilib/) +// line 146 of cgi.h must be changed from: +// extern } +// to: +// } + +#include +#include +#include +#include +#include +#include +#include + +#define WGET_PATH "/usr/bin/wget" +#define NPB_PATH "/eizm/pro/ong1/npb" +#define MEG_PATH "./403" +#define RM_PATH "/bin/rm" +#define LOG_PATH "/eizm/log/npb/npb.log" +#define LOG_PATH2 "/eizm/log/npb/403.log" +#define USERAGENT "NewpixbOTTification\x20(1190.bicyclesonthemoon.dnsd.info/npb/npb.htm)" +#define USERAGENT2 "403fication\x20(1190.bicyclesonthemoon.dnsd.info/npb/403.htm)" +#define MSTD_PATH "/pro/npb/mpb.png" +#define MSTD_PATH2 "/pro/npb/503.png" + +int main (int argc, char *argv[]); +void mustard(int mustard); + +FILE *pix; +unsigned char buf[1024]; +char url[1024]; +char path[256]; +char method[256]; +s_cgi *cgi; +int t; +pid_t sub; +struct stat st; +unsigned long p; +unsigned short q; +char **up; +bool meg=false; + +int main (int argc, char *argv[]) +{ + cgi=cgiInit(); + + sprintf(path,"%s",(getenv("PATH_INFO")!=NULL)?(getenv("PATH_INFO")):""); + if(strcmp(path,"/403")==0) + { + meg=true; + //mustard(0); + } + + up=cgiGetFiles(cgi); + if (up) + { + sprintf(path,"%s",cgiGetFile(cgi,up[0])->tmpfile); + sprintf(url,"%s",cgiGetFile(cgi,up[0])->filename); + } + else + { + sprintf(url,"%s",(cgiGetValue(cgi,"inpix")!=NULL)?(cgiGetValue(cgi,"inpix")):""); + sprintf(path,"/var/tmp/%lu",(unsigned long)getpid()); + + //Why is there no spawnl() in linux? + sub=fork(); + if(sub==0) + { + t=execl(WGET_PATH,WGET_PATH,"-q","-t","2","-U",meg?USERAGENT2:USERAGENT,"-O",path,url,(char *)0); + exit(t); + } + waitpid(sub,&t,0); + if(t)mustard(t); + } + + sub=fork(); + if(sub==0) + { + t=execl(meg?MEG_PATH:NPB_PATH,meg?MEG_PATH:NPB_PATH,path,path,"q",(char *)0); + exit(t); + } + waitpid(sub,&t,0); + if(t)mustard(t); + + pix=fopen(path,"rb"); + if(pix==NULL) + mustard(123); + fstat(fileno(pix),&st); + p=st.st_size/1024; + q=st.st_size%1024; + + printf("Content-Length: %lu\n",(unsigned long)(st.st_size)); + printf("Content-type: image/png\n\n"); + for(unsigned long i=0;i. + +BEGIN{ + basepath="/eizm/mem/ong1" + linenum=0 + depth=0 + nonstandard=0 + external=0 + toplevel=0 + iflevel=0 + limit=65536 + if(int(q)<0) + fail("fatal error.") +} +{ + ++linenum + gsub(/[\r\n]/,"",$0) + gsub(/(^[ \t]+)|([ \t]+$)/,"",$0) + gsub(/#.*$/,"",$0) + # print " "linenum "\t"$0 + + if($0 == "") + next + if($0 == "{") + { + ++depth + next + } + if($0 == "}") + { + if(depth==0) + fail("syntax error.") + --depth + next + } + if($0 ~ /^!/) + { + narg=split($0, aarg, /[ \t]+/) + if(narg!=2) + fail("syntax error.") + if(aarg[1]=="!ifenabled") + { + ++iflevel + } + if(aarg[1]=="!endif") + { + if (iflevel==0) + fail("unmatched endif.") + --iflevel + } + if(aarg[1]=="!enable") + { + if (aarg[2]=="NONSTANDARD_1419") + { + nonstandard=1 + limit=256 + next + } + if (aarg[2]=="EXTERNAL_DEFINITIONS" && nonstandard!=0) + { + external=1 + next + } + if (aarg[2]=="LIMIT_8BIT" && nonstandard!=0) + { + limit=256 + next + } + fail(aarg[2]" undefined.") + } + if(aarg[1]=="!disable") + { + if (aarg[2]=="NONSTANDARD_1419") + { + nonstandard=0 + limit=65536 + external=0 + next + } + if (aarg[2]=="EXTERNAL_DEFINITIONS" && nonstandard!=0) + { + external=0 + next + } + if (aarg[2]=="LIMIT_8BIT" && nonstandard!=0) + { + limit=65536 + next + } + fail(aarg[2]" undefined.") + } + fail(aarg[1]" undefined.") + } + if($0 ~ /^[A-Za-z][A-Za-z0-9_]*\([^\(\)]*\)$/) + { + narg=split($0, aarg, /[\(\)]/) + if(aarg[narg]=="") + --narg + if(depth==0) + fail(aarg[1]" not allowed here.") + if(aarg[1]=="insertRelative"&&external!=0) + fail(aarg[1]" not allowed here.") + if(aarg[1]=="topLevelReplace"&&external!=0) + { + if(depth!=1) + fail(aarg[1]" not allowed here.") + nbarg=split(aarg[2],barg,/,/) + if(nbarg!=2) + fail(aarg[1]" wrong number of arguments.") + if(barg[1] !~ /^[A-Za-z][A-Za-z0-9_]*$/ || barg[1] ~ /(NONSTANDARD_1419)|(EXTERNAL_DEFINITIONS)|(topLevelReplace)/) + fail(barg[1]" wrong type.") + if(barg[1] != "E") + fail(barg[1]" undefined.") + if(barg[2] !~ /^\"[^\"]*\"$/) + #\"" + fail(barg[2]" wrong type.") + argpath=substr(barg[2],2,length(barg[2])-2) + fullpath=basepath argpath + if(getline line < fullpath) + { + close(fullpath) + if(line=="") + fail(argpath" cannot read.") + if(line !~/^###generator&/) + fail(argpath" 1: syntax error.") + sub(/^###generator&/,"",line) + obname=line + toplevel=1 + next + } + fail(argpath " cannot read.") + } + fail(aarg[1]" undefined.") + } + fail("syntax error.") +} +END{ + if (ex!="") + exit + if(depth!=0) + fail("syntax error.") + if(iflevel!=0) + fail("unmatched endif") + if(toplevel==0) + fail("top level undefined.") + success(obname, int(q)) +} +function fail(error) +{ + t=ogdf_name" "linenum": "error + print t + print " "t >> logf + close(logf) + ex=1 + exit +} +function success(name, q) +{ + t=q%limit " item(s) of: \""name"\" added to generation queue." + print t + print " "t >> logf + close(logf) + ex=1 + exit +} diff --git a/ong.c b/ong.c new file mode 100644 index 0000000..f611dc7 --- /dev/null +++ b/ong.c @@ -0,0 +1,102 @@ +// ong.c +// The bot to ONG new frames to the viewer. +// 17.04.2015 +// +// Copyright (C) 2015 Balthasar Szczepański +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#define ONG_STATE_PATH "/eizm/data/aftertime/bftf/ongstate" +#define BOT4_PATH "/eizm/pro/ong1/bot4" +#define MAX_FRAME 786 // na razie tyle +#define FRAME_PRINTF "/eizm/data/aftertime/bftf/%hu.png" +#define ONGED_PRINTF "/eizm/www/time/aftertime/bftf/bftf-%04hu.png" +#define NPBFIED_PRINTF "/eizm/www/time/aftertime/bftf/npbftf-%04hu.png" +#define CP_PATH "/bin/cp" +#define NPB_PATH "/eizm/pro/ong1/npb" + +#include +#include +#include +#include + +pid_t sub; +int r; + +int main (int argc, char *argv[]) +{ + FILE *file; + unsigned short ongFrame; + unsigned char ongState; + char framePath[64]; + char ongedPath[64]; + char npbfiedPath[64]; + + file=fopen(ONG_STATE_PATH,"rt"); + if(file!=NULL) + { + fscanf(file,"%hhu %hu",&ongState,&ongFrame); + fclose(file); + } + else + { + ongState=0; + ongFrame=0; + } + + if(ongState==2&&ongFrame. + +BEGIN{ + automome="/eizm/pro/ong1/mome.pl" + memepath="/eizm/mem/ong1/mome.txt" + + for(i=0;i<256;++i) + { + ch=sprintf("%c",i) + hex=sprintf("%02X",i) + dec=sprintf("%u",i) + ch2hex[ch]=hex + ch2dec[ch]=dec + } + + if(options ~ /o/) + format="o" + else if(options ~ /u/) + format="u" + else + { + print "Ch*rpin* M*stard!" + exit + } + if(options ~ /d/) + decree=1 + if(options ~ /h/) + html=1 + if(options ~ /b/) + bbcode=1 + if(options ~ /t/) + textonly=1 + + system (automome" -lc 256 -n 67 -d "memepath(decree!=""?" -t \"[decr]\"":"")" > "tempfile) + if (format=="o") + ongtext=ong(tempfile) + else + ongtext=ung(tempfile) + if(html!="") + print (textonly==""?"":"")preparehtml(ongtext)(textonly==""?"
":"") + if(bbcode!="") + print (textonly==""?"":"")preparebb(ongtext)(textonly==""?"
":"") + + if(html=="" && bbcode=="") + print (textonly==""?""htmlescape(ongtext)"
":ongtext) + +} +function ong(tempfile, line) +{ + while((getline line < tempfile)>0) + { + gsub(/[\r\n]/,"",line) + if(sub(/[AEIOUY]-N-G/,"#O-N-G#",line)>0) + { + close(tempfile) + return line + } + if(sub(/O+N+G+/,"#&#",line)>0) + { + close(tempfile) + return line + } + if(sub(/DON'T/,"D#ON'G#T",line)>0) + { + close(tempfile) + return line + } + if(sub(/[AEIOUY]NG/,"#ONG#",line)>0) + { + if($0!~/TH\[b\]ONG/) + return line + } + if(sub(/ON /,"#ONG# ",line)>0) + { + close(tempfile) + return line + } + if(sub(/O\.?$/,"#ONG# ",$0)>0) + { + close(tempfile) + return line + } + } + close(tempfile) + return "Ong" +} + +function ung(tempfile, line) +{ + while((getline line < tempfile)>0) + { + gsub(/[\r\n]/,"",line) + if(sub(/[AEIOUY]-N-G/,"#U-N-G#",line)>0) + { + close(tempfile) + return line + } + if(sub(/U+N+G+/,"#&#",line)>0) + { + close(tempfile) + return line + } + if(sub(/[AEIOUY]NG/,"#UNG#",line)>0) + { + close(tempfile) + return line + } + if(sub(/UN /,"#UNG# ",line)>0) + { + close(tempfile) + return line + } + if(sub(/U\.?$/,"#UNG# ",$0)>0) + { + close(tempfile) + return line + } + } + close(tempfile) + return "Ung" +} + +function preparebb(rh) +{ + gsub(/\*\*/,"¤",rh) + gsub(/\*[^\*]+\*/,"±&±",rh) + gsub(/±\*/,"[i]",rh) + gsub(/\*±/,"[/i]",rh) + gsub(/¤/,"*",rh) + + gsub(/__/,"¤",rh) + gsub(/_[^_]+_/,"±&±",rh) + gsub(/±_/,"[u]",rh) + gsub(/_±/,"[/u]",rh) + gsub(/¤/,"_",rh) + + gsub(/##/,"¤",rh) + gsub(/#[^#]+#/,"±&±",rh) + gsub(/±#/,"[b]",rh) + gsub(/#±/,"[/b]",rh) + gsub(/¤/,"#",rh) + + gsub(/\$\$/,"¤",rh) + gsub(/\$[^\$]+\$/,"±&±",rh) + gsub(/±\$/,"[size=80]",rh) + gsub(/\$±/,"[/size]",rh) + gsub(/¤/,"$",rh) + + return (textonly==""?htmlescape(rh):rh) +} + +function preparehtml(rh) +{ + gsub(/\*\*/,"¤",rh) + gsub(/\*[^\*]+\*/,"±&±",rh) + gsub(/±\*/,"«i»",rh) + gsub(/\*±/,"«/i»",rh) + gsub(/¤/,"*",rh) + + gsub(/__/,"¤",rh) + gsub(/_[^_]+_/,"±&±",rh) + gsub(/±_/,"«u»",rh) + gsub(/_±/,"«/u»",rh) + gsub(/¤/,"_",rh) + + gsub(/##/,"¤",rh) + gsub(/#[^#]+#/,"±&±",rh) + gsub(/±#/,"«b»",rh) + gsub(/#±/,"«/b»",rh) + gsub(/¤/,"#",rh) + + gsub(/\$\$/,"¤",rh) + gsub(/\$[^\$]+\$/,"±&±",rh) + gsub(/±\$/,"«span style=\"font-size: 80%;\"»",rh) + gsub(/\$±/,"«/span»",rh) + gsub(/¤/,"$",rh) + + rh = htmlescape(rh) + gsub(/«/,"<",rh) + gsub(/»/,">",rh) + + return rh +} + +function htmlescape(name,less,br, len,iii,escaped,ch) +{ + len=length(name) + escaped="" + for(iii=1;iii<=len;++iii) + { + ch=substr(name,iii,1); + if(ch ~ /[=<>&#\r\n\"]/) + escaped = escaped "&#"ch2dec[ch]";" + else + escaped = escaped ch + } + return escaped +} diff --git a/ongtext.c b/ongtext.c new file mode 100644 index 0000000..899993e --- /dev/null +++ b/ongtext.c @@ -0,0 +1,136 @@ +// ongtext.c (1190.bicyclesonthemoon.info/ongtext) +// ONGtext generator +// 31.01.2015 +// +// Copyright (C) 2015 Balthasar Szczepański +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include +#include +#include +#include +#include + +#define MAWK_PATH "/usr/bin/mawk" +#define AWK_ONGTEXT "/eizm/pro/ong1/ongtext.awk" +#define TEMP_PATH "/eizm/tmp/ong1/ongtext." +#define RM_PATH "/bin/rm" + +int main (int argc, char **argv) +{ + s_cgi *cgi; + pid_t sub; + int r; + + char *value; + + unsigned char format=0; + unsigned char decree=0; + unsigned char output=0; + unsigned char nohtml=0; + + char options[16]; + char temppath[247]; + char temppath2[256]; + + setvbuf(stdout, NULL, _IONBF, 0); + dup2(fileno(stdout),fileno(stderr)); + + cgi=cgiInit(); + + sprintf(temppath,"%s%lu",TEMP_PATH,(unsigned long)getpid()); + sprintf(temppath2,"tempfile=%s",temppath); + + if((value=cgiGetValue(cgi,"f"))!=NULL) + { + switch(value[0]) + { + case 'o': + format = 1; + break; + case 'u': + format = 2; + break; + } + } + + if(cgiGetValue(cgi,"d")!=NULL) + decree=1; + + if(cgiGetValue(cgi,"b")!=NULL) + output|=1; + if(cgiGetValue(cgi,"h")!=NULL) + output|=2; + if(cgiGetValue(cgi,"t")!=NULL) + nohtml=1; + + sprintf(options,"options=%s%s%s%s%s",format!=0?(format==1?"o":"u"):"",decree!=0?"d":"",(output&2)!=0?"h":"",(output&1)!=0?"b":"",nohtml!=0?"t":""); + + if(nohtml==0) + { + fputs("Content-type: text/html\n\n",stdout); + fputs("\n",stdout); + fputs("\n",stdout); + fputs("ONGtext generator • Bicycles on the Moon\n",stdout); + fputs("\n",stdout); + fputs("\n",stdout); + fputs("\n",stdout); + fputs("\"1190.bicyclesonthemoon.info\"\n",stdout); + fputs("

ONGtext generator

\n",stdout); + } + else + fputs("Content-type: text\n\n",stdout); + if(format!=0) + { + sub=fork(); + if(sub==0) + { + r=execl(MAWK_PATH,MAWK_PATH,"-f",AWK_ONGTEXT,"-v",options,"-v",temppath2,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + + sub=fork(); + if(sub==0) + { + r=execl(RM_PATH,RM_PATH,"-f",temppath,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + } + + if(nohtml==0) + { + + fputs("
With the help of mrob27's automome.
",stdout); + fputs("
\n",stdout); + fputs("
\n",stdout); + fprintf(stdout,"ONG
\n",format!=2?" checked":""); + fprintf(stdout,"UNG
\n",format==2?" checked":""); + fputs("
\n",stdout); + fprintf(stdout,"decree
\n",decree!=0?" checked":""); + fputs("
\n",stdout); + fprintf(stdout,"HTML
\n",(output&2)!=0?" checked":""); + fprintf(stdout,"BBcode
\n",(output&1)!=0?" checked":""); + fputs("
\n",stdout); + fputs("text only
\n",stdout); + fputs("
\n",stdout); + fputs("\n",stdout); + fputs("

\n",stdout); + fputs("source

\n",stdout); + fputs("1190.bicyclesonthemoon.info\n",stdout); + } + return 0; +} \ No newline at end of file diff --git a/pleaseong.c b/pleaseong.c new file mode 100644 index 0000000..5379e77 --- /dev/null +++ b/pleaseong.c @@ -0,0 +1,47 @@ +// pleaseong.c (1190.bicyclesonthemoon.info/ongoing/pleaseongthis) +// Ask the bot to post the frame +// 23.01.2015 +// +// Copyright (C) 2015 Balthasar Szczepański +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#define BOT_PATH "/eizm/pro/ong1/bot4" + +#include +#include +#include +#include +#include + +int main (int argc, char *argv[]) +{ + s_cgi *cgi; + pid_t sub; + int r; + + cgi=cgiInit(); + printf("Content-type: text\n\n"); + + fflush(stdout); + sub=fork(); + if(sub==0) + { + r=execl(BOT_PATH,BOT_PATH,"-t"/**/,"-r"/**/,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + + return 0; +} \ No newline at end of file diff --git a/post.awk b/post.awk new file mode 100644 index 0000000..2de88e5 --- /dev/null +++ b/post.awk @@ -0,0 +1,304 @@ +#// post.awk +#// The tool to post to the OTT +#// 23.03.2015 +#// +#// Copyright (C) 2015 Balthasar Szczepański +#// +#// This program is free software: you can redistribute it and/or modify +#// it under the terms of the GNU Affero General Public License as +#// published by the Free Software Foundation, either version 3 of the +#// License, or (at your option) any later version. +#// +#// This program is distributed in the hope that it will be useful, +#// but WITHOUT ANY WARRANTY; without even the implied warranty of +#// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#// GNU Affero General Public License for more details. +#// +#// You should have received a copy of the GNU Affero General Public License +#// along with this program. If not, see . + +BEGIN{ + FS="=" + fora="http://forums.xkcd.com" + useragent="\"bothasar_p (http://1190.bicyclesonthemoon.info/ongoing.htm; BFTF post bot)\"" + timecmd="date -u +\"%d %b %Y, %k:%M UTC\"" + + for(i=0;i<256;++i) + { + ch=sprintf("%c",i) + hex=sprintf("%02X",i); + ch2hex[ch]=hex + hex2ch[hex]=ch + } +}; +{ + eq=index($0,"=") + argtab[substr($0,1,eq-1)]=substr($0,eq+1) +}; +END{ + if(entitydecode(user)!=urldecode(argtab["username"])) + edit="" + + if(system("wget -q -t 3 --connect-timeout=60 --save-cookies=" cookiefile " -U " useragent " -O " tempfile " " fora "/ucp.php?mode=login")) + { + print "Pre-login fail." + exit 1 + } + while((getline cookie < cookiefile)>0) + { + if(cookie ~ /_sid/) + { + split(cookie,arr,"_sid[ \t]*") + SID=arr[2] + } + } + close(cookiefile) + print "username=" argtab["username"] "&password=" argtab["password"] "&sid=" SID "&login=Login" > postfile + close(postfile) + if(system("wget -q -t 3 --connect-timeout=60 --save-cookies=" cookiefile " --post-file=" postfile " -U " useragent " -O " tempfile " \"" fora "/ucp.php?mode=login\"")) + { + print "Login fail." + exit 1 + } + + while((getline temp < tempfile)>0) + { + if (temp ~ /
0) + { + if (tolower(line) ~ /

information/) + { + print "Unexpected h2: information\n" + getline line < tempfile + print line + exit 1 + } + + while (line!="") + { + i=match(line, //) + if(i!=0) + { + tag=substr(line,1,i) + line=substr(line,i+1) + } + else #oh no tag doesn't end on this line - whatever, I don't care. + { + tag=line + line="" + } + + + if(tag ~ /^postfile + if("&addbbcode20" in argtab) + printf ("&addbbcode20=%s",argtab["addbbcode20"])>>postfile + if(edit!="") + printf ("&message=%s",argtab["old_message"] "%0A%5Bsize%3D110%5D%5Bb%5D" argtab["subject"] "%5B%2Fb%5D%5B%2Fsize%5D%0A%5Bsize%3D80%5D" urlencode(posttime) "%5B%2Fsize%5D%0A" argtab["message"])>>postfile + else + printf ("&message=%s",argtab["message"])>>postfile + printf ("&post=%s","Submit")>>postfile + if("disable_bbcode" in argtab) + printf ("&disable_bbcode=%s",argtab["disable_bbcode"])>>postfile + if("disable_smilies" in argtab) + printf ("&disable_smilies=%s",argtab["disable_smilies"])>>postfile + if("disable_magic_url" in argtab) + printf ("&disable_magic_url=%s",argtab["disable_magic_url"])>>postfile + if("attach_sig" in argtab) + printf ("&attach_sig=%s",argtab["attach_sig"])>>postfile + if("notify" in argtab) + printf ("¬ify=%s",argtab["notify"])>>postfile + printf ("&creation_time=%s",argtab["creation_time"])>>postfile + printf ("&form_token=%s",argtab["form_token"])>>postfile + for(i=0; i>postfile + + close(postfile) + + system("sleep 1") + if(system("wget -q -t 3 --connect-timeout=60 --load-cookies=" cookiefile " --save-cookies=" cookiefile " --post-file=" postfile " -U " useragent " -O " tempfile " \"" fora "/posting.php?mode="((edit!="")?"edit&f=7&p="edit:"reply&f=7&t=101043")"\"")) + { + print "Submit fail." + exit 1 + } + + while((getline temp < tempfile)>0) + { + if (temp ~ /

information/) + { + success=1 + } + } + close(tempfile) + + if (success!=1) + { + print "Sent back to preview!" + exit INDELIVERABLE + } + + while((getline cookie < cookiefile)>0) + { + if(cookie ~ /_sid/) + { + split(cookie,arr,"_sid[ \t]*") + SID=arr[2] + break + } + } + close(cookiefile) + if(system("wget -q -t 3 --connect-timeout=60 -U " useragent " -O " tempfile " \"" fora "/ucp.php?mode=logout&sid=" SID"\"")) + { + print "Logout fail." + } + + +} +function urlencode(name,all, len,iii,escaped,ch) +{ + len=length(name) + escaped="" + for(iii=1;iii<=len;++iii) + { + ch=substr(name,iii,1); + if ((ch ~ /[a-zA-Z0-9\.\-_~]/)&&(all=="")) + escaped = escaped ch + else + escaped = escaped "%" ch2hex[ch] + } + return escaped +} +function entitydecode(ht ,i,j,un,num) +# quot, amp, lt, gt, nbsp, and decimal numbered. +{ + while ((i=match(ht, /&((#[0-9]+)|([a-zA-Z]+));/))!=0)# + { + un=un substr(ht, 1, i-1) + ht=substr(ht, i) + j=index(ht, ";") + + if(ht~/^&#/) + { + num=int(substr(ht, 3, j-3)) + un=un sprintf("%c",num) + } + else + { + num=tolower(substr(ht, 2, j-2)) + if(num == "quot") + un=un "\"" + else if(num == "amp") + un=un "&" + else if(num == "lt") + un=un "<" + else if(num == "gt") + un=un ">" + else if(num == "nbsp") + un=un "\xA0" + else + un = un ht + } + ht=substr(ht, j+1) + } + un=un ht + return un +} +function urldecode(ht ,i,j,un,num) +# quot, amp, lt, gt, nbsp, and decimal numbered. +{ + while ((i=match(ht, /%[0-9a-fA-F][0-9a-fA-F]/))!=0)# + { + un=un substr(ht, 1, i-1) + ht=substr(ht, i) + num=toupper(substr(ht, 2, 2)) + un=un hex2ch[num] + ht=substr(ht, 4) + } + un=un ht + return un +} diff --git a/post.cpp b/post.cpp new file mode 100644 index 0000000..72c5974 --- /dev/null +++ b/post.cpp @@ -0,0 +1,538 @@ +// post.cpp (1190.bicyclesonthemoon.info/ct-if-p) +// The post edit interface +// 17.04.2015 +// +// Copyright (C) 2015 Balthasar Szczepański +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include +#include +#include +#include +#include +#include +#include + +#define RM_PATH "/bin/rm" +#define MV_PATH "/bin/mv" +#define CAT_PATH "/bin/cat" +#define MAWK_PATH "/usr/bin/mawk" + +#define POST_PATH "/eizm/www/time/aftertime/bftf/post.htm" +#define INFO_PATH "/eizm/www/time/aftertime/bftf/info.htm" +#define MPOST_PATH "/eizm/mem/ong1/mpost/wait/" +// #define MLIST_PATH "/eizm/mem/ott/mlistaaa" +// #define MLAST_PATH "/eizm/mem/ottmirror/mlist/lastaaa" +// #define MFRONT_PATH "/eizm/www/time/ott/mfrontaaa" + +#define AWK_PREVIEW "/eizm/pro/ong1/preview.awk" +#define AWK_VIEW "/eizm/pro/ong1/view.awk" +#define TEMP_PATH "/eizm/tmp/ong1/preview." +#define AWK_B2H "/eizm/pro/ong1/bb2html.awk" +#define DELIVER_PATH "/eizm/pro/ong1/deliver" + +s_cgi *cgi; +pid_t sub; +int r; +FILE *tempfile; +FILE *postfile; +bool tf=false; +bool pf=false; +char temppath[256]=""; +char postpath[256]=""; +bool fff; + +char zero='\0'; +char *username = &zero; +char *subject = &zero; +char *message = &zero; +char *y = &zero; +char *m = &zero; +char *d = &zero; +char *Preview = &zero; +char *post =&zero; +char *addquote =&zero; +char *fy = &zero; +char *fm = &zero; +char *fd = &zero; +char *forcetime = &zero; +char *hidden = &zero; +char wrong[256]; + +void submit(); +void preview (const char *text); +void writeArg(FILE *file,const char *name,const char *value, bool all); +void writeArg(FILE *file,const char *name,const char *value, char *insert); +void writeArgH(FILE *file,const char *name,const char *value, unsigned char br); +void writeArgH(FILE *file,const char *value); +void end(int m); + +void end(int m) +{ + if(tf) + fclose(tempfile); + if(pf) + fclose(postfile); + sub=fork(); + if(sub==0) + { + r=execl(RM_PATH,RM_PATH,"-f",temppath,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(pf) + { + sub=fork(); + if(sub==0) + { + r=execl(RM_PATH,RM_PATH,"-f",postpath,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + } + exit(m); +} + +void writeArg(FILE *file,const char *name,const char *value, bool all=false) +{ + unsigned short length, i, v; + fprintf(file,"%s=",name); + for(i=0, length=strlen(value);i='0'&&value[i]<='9')||(value[i]>='A'&&value[i]<='Z')||(value[i]>='a'&&value[i]<='z') + ||value[i]=='.'||value[i]=='~'||value[i]=='-'||value[i]=='_')&&(!all)) + fputc(v,file); + else + fprintf(file,"%%%02X",v); + } + fputc('\n',file); +} + +void writeArg(FILE *file,const char *name,const char *value, char *insert) +{ + unsigned short length, i, v; + fprintf(file,"%s=",name); + for(i=0, length=strlen(insert);i='0'&&insert[i]<='9')||(insert[i]>='A'&&insert[i]<='Z')||(insert[i]>='a'&&insert[i]<='z') + ||insert[i]=='.'||insert[i]=='~'||insert[i]=='-'||insert[i]=='_') + fputc(v,file); + else + fprintf(file,"%%%02X",v); + } + for(i=0, length=strlen(value);i='0'&&value[i]<='9')||(value[i]>='A'&&value[i]<='Z')||(value[i]>='a'&&value[i]<='z') + ||value[i]=='.'||value[i]=='~'||value[i]=='-'||value[i]=='_') + fputc(v,file); + else + fprintf(file,"%%%02X",v); + } + fputc('\n',file); +} + +void writeArgH(FILE *file,const char *name,const char *value, unsigned char br=0) +{ + unsigned short length, i, v; + fprintf(file,"%s=",name); + for(i=0, length=strlen(value);i"); + case '\r': + if(br&0x01) + break; + case '=': + case '<': + case '>': + case '&': + fprintf(file,"&#%hu;",v); + break; + default: + fputc(v,file); + } + } + fputc('\n',file); +} + +void writeArgH(FILE *file,const char *value) +{ + unsigned short length, i, v; + for(i=0, length=strlen(value);i': + case ' ': + case '\r': + case '\n': + case '=': + fprintf(file,"&#%hu;",v); + break; + default: + fputc(v,file); + } + } +} + +void submit() +{ + time_t posttime; + struct tm *nowS; + char timetext[32]; + char timenumber[32]; + char yy[8]; + char mm[4]; + char dd[4]; + char yyy[8]; + char mmm[4]; + char ddd[4]; + char arg1[256]; + unsigned char tm, td; + unsigned short ty; + bool deliver=false; + + posttime=time(NULL); + nowS=localtime(&posttime); + if(y[0]!='\0'){sscanf(y,"%hu",&ty); sprintf(yyy,"%04hu",ty); } + if(m[0]!='\0'){sscanf(m,"%hhu",&tm);sprintf(mmm,"%02hhu",tm);} + if(d[0]!='\0'){sscanf(d,"%hhu",&td);sprintf(ddd,"%02hhu",td);} + + if(!fff) + { + if((ty==1900+nowS->tm_year)&&(tm==1+nowS->tm_mon)&&(td==nowS->tm_mday)) + preview("Can't send this mesage to the same day it came from."); + if(ty<1900+nowS->tm_year) + preview("Can't send this mesage to the past. It wasn't received in the past."); + else if(ty==1900+nowS->tm_year) + { + if(tm<1+nowS->tm_mon) + preview("Can't send this mesage to the past. It wasn't received in the past."); + else if(tm==1+nowS->tm_mon) + { + if(td<=nowS->tm_mday) + preview("Can't send this mesage to the past. It wasn't received in the past."); + } + } + } + else if((ty==1900+nowS->tm_year)&&(tm==1+nowS->tm_mon)&&(td==nowS->tm_mday)) + deliver=true; + + sprintf(timenumber,"%llu",(unsigned long long)posttime); + if(forcetime[0]!='\0') + sprintf(timetext,"%s",forcetime); + else + strftime(timetext,31,"%e.%m.%Y %H:%M",gmtime(&posttime)); + sprintf(postpath,"%s%s",MPOST_PATH,timenumber); + + if(fd[0]!='\0'&&fy[0]!='\0'&&fm[0]!='\0') + { + sprintf(yy,"%s",fy); + sprintf(mm,"%s",fm); + sprintf(dd,"%s",fd); + } + else + { + posttime+=86400; + nowS=localtime(&posttime); + sprintf(yy,"%04d",1900+nowS->tm_year); + sprintf(mm,"%02d",1+nowS->tm_mon); + sprintf(dd,"%2d",nowS->tm_mday); + } + + tempfile=fopen(temppath,"wt"); + if(tempfile==NULL) + preview("Couldn't create file."); + tf=true; + writeArgH(tempfile,"timenumber",timenumber); + writeArgH(tempfile,"timetext",timetext); + writeArgH(tempfile,"BBHTML",message,1); + writeArgH(tempfile,"BB",message,3); + writeArgH(tempfile,"username_h",username); + writeArgH(tempfile,"subject_h",subject); + if(d[0]!='\0')writeArgH(tempfile,"d",ddd); + if(m[0]!='\0')writeArgH(tempfile,"m",mmm); + if(y[0]!='\0')writeArgH(tempfile,"y",yyy); + writeArgH(tempfile,"yy",yy,2); + writeArgH(tempfile,"mm",mm,2); + writeArgH(tempfile,"dd",dd,2); + writeArgH(tempfile,"disable_smilies","on"); + fclose(tempfile); + tf=false; + + printf("Content-type: text/html\n\n"); + sprintf(arg1,"outfile=%s",temppath); + fflush(stdout); + sub=fork(); + if(sub==0) + { + setvbuf(stdout, NULL, _IONBF, 0); + dup2(fileno(stdout),fileno(stderr)); + r=execl(MAWK_PATH,MAWK_PATH,"-f",AWK_B2H,"-v",arg1,temppath,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + + sub=fork(); + if(sub==0) + { + r=execl(MV_PATH,MV_PATH,temppath,postpath,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + // preview("Couldn't add post to queue."); + preview(postpath); + + sprintf(arg1,"info=

This message has been sent successfully.

View your submitted message

Return to the chronotransponder time interface

",timenumber,(fff?"&fff=fff":""),(fff?"?fff=fff":"")); + // printf("Content-type: text/html\n\n"); + fflush(stdout); + sub=fork(); + if(sub==0) + { + r=execl(MAWK_PATH,MAWK_PATH,"-f",AWK_VIEW,"-v",arg1,INFO_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + printf("%s",arg1); + + if(deliver) + { + fflush(stdout); + sub=fork(); + if(sub==0) + { + r=execl(DELIVER_PATH,DELIVER_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + } + + end(0); +} +void preview (const char *text) +{ + char arg1[256]; + time_t posttime; + struct tm *nowS; + char yy[8]; + char mm[4]; + char dd[4]; + unsigned short ty; + unsigned char tm,td; + + tempfile=fopen(temppath,"wt"); + if(tempfile==NULL) + end(1); + tf=true; + + if(d[0]=='\0'&&y[0]=='\0'&&m[0]=='\0') + { + posttime=time(NULL); + posttime+=86400; + nowS=localtime(&posttime); + sprintf(yy,"%04d",1900+nowS->tm_year); + sprintf(mm,"%02d",1+nowS->tm_mon); + sprintf(dd,"%2d",nowS->tm_mday); + } + else + { + if(y[0]!='\0'){sscanf(y,"%hu",&ty); sprintf(yy,"%04hu",ty); } + if(m[0]!='\0'){sscanf(m,"%hhu",&tm);sprintf(mm,"%02hhu",tm);} + if(d[0]!='\0'){sscanf(d,"%hhu",&td);sprintf(dd,"%02hhu",td);} + } + + writeArgH(tempfile,"HTML",message,1); + writeArgH(tempfile,"BB",message,3); + writeArgH(tempfile,"wrong",text); + writeArgH(tempfile,"username",username); + writeArgH(tempfile,"subject",subject); + writeArgH(tempfile,"message",message); + if(d[0]!='\0')writeArgH(tempfile,"d",dd); + if(m[0]!='\0')writeArgH(tempfile,"m",mm); + if(y[0]!='\0')writeArgH(tempfile,"y",yy); + writeArgH(tempfile,"dd",fd); + writeArgH(tempfile,"mm",fm); + writeArgH(tempfile,"yy",fy); + writeArgH(tempfile,"forcetime",forcetime); + writeArgH(tempfile,"disable_smilies","on"); + writeArgH(tempfile,"addquote",addquote); + writeArgH(tempfile,"hidden",hidden); + fclose(tempfile); + tf=false; + + printf("Content-type: text/html\n\n"); + + sprintf(arg1,"outfile=%s",temppath); + fflush(stdout); + sub=fork(); + if(sub==0) + { + setvbuf(stdout, NULL, _IONBF, 0); + dup2(fileno(stdout),fileno(stderr)); + r=execl(MAWK_PATH,MAWK_PATH,"-f",AWK_B2H,"-v",arg1,temppath,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + + // printf("Content-type: text/html\n\n"); + sprintf(arg1,"argfile=%s",temppath); + fflush(stdout); + sub=fork(); + if(sub==0) + { + r=execl(MAWK_PATH,MAWK_PATH,"-f",AWK_PREVIEW,"-v",arg1,"-v",fff?"fff=fff":"f=f",POST_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + printf("

Ch*rpin* M*stard

"); + end(0); +} + +int main() +{ + bool missing=false; + + char *arg; + + cgi=cgiInit(); + fff=(cgiGetValue(cgi,"fff")!=NULL); + + sprintf(temppath,"%s%lu",TEMP_PATH,(unsigned long)getpid()); + + arg=cgiGetValue(cgi,"username"); + if(arg!=NULL) + username=arg; + else + { + missing=true; + strcpy(wrong,"Name is missing."); + } + + arg=cgiGetValue(cgi,"subject"); + if(arg!=NULL) + subject=arg; + else + { + missing=true; + strcpy(wrong,"Subject was missing. Replaced with default value."); + } + + arg=cgiGetValue(cgi,"message"); + if(arg!=NULL) + message=arg; + else + { + missing=true; + strcpy(wrong,"Post is empty."); + } + + arg=cgiGetValue(cgi,"y"); + if(arg!=NULL) + y=arg; + else + { + missing=true; + strcpy(wrong,"Time not specified."); + } + + arg=cgiGetValue(cgi,"m"); + if(arg!=NULL) + m=arg; + else + { + missing=true; + strcpy(wrong,"Time not specified."); + } + + arg=cgiGetValue(cgi,"d"); + if(arg!=NULL) + d=arg; + else + { + missing=true; + strcpy(wrong,"Time not specified."); + } + + arg=cgiGetValue(cgi,"yy"); + if(arg!=NULL) + fy=arg; + + arg=cgiGetValue(cgi,"mm"); + if(arg!=NULL) + fm=arg; + + arg=cgiGetValue(cgi,"dd"); + if(arg!=NULL) + fd=arg; + + arg=cgiGetValue(cgi,"forcetime"); + if(arg!=NULL) + forcetime=arg; + + arg=cgiGetValue(cgi,"Preview"); + if(arg!=NULL) + Preview=arg; + + arg=cgiGetValue(cgi,"post"); + if(arg!=NULL) + post=arg; + + arg=cgiGetValue(cgi,"q"); + if(arg!=NULL) + addquote=arg; + + arg=cgiGetValue(cgi,"hidden"); + if(arg!=NULL) + hidden=arg; + + if(strcmp(post,"Submit")==0) + { + if(missing) + preview(wrong); + else + submit(); + } + else + preview(""); + + return 0; + +} diff --git a/posted.awk b/posted.awk new file mode 100644 index 0000000..c574256 --- /dev/null +++ b/posted.awk @@ -0,0 +1,38 @@ +#// posted.awk +#// Display one entry in the post list +#// 05.10.2014 +#// +#// Copyright (C) 2014 Balthasar Szczepański +#// +#// This program is free software: you can redistribute it and/or modify +#// it under the terms of the GNU Affero General Public License as +#// published by the Free Software Foundation, either version 3 of the +#// License, or (at your option) any later version. +#// +#// This program is distributed in the hope that it will be useful, +#// but WITHOUT ANY WARRANTY; without even the implied warranty of +#// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#// GNU Affero General Public License for more details. +#// +#// You should have received a copy of the GNU Affero General Public License +#// along with this program. If not, see . + +BEGIN{ + FS="=" +}; +{ + gsub(/[\r\n]/,"",$0) + eq=index($0,"=") + argtab[substr($0,1,eq-1)]=substr($0,eq+1) +}; +END{ + if(cat=="wt" && argtab["hidden"]!="" && fff=="") + exit 1 + if (r2==0) + class="plw" + else + class="plv" + + # print ""argtab["timetext"]""argtab["d"]"."argtab["m"]"."argtab["y"]""argtab["username_h"]""argtab["subject_h"]"
view quote
" + print ""argtab["timetext"]""argtab["d"]"."argtab["m"]"."argtab["y"]""argtab["username_h"]""argtab["subject_h"]"view quote remove" +} \ No newline at end of file diff --git a/posted.c b/posted.c new file mode 100644 index 0000000..ef4e19f --- /dev/null +++ b/posted.c @@ -0,0 +1,163 @@ +// posted.c (1190.bicyclesonthemoon.info/ct-if) +// Display the post list +// 23.11.2014 +// +// Copyright (C) 2014 Balthasar Szczepański +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include +#include +#include +#include +#include + +#define TEMP_PATH "/eizm/tmp/ong1/posted." +#define MPOST_PATH "/eizm/mem/ong1/mpost/" +#define WAIT_PATH "/eizm/mem/ong1/mpost/wait/" +#define LS_PATH "/bin/ls" +#define RM_PATH "/bin/rm" +#define MAWK_PATH "/usr/bin/mawk" +#define AWK_POSTED "/eizm/pro/ong1/posted.awk" + +s_cgi *cgi; +pid_t sub; +int r; + +int main(int argc, char **argv) +{ + char temppath[256]=""; + char line[32]; + char filename[32]; + char postpath[256]; + FILE *tempfile; + // FILE *postfile; + unsigned char i; + unsigned char fff; + // dup2(fileno(stdout),fileno(stderr)); + cgi=cgiInit(); + fff=(cgiGetValue(cgi,"fff")!=NULL); + + sprintf(temppath,"%s%lu",TEMP_PATH,(unsigned long)getpid()); + + printf("Content-type: text/html\n\n"); + printf("\n"); + printf("\n"); + printf("Chronotransponder test interface • Bicycles on the Moon\n"); + printf("\n"); + printf("\n"); + printf("\n"); + printf("\"1190.bicyclesonthemoon.info\"\n"); + printf("

Chronotransponder test interface

\n"); + + fflush(stdout); + sub=fork(); + if(sub==0) + { + if(freopen(temppath,"wt",stdout)==NULL) + exit(255); + r=execl(LS_PATH,LS_PATH,"-1","--color=never",MPOST_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + printf("No messages.
\n"); + else + { + printf("\n"); + printf("\n"); + + tempfile=fopen(temppath,"rt"); + if(tempfile!=NULL) + { + for(i=0; fgets(line,31,tempfile)!=NULL; ++i) + { + sscanf(line,"%s",filename); + sprintf(postpath,"%s%s",MPOST_PATH,filename); + + fflush(stdout); + sub=fork(); + if(!sub) + { + r=execl(MAWK_PATH,MAWK_PATH,"-f",AWK_POSTED,"-v",i&0x1?"r2=1":"r2=0","-v","cat=ct","-v",fff?"fff=fff":"f=f",postpath,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + + } + fclose(tempfile); + } + printf("
CT
sentreceivedauthorsubjectaction

Send a message
\n",fff?"?fff=fff":""); + + } + + // if(fff) + // { + fflush(stdout); + sub=fork(); + if(sub==0) + { + if(freopen(temppath,"wt",stdout)==NULL) + exit(255); + r=execl(LS_PATH,LS_PATH,"-1","--color=never",WAIT_PATH,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + printf("No messages.
\n"); + else + { + printf("
\n"); + printf("\n"); + + tempfile=fopen(temppath,"rt"); + if(tempfile!=NULL) + { + for(i=0; fgets(line,31,tempfile)!=NULL; ++i) + { + sscanf(line,"%s",filename); + sprintf(postpath,"%s%s",WAIT_PATH,filename); + + fflush(stdout); + sub=fork(); + if(!sub) + { + r=execl(MAWK_PATH,MAWK_PATH,"-f",AWK_POSTED,"-v",i&0x1?"r2=1":"r2=0","-v","cat=wt","-v",fff?"fff=fff":"f=f",postpath,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + --i; + + } + fclose(tempfile); + } + + printf("
WAIT
sentto be receivedauthorsubjectaction
%s\n",fff?"
Force delivery
":""); + } +// } + + printf("
1190.bicyclesonthemoon.info\n"); + + fflush(stdout); + sub=fork(); + if(sub==0) + { + r=execl(RM_PATH,RM_PATH,"-f",temppath,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + + return 0; +} diff --git a/preview.awk b/preview.awk new file mode 100644 index 0000000..800d4d8 --- /dev/null +++ b/preview.awk @@ -0,0 +1,165 @@ +#// preview.awk +#// Preview a post in the post edit interface +#// 05.10.2014 +#// +#// Copyright (C) 2014 Balthasar Szczepański +#// +#// This program is free software: you can redistribute it and/or modify +#// it under the terms of the GNU Affero General Public License as +#// published by the Free Software Foundation, either version 3 of the +#// License, or (at your option) any later version. +#// +#// This program is distributed in the hope that it will be useful, +#// but WITHOUT ANY WARRANTY; without even the implied warranty of +#// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#// GNU Affero General Public License for more details. +#// +#// You should have received a copy of the GNU Affero General Public License +#// along with this program. If not, see . + +BEGIN{ + postpath="/eizm/mem/ong1/mpost/" + waitpath="/eizm/mem/ong1/mpost/wait/" + + HTML="
Preview: %s
%s

" + wrong="
%s
\n" + subject="\n" + username="\n" + time="day: month: year: \n" + message="\n" + forcetime1="\n" + forcetime2="fTime: day: month: year: \n" + future="" + img="" + back="back to the chronotransponder interface\n" + hidden="\n" + addquote="" + + # print "" + close(argfile) + if(argtab["addquote"] ~ /^[cw]t[0-9]+$/) + { + if(argtab["addquote"] ~ /^ct[0-9]+$/) + argfile= postpath substr(argtab["addquote"],3) + if(argtab["addquote"] ~ /^wt[0-9]+$/) + argfile= waitpath substr(argtab["addquote"],3) + #else + #argfile is not changed = quote self? + while((getline argline < argfile)>0) + { + gsub(/[\r\n]/,"",argline) + eq=index(argline,"=") + if(argline ~ /^BBHTML=/) + { + addquotehtml=substr(argline,eq+1) + gsub(/
/,"\n",addquotehtml) + } + if(argline ~ /^username_h=/) + addquotename=substr(argline,eq+1) + if(argline ~ /^subject_h/) + { + addquotesub=substr(argline,eq+1) + if(addquotesub ~ /^Re:/) + argtab["subject"]=addquotesub + else + argtab["subject"]="Re: "addquotesub + } + if(argline ~ /^timetext/) + { + addquotetime=", at "substr(argline,eq+1) + } + if(argline ~ /^yy=/) + { + argtab["y"]=substr(argline,eq+1) + } + if(argline ~ /^dd=/) + { + argtab["d"]=substr(argline,eq+1) + } + if(argline ~ /^mm=/) + { + argtab["m"]=substr(argline,eq+1) + } + if(argline ~ /^y=/) + { + argtab["yy"]=substr(argline,eq+1) + } + if(argline ~ /^d=/) + { + argtab["dd"]=substr(argline,eq+1) + } + if(argline ~ /^m=/) + { + argtab["mm"]=substr(argline,eq+1) + } + } + close(argfile) + if(addquotehtml!="") + addquote="[quote=""addquotename addquotetime""]"addquotehtml"[/quote]" + } +}; +{ + if ($0 ~ /^###HTML/) + { + if((argtab["HTML"]!="")&&(argtab["wrong"]=="")) + printf(HTML,argtab["subject"],argtab["HTML"]) + } + else if ($0 ~ /^###wrong/) + { + if(argtab["wrong"]!="") + printf(wrong,argtab["wrong"]) + } + else if ($0 ~ /^###subject/) + printf(subject,((argtab["subject"]=="")?"???":argtab["subject"])) + else if ($0 ~ /^###username/) + printf(username,argtab["username"]) + else if ($0 ~ /^###message/) + printf(message,argtab["message"],addquote) + else if ($0 ~ /^###time/) + printf(time,argtab["d"],argtab["m"],argtab["y"]) + else if ($0 ~ /^###forcetime1/) + { + if(fff!="") + printf(forcetime1,argtab["forcetime"]) + } + else if ($0 ~ /^###forcetime2/) + { + if(fff!="") + printf(forcetime2,argtab["dd"],argtab["mm"],argtab["yy"]) + } + else if ($0 ~ /^###future/) + { + if(fff!="") + print future + } + else if ($0 ~ /^###hidden/) + { + if(fff!="") + printf(hidden,argtab["hidden"]) + } + else if ($0 ~ /^###img/) + { + if(fff!="") + print img + } + else if ($0 ~ /^###back/) + { + printf(back,fff!=""?"?fff=fff":"") + } + else if ($0 ~ /^###debug/) + { + gsub(/###nl;/,"\n",argtab["debug"]) + gsub(/-/," - ",argtab["debug"]) + print "" + } + else + print $0 +}; diff --git a/related.awk b/related.awk new file mode 100644 index 0000000..943493e --- /dev/null +++ b/related.awk @@ -0,0 +1,35 @@ +#// related.awk +#// find an ONGed frame +#// 29.10.2014 +#// +#// Copyright (C) 2014 Balthasar Szczepański +#// +#// This program is free software: you can redistribute it and/or modify +#// it under the terms of the GNU Affero General Public License as +#// published by the Free Software Foundation, either version 3 of the +#// License, or (at your option) any later version. +#// +#// This program is distributed in the hope that it will be useful, +#// but WITHOUT ANY WARRANTY; without even the implied warranty of +#// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#// GNU Affero General Public License for more details. +#// +#// You should have received a copy of the GNU Affero General Public License +#// along with this program. If not, see . + +BEGIN{ + related=0; + regexp=sprintf("(ongoing\\.((png)|(htm))\\?f=0*%lu)|(bftf-%04lu)",frame,frame) + printf(" \"" regexp "\"") +}; +{ + if ($0 ~ regexp) + { + related=1; + printf(" - already ONGed."); + exit related; + } +}; +END{ + exit related; +} diff --git a/relink.c b/relink.c new file mode 100644 index 0000000..5dceb41 --- /dev/null +++ b/relink.c @@ -0,0 +1,63 @@ +// relink.c (1190.bicyclesonthemoon.info/ongoing.png (old)) +// redirect to the latest frame +// 06.04.2015 +// +// Copyright (C) 2015 Balthasar Szczepański +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#define ONG_STATE_PATH "/eizm/data/aftertime/bftf/ongstate" +#define RELINK_PATH "/ongframe.png?f=%hu" + +#include +#include + +s_cgi *cgi; + +int main (int argc, char *argv[]) +{ + FILE *file; + char relinkPath[256]; + unsigned short ongFrame; + unsigned char ongState; + + cgi=cgiInit(); + + file=fopen(ONG_STATE_PATH,"rt"); + if(file!=NULL) + { + fscanf(file,"%hhu %hu",&ongState,&ongFrame); + fclose(file); + } + else + { + ongState=0; + ongFrame=0; + } + + if(ongState==1) + { + file=fopen(ONG_STATE_PATH,"wt"); + if(file!=NULL) + { + fprintf(file,"2 %hu",ongFrame); + fclose(file); + } + } + + sprintf(relinkPath,RELINK_PATH,(unsigned short)ongFrame); + cgiRedirect(relinkPath); + + return 0; +} \ No newline at end of file diff --git a/remove.c b/remove.c new file mode 100644 index 0000000..ee1bf66 --- /dev/null +++ b/remove.c @@ -0,0 +1,107 @@ +// remove.c (1190.bicyclesonthemoon.info/ct-if-r) +// remove a post +// 23.11.2014 +// +// Copyright (C) 2014 Balthasar Szczepański +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include +#include +#include +#include +#include + +#define POST_PATH "/eizm/mem/ong1/mpost/" +#define WAIT_PATH "/eizm/mem/ong1/mpost/wait/" +#define RMOV_PATH "/eizm/mem/ong1/mpost/rm/" +#define MV_PATH "/bin/mv" + +int main(int argc, char **argv) +{ + s_cgi *cgi; + pid_t sub; + int r; + unsigned char fff; + + char zero='\0'; + char *rmov = &zero; + char *arg; + char inpath[256]; + char outpath[256]; + + cgi=cgiInit(); + + fff=(cgiGetValue(cgi,"fff")!=NULL); + if(cgiGetValue(cgi,"no")!=NULL) + { + cgiRedirect(fff?"/ct-if?fff=fff":"/ct-if"); + return(0); + } + + if(cgiGetValue(cgi,"yes")==NULL) + { + arg=cgiGetValue(cgi,"r"); + if(arg!=NULL) + rmov=arg; + printf("Content-type: text/html\n\n"); + printf("\n"); + printf("\n"); + printf("Chronotransponder test interface • Bicycles on the Moon\n"); + printf("\n"); + printf("\n"); + printf("\n"); + printf("\n"); + printf("\"1190.bicyclesonthemoon.info\"\n"); + printf("

Chronotransponder test interface

\n"); + printf("
\n"); + printf("Remove message %s?
\n",rmov); + if(fff) + printf("\n"); + printf("\n"); + printf("\n"); + printf("\n",rmov); + printf("

1190.bicyclesonthemoon.info\n"); + return 0; + } + + arg=cgiGetValue(cgi,"r"); + if(arg==NULL) + { + cgiRedirect(fff?"/ct-if?fff=fff":"/ct-if"); + return(0); + } + rmov=arg; + + if(rmov[0]=='c'&&rmov[1]=='t') + sprintf(inpath,"%s%s",POST_PATH,rmov+2); + else if(rmov[0]=='w'&&rmov[1]=='t') + sprintf(inpath,"%s%s",WAIT_PATH,rmov+2); + else + { + cgiRedirect(fff?"/ct-if?fff=fff":"/ct-if"); + return(0); + } + sprintf(outpath,"%s%s",RMOV_PATH,rmov+2); + + sub=fork(); + if(sub==0) + { + r=execl(MV_PATH,MV_PATH,inpath,outpath,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + cgiRedirect(fff?"/ct-if?fff=fff":"/ct-if"); + return 0; +} \ No newline at end of file diff --git a/spoiler.c b/spoiler.c new file mode 100644 index 0000000..ec1182d --- /dev/null +++ b/spoiler.c @@ -0,0 +1,114 @@ +// spoiler.c (1190.bicyclesonthemoon.info/spoiler) +// main page redundaspoiler +// 16.08.2015 +// +// Copyright (C) 2014 Balthasar Szczepański +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#define REDBUTTON 32 + +#include +#include + +s_cgi *cgi; + +int main (int argc, char *argv[]) +{ + char *value; + unsigned short n; + unsigned char open; + unsigned char discovered; + + cgi=cgiInit(); + + value=cgiGetValue(cgi,"n"); + if(value!=NULL) + sscanf(value,"%hu",&n); + else + n=0; + + open=((cgiGetValue(cgi,"o")!=NULL)?1:0); + discovered=((cgiGetValue(cgi,"d")!=NULL)?1:0); + + printf("Content-type: text/html\n\n"); + + fputs("\n",stdout); + fputs("\n",stdout); + fputs("xkcd 1190: \"Time\" • Bicycles on the Moon\n",stdout); + fputs("\n",stdout); + fputs("\n",stdout); + fputs("\n",stdout); + fputs("\n",stdout); + fputs("Hi, I'm balthasar_s and this is
\n",stdout); + fputs("\"1190.bicyclesonthemoon.info\"

\n",stdout); + fputs("Some things related to the Time thread on the xkcd Fora are here.\n",stdout); + fputs("\n",stdout); + fputs("Redundant:
\n",stdout); + fputs("
\n",stdout); + printf("
\n",open?"show":"hide"); + printf("\n",n+1); + if(discovered) + fputs("\n",stdout); + printf("Spoiler:
\n",open?"Show":"Hide"); + + if(!open) + { + fputs("\n",stdout); + + if(n==REDBUTTON) + { + fputs("
\n",stdout); + fputs("

\n",stdout); + fputs("N =
\n",stdout); + fputs("This button was supposed to be red: \n",stdout); + fputs("

\n",stdout); + fputs("

\n",stdout); + fputs("Also, enhance: \n",stdout); + } + else + { + fputs("\"I

\n",stdout); + fputs("\"1190.bicyclesonthemoon.info\"
\n",stdout); + printf("botmlogo2.png (1.24 KiB) Viewed %hu times
\n",n+1190); + fputs("\"I
\n",stdout); + printf("redunbot.jpg (83.88 KiB) Viewed %hu times
\n",n+1190); + } + } + + fputs("
\n",stdout); + + return 0; +} \ No newline at end of file diff --git a/update.c b/update.c new file mode 100644 index 0000000..04d1afa --- /dev/null +++ b/update.c @@ -0,0 +1,71 @@ +// update.c (1190.bicyclesonthemoon.info/aftertime/remove) +// update demustarded frames to viewer +// 17.04.2015 +// +// Copyright (C) 2015 Balthasar Szczepański +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#define ONG_STATE_PATH "/eizm/data/aftertime/bftf/ongstate" +#define FRAME_PRINTF "/eizm/data/aftertime/bftf/%hu.png" +#define ONGED_PRINTF "/eizm/www/time/aftertime/bftf/bftf-%04hu.png" +#define CP_PATH "/bin/cp" + +#include +#include +#include +#include + +pid_t sub; +int r; + +int main (int argc, char *argv[]) +{ + FILE *file; + unsigned short i,ongFrame; + unsigned char ongState; + char framePath[64]; + char ongedPath[64]; + + file=fopen(ONG_STATE_PATH,"rt"); + if(file!=NULL) + { + fscanf(file,"%hhu %hu",&ongState,&ongFrame); + fclose(file); + } + else + { + ongState=0; + ongFrame=0; + } + + for(i=0;i<=ongFrame;++i) + { + + sprintf(framePath,FRAME_PRINTF,i); + sprintf(ongedPath,ONGED_PRINTF,i); + + sub=fork(); + if(!sub) + { + r=execl(CP_PATH,CP_PATH,framePath,ongedPath,(char *)0); + exit(r); + } + waitpid(sub,&r,0); + if(r) + return r; + } + + return 0; +} \ No newline at end of file diff --git a/view.awk b/view.awk new file mode 100644 index 0000000..e14feea --- /dev/null +++ b/view.awk @@ -0,0 +1,57 @@ +#// view.awk +#// insert text +#// 03.09.2014 +#// +#// Copyright (C) 2015 Balthasar Szczepański +#// +#// This program is free software: you can redistribute it and/or modify +#// it under the terms of the GNU Affero General Public License as +#// published by the Free Software Foundation, either version 3 of the +#// License, or (at your option) any later version. +#// +#// This program is distributed in the hope that it will be useful, +#// but WITHOUT ANY WARRANTY; without even the implied warranty of +#// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#// GNU Affero General Public License for more details. +#// +#// You should have received a copy of the GNU Affero General Public License +#// along with this program. If not, see . + + +###reusedfrommirror; +{ + if ($0 ~ /^###sig&/) + { + split ($0 ,arr,"&") + system("cat " sig arr[2]) + } + else if ($0 ~ /^###inf&/) + { + split ($0 ,arr,"&") + system("cat " otterinf arr[2]) + } + else if ($0 ~ /^###prev/) + { + print left + } + else if ($0 ~ /^###next/) + { + print right + } + else if ($0 ~ /^###links/) + { + system ("cat " links); + } + else if ($0 ~ /^###info/) + { + print info; + } + else if ($0 ~ /^###title/) + { + print title; + } + else + { + print $0 + } +}; diff --git a/view.c b/view.c new file mode 100644 index 0000000..e2f71c4 --- /dev/null +++ b/view.c @@ -0,0 +1,110 @@ +// view.c (1190.bicyclesonthemoon.info/ongoing.png(new) 1190.bicyclesonthemoon.info/ongframe.png) +// the frame +// 06.04.2015 +// +// Copyright (C) 2015 Balthasar Szczepański +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#define ONG_STATE_PATH "/eizm/data/aftertime/bftf/ongstate" +#define CFRT_PATH "/ongoing/cfrt.png" +#define FRAME_PRINTF "/ongoing/bftf-%04hu.png" + + +#include +#include +#include + +s_cgi *cgi; + +int main (int argc, char *argv[]); +// int sendfile(char *path); + +int main (int argc, char *argv[]) +{ + FILE *file; + char *value; + char framePath[256]; + unsigned short cgiFrame, ongFrame; + unsigned char ongState; + + cgi=cgiInit(); + + file=fopen(ONG_STATE_PATH,"rt"); + if(file==NULL) + { + cgiRedirect(CFRT_PATH); + return 1; + } + fscanf(file,"%hhu %hu",&ongState,&ongFrame); + fclose(file); + + value=cgiGetValue(cgi,"f"); + if(value!=NULL) + sscanf(value,"%hu",&cgiFrame); + else + cgiFrame=ongFrame; + + if(ongState==0||cgiFrame>ongFrame) + { + cgiRedirect(CFRT_PATH); + return 0; + } + if(cgiFrame==ongFrame&&ongState==1&&cgiGetValue(cgi,"n")==NULL) + { + file=fopen(ONG_STATE_PATH,"wt"); + if(file!=NULL) + { + fprintf(file,"2 %hu",ongFrame); + fclose(file); + } + } + + sprintf(framePath,FRAME_PRINTF,cgiFrame); + cgiRedirect(framePath); + return 0; + // return sendfile(framePath); +} + +/*int sendfile(char *path) +{ + unsigned long p,i; + unsigned short q; + FILE *file; + struct stat st; + unsigned char buf[1024]; + + file=fopen(path,"rb"); + if(file==NULL) + return 1; + fstat(fileno(file),&st); + p=st.st_size/1024; + q=st.st_size%1024; + + printf("Content-Length: %lu\n",(unsigned long)(st.st_size)); + printf("Content-type: image/png\n\n"); + + for(i=0;i. + +#define TIMEFRAME 12 +#define ONG_STATE_PATH "/eizm/data/aftertime/bftf/ongstate" +#define AWK_ENHANCE "/eizm/pro/ong1/enhance.awk" +#define ENHANCE_PATH "/eizm/mem/ong1/enh/%04hu" +#define REDIRECT "/aftertime/viewer?story=bftf" + +#include +#include +#include +#include + +s_cgi *cgi; + +int main (int argc, char *argv[]) +{ + time_t now; + struct tm *nowS; + unsigned char h,m,s; + unsigned long d; + char *value; + char *bb; + char *spoiler; + char *enhance; + unsigned short cgiFrame, ongFrame; + unsigned char ongState; + char enhancepath [32]; + FILE *file; + char alttext[256]; + char redirect[256]; + + cgi=cgiInit(); + + now=time(NULL); + nowS=localtime(&now); + d=(TIMEFRAME*3600-(nowS->tm_sec+60*nowS->tm_min+3600*(nowS->tm_hour%TIMEFRAME)))%(3600*TIMEFRAME); + s=(unsigned char)(d%60); + m=(unsigned char)((d/60)%60); + h=(unsigned char)(d/3600); + + file=fopen(ONG_STATE_PATH,"rt"); + if(file!=NULL) + { + fscanf(file,"%hhu %hu",&ongState,&ongFrame); + fclose(file); + } + else + ongFrame=0; + + value=cgiGetValue(cgi,"f"); + if(value!=NULL) + sscanf(value,"%hu",&cgiFrame); + else + cgiFrame=ongFrame; + bb=cgiGetValue(cgi,"b"); + spoiler=cgiGetValue(cgi,"s"); + enhance=cgiGetValue(cgi,"e"); +#if defined REDIRECT + strcpy(redirect,REDIRECT); + if(value!=NULL) + sprintf(redirect+strlen(redirect),"&f=%s",value); + if(bb!=NULL) + sprintf(redirect+strlen(redirect),"&b=%s",bb); + if(enhance!=NULL) + sprintf(redirect+strlen(redirect),"&n=%s",enhance); + cgiRedirect(redirect); + return 0; +#endif + + if(cgiFrame>ongFrame) + { + strcpy(alttext,"You aren't supposed to see this frame now."); + printf("Status: 404 Not Found (Wait for it.)\n"); + } + else if(cgiFrame>=564) + strcpy(alttext,"I'd highly recommend following the first commandment ...again."); + else if(cgiFrame>549) + strcpy(alttext,"..."); + else if(cgiFrame==549) + strcpy(alttext,"I'd highly re"); + else if(cgiFrame>28) + strcpy(alttext,"I'd highly recommend following the first commandment."); + else + strcpy(alttext,"I'd highly recommend following the first commandment. It may not look very related now. BUT IT WILL."); + + sprintf(enhancepath,ENHANCE_PATH,cgiFrame); + + printf("Content-type: text/html\n\n"); + + puts("\n"); + puts("\n"); + puts("ONGoing • Bicycles on the Moon\n"); + puts("\n"); + puts("\n"); + puts("\n"); + puts("
\n"); + puts("\"1190.bicyclesonthemoon.info\"
\n"); + printf("

%hu

\n",cgiFrame); + puts("\n"); + if(value!=NULL) + { + puts("\n"); + if(cgiFrame>0) + printf("\n"); + if(cgiFrame%hu >\n",cgiFrame+1,cgiFrame+1); + else + puts("\n"); + printf("\n",ongFrame,ongFrame); + if(cgiFrame<=ongFrame) + { + if(bb!=NULL) + { + printf("\n"); + if(spoiler!=NULL && ongFrame==cgiFrame) + printf("\n"); + if(spoiler==NULL) + printf("\n",cgiFrame); + } + else + printf("\n",cgiFrame); + file=fopen(enhancepath,"rt"); + if(file!=NULL) + { + if(enhance==NULL) + printf("\n",cgiFrame); + else + { + puts("\n"); + } + fclose(file); + } + } + puts("\n"); + } + + puts("
\n"); + if(value!=NULL) + printf("\"the
\n",cgiFrame,alttext); + else + printf("\"the
\n",ongFrame,alttext); + puts("
"); + + if(d!=0) + printf("%02hhu:%02hhu:%02hhu\n",ongState>=2?"br":"ni",h,ongState>=2?"br":"ni",m,ongState>=2?"br":"ni",s); + else + printf("00:00:NG\n",ongState>=2?"br":"ni",ongState>=2?"br":"ni",ongState>=2?"br":"ni"); + + // printf("E:E:E\n",ongState>=2?"br":"ni",ongState>=2?"br":"ni",ongState>=2?"br":"ni"); + + puts("
| < 0< %hu\n",cgiFrame-1,cgiFrame-1); + else + puts("%hu >|
[url=http://1190.bicyclesonthemoon.info/ongoing.htm?f=%hu][img]http://1190.bicyclesonthemoon.info/ongoing/bftf-%04hu.png[/img][/url]",cgiFrame,cgiFrame); + if(spoiler!=NULL) + printf("[spoiler]%s[/spoiler]",alttext); + printf("
[]
[spoiler]
[bbcode]
[enhance]
"); + while(fgets(alttext,255,file)!=NULL) + puts(alttext); + puts("
go to frame:
\n"); + puts("1190.bicyclesonthemoon.info\n"); + puts("
\n"); + + return 0; +} \ No newline at end of file diff --git a/www/info.htm b/www/info.htm new file mode 100644 index 0000000..ceb348d --- /dev/null +++ b/www/info.htm @@ -0,0 +1,13 @@ + + +Chronotransponder test interface • Bicycles on the Moon + + + + + + +1190.bicyclesonthemoon.info +

Chronotransponder test interface

+###info +1190.bicyclesonthemoon.info diff --git a/www/npb.htm b/www/npb.htm new file mode 100644 index 0000000..2db3d27 --- /dev/null +++ b/www/npb.htm @@ -0,0 +1,29 @@ + + + + It's NewpixbOTTification time! • Bicycles on the Moon + + + + + + 1190.bicyclesonthemoon.info +

It's NewpixbOTTification time!

+
+ NewpixbOTTify by URL
+ URL of image: + + +
+
+
+ NewpixbOTTify by file upload
+ Upload the image: + + +
+
+ Source code available at svn://bicyclesonthemoon.info/npb (use "e" to login) or http://1190.bicyclesonthemoon.info/pro/npb. + + + diff --git a/www/post.htm b/www/post.htm new file mode 100644 index 0000000..7bd63bb --- /dev/null +++ b/www/post.htm @@ -0,0 +1,160 @@ + + +Chronotransponder test interface • Bicycles on the Moon + + + + + + + +1190.bicyclesonthemoon.info +

Chronotransponder test interface

+
+###debug +###future + + + +###HTML +
+
Send a message
+###wrong +
+
+ + +###forcetime2 +
Subject: +###subject +
Name: +###username +
Time: +###time +
Action: + + +###forcetime1 +
+
+
+ + + + + + + + + + + + +
+###img + + + + + + + Font size: + + +###hidden +
+ +
+
Write here:
+###message + +
+
+###back +

1190.bicyclesonthemoon.info