Geek Moment

A geek moment today, processing the names of job applicants for inserting into a master spreadsheet.

for f in *; do echo $f; done

Followed by:

Sigh of self-satisfaction.

Tutorial: Twitter Bots

00

UPDATE 9/14: A few things have changed for setting up a Twitter application since this tutorial was written. The main change is you will need a phone number to register your app. Most of this guide should be fairly close to the current system, though the screenshots may look a bit different.

Creating Twitter bots, automated text-generators that spew spam, poetry, and other things, can be a bit of a confusing process. This tutorial will hopefully get you through the tough bits and make bot-building possible!

For this tutorial I will be using Python, a language whose simplicity and natural syntax is great for working with text. However, this tutorial should be easily portable to your language of choice. I assume you know at least enough programming to write your own algorithmic text; if you need some help, I would suggest one of the myriad resources including Learn X in Y Minutes. Finally, this post is written from a Mac user’s perspective – if you use another OS and have suggestions or required different steps, my apologies and let me know so I can add them.

If your programming is not up to snuff, you might consider using IFTTT to trigger a Tweet. While the range of possible text is much more limited, you can easily do things like post a Tweet when tomorrow’s weather is forecasted to be nice or you like a video on Vimeo! (You can also use this as a backup for storing your bot’s awesome Tweets.)

You can view the source files used here, screenshots, and other miscellany for this tutorial on GitHub.

Continue reading “Tutorial: Twitter Bots”

Grid Remix: Fellowship Of The Ring

GridRemix_ LordOfTheRings_Cover-web

Having sequestered myself for the last week, immersed in regex and InDesign, I have finished my novel for National Novel Generation Month. Code and further details available here.

The book was created algorithmically using custom software written in Python and Processing. J.R.R. Tolkien’s 1954 classic The Fellowship of the Ring was loaded word-by-word then organized into a two-dimensional grid. From a random start position in the grid, the “cursor” was moved up, down, left, or right and that word added to the new text.

The process was repeated until 50,000 words was reached, the length of an average novel.

Random commas, periods, paragraph breaks, and chapters were added along the way. Any sentence including a variation of the words “s/he said” was placed in quotes.

Continue reading “Grid Remix: Fellowship Of The Ring”

Random Walk Through A Novel

RandomWalkThroughLOTR

A test for #NaNoGenMo, or National Novel Generation Month, initiated by Darius Kazemi.

An existing text is loaded word-by-word, then organized into a 2d grid. Using a random start position in the grid, the “cursor” is moved up, down, left, or right and that word is added. The process is repeated up to 50k words. Random commas, periods, and paragraph breaks are also added along the way.

An excerpt, using “Tale of Two Cities” as a source text (the random walk is visualized above):

Jurys upon pay thousand one and one. Thousand were I than tried He tried than I were thousand seven, now were and than. I, were and than and were, thousand one. November before and were now turned now were now turned done to explain to. Tried than tried than better. Than and, before better before and were I to the to explain to when time.

More. Remarkable more remarkable of remarkable of lawwork no lawwork to do Dont. Do too Lord too Lord inquired of living in London in London in London, arisen to arisen and do to how. Known not known where up did seventyfive, stood seventyfive stood seventyfive did seventyfive stood up did up where business did seventyfive. Stood seventyfive stood had, not that not had stood again and Was, all unless the prisoners that had it had passing arts and thought of powers of thought been more knew was knew they knew. More slowly the slowly. The slowly nothing about the and the about nothing taken off about off taken, prisoner in off taken off That the. That. The about nothing about nothing taken off about the about nothing slowly. Nothing knew they been. They. That had it Some it had passing thought and powers of the slowly the infamy the of selfdeceit infamy selfdeceit of.

Another example, with repetition allowed (LOTR as source):

Help would help would help would judgement For help for help help for them, for who would judgement For For help For even even even even, the even it at looked and and, and again death death friends who who who in death out pocket out death out death death friends friends friends task easy easy an first an fine, deal his pocket his of his of of chosen and his deal his deal fine fine his first first his were him him were There There tracked tracked that find is. Begins to grip But as as far far as as But too too clear Making far far far as to as as out as task friends task friends who who for who who for them them for for Gollums out as.

Source code and texts here: https://github.com/jeffThompson/NaNoGenMo

Glossary from “Old Mortality”

The “glossary” section from Sir Walter Scott’s book “Old Mortality, Volume 2”, what appears to be the oldest book in the Project Gutenberg collection of the Internet Archive. Not sure what it is supposed to be a glossary of, but a weird collection to be sure:

A’, all.
A’body, everybody.
Aboon, abune, above.
Ae, one.
Aff, off.
Afore, before.
Again, against, until.
Ahint, behind.
Ain, own.
Ajee, awry.
Amaist, almost.
Amna, am not.
Continue reading “Glossary from “Old Mortality””

Most Frequent Word Search

For the past few months I’ve been working on a curatorial project with the Internet Archive, to be released on their Tumblr account early next year. One of the experiments for this project searches the Internet Archive for a given term, downloads the first result, parses the most frequent word and uses that as a seed for the next search. For example:

seed > plants > leaves > chinese > heaven > minerva > questo

An interesting result: this process goes from general to more and more specific until no search results are found. This is actually an interesting opposite of my Wikipedia Loops project, where a similar algorithmic path goes from specific to general, eventually falling into a meta-loop.

The code for this experiment is available here: https://gist.github.com/jeffThompson/6718129

Auto-Spam

A recent spam comment somehow failed and reveals a system that must create thousands of possible permutations. Choices are in { } and separated by |, then chosen at random.

{In addition to|Along with|As well as|Together with|Besides|In combination with|And also|Apart from|Asde from|Combined with|Not to mention}

Continue reading “Auto-Spam”