Join us at TNW Conference 2022 for insights into the future of tech →

The heart of tech

This article was published on June 29, 2015

    Here’s possibly the geekiest way to Rickroll someone

    Here’s possibly the geekiest way to Rickroll someone
    Mic Wright
    Story by

    Mic Wright

    Reporter, TNW

    Mic Wright is a journalist specialising in technology, music and popular culture. He lives in Dublin. He is on Twitter at @brokenbottleboy. Mic Wright is a journalist specialising in technology, music and popular culture. He lives in Dublin. He is on Twitter at @brokenbottleboy.

    The Rickroll is still one of the Web’s purest troll moves. And now there’s an easy way to bring that Astley action to the terminal.

    London-based developer Radek Pazdera has outlined a way to display images in terminal that uses just nine lines of Ruby.

    Screenshot 2015-06-29 18.26.40

    Of course, you can use it for noble acts, like sharing a lovely picture of Pikachu, but deploying it for the dark arts is even better.

    Pazdera started by combining two gems – rmagick (to read the images) and tco (to map pixels from RGB to the extended terminal color palette.)

    Screenshot 2015-06-29 18.33.48
    The sample code

    He then extended the original code to create a new gem called catpix, which includes automatic image downsizing to take account of the width of the terminal window, centring, and the ability to add custom background colors.

    As Pazdera notes in his post “people won’t fall for your Rickrolls as easily nowadays” so why not take to the terminal to trick your developer friends?

    In the ever growing universe of Rickroll tactics, this might just be my new favorite. For full details, check out his post and the full API description here.

    Printing images in the terminal with 9 lines of Ruby [Radek.io]

    Read next: Done with Cards Against Humanity? Squib is a version of Ruby for coding your own card games