Skip to content

A "Shakespearean" insult generator that may be used to insult you from a shell, or even better, via an iOS app.

License

Notifications You must be signed in to change notification settings

youngde811/willie-the-shake

 
 

Repository files navigation

Welcome to Shakespeare Slander

This project generates "Shakespearean" insults to either the terminal or via the included iOS app. Many years ago, I stumbled across the original implementation (I think); it was written in C. I took that code and wrote a screen saver for my X Window System environment on SunOS/Solaris, using Xlib. The documentation for the original work gave credit to a performer named "Lord Buckley"1, who had an act he called "Willie The Shake". The code author had apparently seen this fellow a number of times; thus the alias for this project.

I found myself needing a distraction after a particularly challenging project at work. Having discovered a newer implementation of the code on GitHub - Kurt Blair's "Shakespearean Insult Generator" - I forked his repository; re-wrote the generator in Python; and decided to include an iOS app that makes use of generated insults in an entertaining manner. The app is written in React Native and Expo, and has been released to the AppStore.

Overview

The insult generator is data-driven and written in Python 3.x. There's a small model file included in the data directory, containing 50 lines of three tokens each; this file may be used to create a large number of insult phrases. The generator may be used to insult you from a terminal, or save a configurable number of insults to a file. The latter approach is used to power the app.

Displaying an insult is simple; just run bin/generate from the project directory with no arguments. You'll receive a single offensive phrase; for example: Thou ruttish fen-sucked apple-john! If you need some functional information from this script, run bin/generate -h.

Usage

The generator offers a few command-line arguments:

Argument Description
-c COUNT Generate COUNT number of insults, writing them to either standard output or a file.
-g PATH Write some number of insults to PATH, saving them for later use. Whatever that might be.
-f PATH Use PATH as the insult generator's model file, rather than the default file provided.
-o FORMAT Output insults in FORMAT. The default is text without the -g flag; json otherwise.

As mentioned above, in the project's bin directory there is a Bash script that serves as a simple wrapper around the Python-based generator to save a small amount of typing. If you prefer, you may use your own Python interpreter directly: python3 src/generator.py. Note that Python 3 is required; the generator will not run on any 2.x version.

The Model File

The generator uses a "model file" to drive insult assembly. Each insult is created by putting three words, or fragments, in between the tokens "Thou " and "!". Each of the fragments may be thought of as a column; fragments are picked at random, one from each column of words that are supplied in the data file, using a separate random number for each. The algorithm is actually quite simple.

Using the included model file, there are 50 lines of three tokens each, allowing for 573,800 combinations: $$C(n,r) = \frac{n!}{r!(n-r)!}$$

You may use your own model file if you wish. If you create your own, it must follow a strict format: three tokens per line; each token separated by a single tab character. The generator makes an attempt to validate a model file, and fail cleanly if it gets angry.

Current Work

The offical release of the project, including the app, is 1.9.0. The app itself (Shakespeare Slander, alias WillieShake) is available on the AppStore. Shakespeare Slander is supplied with a JSON file containing insults generated by generate.py; it presents those insults as a list (along with a few pretty buttons and such). You may select one of the insults, and use your phone's default messaging app to insult anyone you wish.

Annoying Codewords

As of relese 1.8.0, Shakespeare Slander has a new drawer page that will retrieve hundreds of "code words" intended to annoy our Three Letter Agencies if they're snooping illegally (they always are). The app talks with a Python Django server I wrote that runs somewhere in the ether, and populates the new drawer page with nifty code words sure to attract attention. The Django server currently exposes just a handful of endpoints; more might be added if necessary.

I plan to add the ability to generate new sets of these codewords from the app itself. Coming soon.

General React Native Thoughts

For the most part, React Native is awesome. However, certain major components are frustrating to use and unreliable. First thing that comes to mind is React Navigation. In a word, it's awful. When it works, great. But in my exprerience, 60% of the time it's unpredicatable and a massive time sink. For example, no matter what I tried in this project, the hook useRoute() would always work, and yet the hook useNavigation() always returned { }. Even applying the basic examples. I'm not the only engineer in the community with complaints regarding navigation, so I've decided to stay far away from it.

Navigation Update

I changed my mind, and decided to give the Navigation Drawer components a try. It works now, but a lot of effort and reading when into the implementation. This stuff remains poorly documented, requiring much trial and error. But in the end, it looks nice.

License

This software is made available under the MIT License. See LICENSE.md for details.

Attributions

The insult generator itself is based on the work of Kurt Blair's Shakespearean Insult Generator.

Thank you to the following individuals for contributing excellent ideas for this project:

  • My wife Jennifer.
  • My son Adam.
  • My sister Amy.

Latest News

  • 05/06/2024: Version 1.9.0 is on the AppStore.

    • Use the cool ScalableText component for portable text scaling on different devices.
  • 05/05/2024: Version 1.8.4 is on the AppStore.

    • Added minimum font scaling.
  • 05/04/2024: Version 1.8.3 is on the AppStore.

    • Fixed font scaling across device sizes.
    • Flying Fickle Finger of Fate.
  • 05/03/2024: Version 1.8.2 is on the AppStore.

    • Added cool header to codewords drawer.
  • 05/03/2024: Version 1.8.1 is on the AppStore.

    • Added better fetch() error handling.
  • 05/02/2024: Version 1.8.0 is on the AppStore.

    • Added more codeword annoyance colors.
    • Name change to Shakespeare Slander.
  • 05/01/2024: Version 1.7.0 is on the AppStore.

    • Added codeword annoyance page.
  • 01/14/2024: Version 1.6.7 is on the AppStore.

    • Fixed season calculation algorithm.
  • 09/26/2023: Version 1.6.5 is on the AppStore.

    • Removed unnecessary console logging code.
  • 09/25/2023: Version 1.6.4 is available on the AppStore.

    • More accurate seasonal-change algorithm.
    • Small stylistic changes.
  • 09/04/2023: Version 1.6.2 is available on the AppStore.

    • New seasonal "easter egg" icons!
  • 09/02/2023: Version 1.5.3 is available on the AppStore.

    • Very nice header on the main and favorites insult pages.
    • New drawer navigation.
    • Much faster list performance.
  • 09/01/2023: Version 1.5.1 is on TestFlight now.

    • Switched to FlashList component for better list rendering and performance.
    • Nicer color scheme for drawer menu.
  • 08/31/2023: Version 1.5.0 is on TestFlight for exercising.

    • New Navigation Drawer offering the menu options that used to be in the AppBar.
    • Stylistic improvements.
  • 08/17/2023: Version 1.4.1 is out. A major release to the AppStore:

    • Context-sensitive buttons.
    • Hidden "Easter eggs".
    • Animation improvements.
    • Usability improvements.
  • 08/11/2023: Version 1.2.3 is out. Another minor feature release:

    • Added a floating icon to the insult list that, when pressed, will return to the list top and disappear.
  • 08/03/2023: Version 1.2.2 is now available; a minor feature release:

    • The clipboard is now supported on the insult lists. Just pressing an insult makes it available for pasting wherever that behavior is supported on your device.
  • 08/01/2023: Version 1.2.1 is being released to the AppStore:

    • Added nice-looking image background to Favorites modal.
    • Added master exception handler for app-level fatal errors. The handler provides users with an explanation at least; allowing them to restart the app.
  • 07/31/2023: Version 1.2.0 has been released. There is a secret level here that must be found!

  • 07/25/2023: Version 1.1.4 of the app has been approved for release on the AppStore!

  • 07/24/2023: Version 1.1.3 of the WillieShake app is available:

    • First official submission to the AppStore review process!
    • Gesture handling was added to the WebView component.
    • Documentation improvements.
  • 07/21/2023: Version 1.0.0 of the app is now available on TestApp, and is fully functional:

    • There's a new button that opens a WebView Modal, taking you to the Wikipedia page on Lord Buckley.
    • Stability and style improvements.
  • 07/17/2023: Version 0.7.2 of the app is available on TestApp. Another minor release that offers just a few enhancements:

    • An activity indicator is shown during app loading, if your internet connection is slow.
    • There's now a config file that offers some flexible properties for the app. Later I might add a capability to make changes to this file.
  • 07/14/2023: Version 0.7.1 of the app is available on TestApp. This is a small release, and really just offers a few visible improvements:

    • Buttons now offer feedback animation, using the React Pressable API.
    • One or two font improvements.
  • 07/13/2023: Version 0.7.0 of the app has been released onto TestApp.io. This release offers several enhancements:

    • Much nicer splash screen.
    • Very nice main page background image.
    • Nicer color scheme overall.
    • An AppBar button that opens your default browser and takes you directly to the GitHub project page.
    • More efficient rendering.
    • Better documentation.

Internal Testers

The current app release may be found here.

References

  • Lord Buckley's "Willie The Shake".
  • Git Flow: A successful Git branching model.
  • React Native: A fabulous iOS and Android portable development language.
  • TestApp.io: A generous and reliable place to host and share apps for testing.
  • Expo.dev: Another generous developer site that hosts app builds for both iOS and Android.

Author

David E. Young

Footnotes

  1. Lord Buckley was a weird dude, as were all of those fellows into the Beat scene.

About

A "Shakespearean" insult generator that may be used to insult you from a shell, or even better, via an iOS app.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 64.3%
  • Python 25.0%
  • Shell 5.7%
  • Rust 5.0%