Code Monkey home page Code Monkey logo

lolcat's Introduction

What?

Screenshot

Installation

Linux

$ sudo snap install lolcat

Mac

$ brew install lolcat

lolcat's People

Contributors

a1346054 avatar d33tah avatar grimy avatar ideal avatar livibetter avatar m-o-e avatar mathieu-aubin avatar nobu avatar rhinodavid avatar sunpoet avatar thetamind avatar tiimgreen avatar vaz avatar vittgam avatar wildutah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lolcat's Issues

lolcat does not work on binary files

It appears lolcat only works on utf-8-encoded files. E.g. running lolcat /bin/cat results in

/Library/Ruby/Gems/2.0.0/gems/lolcat-42.24.0/lib/lolcat/lol.rb:53:in `gsub!': invalid byte sequence in UTF-8 (ArgumentError)

This problem was posted here before, but I am not sure how this does not relate to lolcat. Is it intended to only work with utf-8?

Crash: `gsub!': invalid byte sequence in US-ASCII (ArgumentError)

Test Case:
curl https://en.wikipedia.org/wiki/Lolcat 2>&1 | lolcat

Crashes with:
/usr/lib/ruby/gems/2.0.0/gems/lolcat-42.0.99/lib/lolcat/lol.rb:45:in gsub!': invalid byte sequence in US-ASCII (ArgumentError) from /usr/lib/ruby/gems/2.0.0/gems/lolcat-42.0.99/lib/lolcat/lol.rb:45:inprintln'
from /usr/lib/ruby/gems/2.0.0/gems/lolcat-42.0.99/lib/lolcat/lol.rb:36:in block in cat' from /usr/lib/ruby/gems/2.0.0/gems/lolcat-42.0.99/lib/lolcat/lol.rb:34:ineach_line'
from /usr/lib/ruby/gems/2.0.0/gems/lolcat-42.0.99/lib/lolcat/lol.rb:34:in each' from /usr/lib/ruby/gems/2.0.0/gems/lolcat-42.0.99/lib/lolcat/lol.rb:34:incat'
from /usr/lib/ruby/gems/2.0.0/gems/lolcat-42.0.99/lib/lolcat/cat.rb:113:in block in cat!' from /usr/lib/ruby/gems/2.0.0/gems/lolcat-42.0.99/lib/lolcat/cat.rb:107:ineach'
from /usr/lib/ruby/gems/2.0.0/gems/lolcat-42.0.99/lib/lolcat/cat.rb:107:in cat!' from /usr/lib/ruby/gems/2.0.0/gems/lolcat-42.0.99/bin/lolcat:25:in<top (required)>'
from /usr/bin/lolcat:23:in load' from /usr/bin/lolcat:23:in

'

add an --export-to-file flag?

I love lolcat but it can sometimes be a hard sell convincing clients to install it into their production servers to render something like the MOTD dynamically instead of having a static file in /etc/motd.

I tried to pipe lolcat's output to a file/less/more/expect but I've been unsuccessful so far.

I would love to know if there is a tool already for this. Otherwise, it be great we could implement a flag like --export-to-file option where all the special color characters are used.

Not working with all unicode characters

Does not fully support utf-8 encoded files (characters). Tested with this file http://pastebin.com/MVp3Dz5x and got the following error:

> cat utf.txt | lolcat
/Library/Ruby/Gems/2.0.0/gems/lolcat-42.1.0/lib/lolcat/lol.rb:45:in `gsub!': invalid byte sequence in UTF-8 (ArgumentError)
from /Library/Ruby/Gems/2.0.0/gems/lolcat-42.1.0/lib/lolcat/lol.rb:45:in `println'
from /Library/Ruby/Gems/2.0.0/gems/lolcat-42.1.0/lib/lolcat/lol.rb:36:in `block in cat'
from /Library/Ruby/Gems/2.0.0/gems/lolcat-42.1.0/lib/lolcat/lol.rb:34:in `each_line'
from /Library/Ruby/Gems/2.0.0/gems/lolcat-42.1.0/lib/lolcat/lol.rb:34:in `each'
from /Library/Ruby/Gems/2.0.0/gems/lolcat-42.1.0/lib/lolcat/lol.rb:34:in `cat'
from /Library/Ruby/Gems/2.0.0/gems/lolcat-42.1.0/lib/lolcat/cat.rb:113:in `block in cat!'
from /Library/Ruby/Gems/2.0.0/gems/lolcat-42.1.0/lib/lolcat/cat.rb:107:in `each'
from /Library/Ruby/Gems/2.0.0/gems/lolcat-42.1.0/lib/lolcat/cat.rb:107:in `cat!'
from /Library/Ruby/Gems/2.0.0/gems/lolcat-42.1.0/bin/lolcat:25:in `<top (required)>'
from /usr/bin/lolcat:23:in `load'
from /usr/bin/lolcat:23:in `<main>'

not production ready, too slow

I am afraid our servers will not be running lolcat in production soon for its abysmal speed.
But that give us more time to admire the rainbows while parsing logs... So maybe that's intended

Feature request - forward exit code of previous program

It would be nice if there were an option to use the return code of the previous program, so that (for example) really-long-build | lolcat would return a failure code if the build failed.

The really-long-build is out of our hands. We've actually found that piping the output to lolcat makes the errors stand out more (since stderr is not recolored) 😄

unable to package lolcat on a distribution level (depending on specific outdated versions)

Hey,

currently it is impossible to package lolcat properly on a distribution level, as it has a hard dependency to paint 0.8.6 and trollop 1.16.2.
Please don't enforce specific trollop and paint version, this is needed as its not possible to ship lolcat on a distribution level. To be able to ship lolcat as a distribution package, it needs to be compatible with paint 1.0.0 and trollop 2.1.2.

Can you please adjust the gemspec accordingly? (Not sure if there is any code change required or both libs remained API compatible)

Once this is resolved I plan to package your software into the repositories 😄

Consider adding official man page?

Not a big deal, obviously, but it'd be nice if this project had a man page. Debian has written one for it, but distributions that pull directly from source (like Arch) don't have that because it isn't actually part of the project release files.

Misalignment

When running $ apt-get upgrade | lolcat the text gets misaligned for some reason. Included screenshot:
image

Can't pipe infinite data to lolcat

With cat you can do this to get boring infinite white text:

cat /dev/random | base64 | cat

However, when doing the same with lolcat, it never shows any awesome rainbow colored output:

cat /dev/random | base64 | lolcat

Flag for limiting the color range

Hi,

Some shells/TTY's doesn't support all the colors (only 16 base colors for instance) ,
So I was wondering if a flag to set that terminal type / limit the max color number is an option?

Thanks!

Sudo

This is too awesome. Unfortunately when I try to run it without sudo I get the following error:

kevinburke$ fortune | lolcat
/usr/bin/lolcat:19:in `load': no such file to load -- /Library/Ruby/Gems/1.8/gems/lolcat-42.0.21/bin/lolcat (LoadError)

Running fortune | sudo lolcat works but is really annoying. What permissions/owners do I have to change to get it to run?

warning: Insecure world writable dir

Only show this in WSL:

/var/lib/gems/2.3.0/gems/lolcat-99.9.11/lib/lolcat/lol.rb:63: warning: Insecure world writable dir /mnt/c in PATH, mode 040777

Error in mac os

  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /usr/local/lib//libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Abort trap: 6
dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /usr/local/lib//libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Abort trap: 6```

White background version

I tend to run my terminals on a white background. The bright, pastel colors make some bits hard to read. How about a version optimized for white/bright backgrounds?

Colors

Do I need to change the ANSI colors of Terminal? What are those colors? The colors I get are much ugly… also, is that Inconsolata Bold? Can't find a bold version anywhere…

Support for Unicode characters

Test

echo -e "\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88" | lolcat

Expected result

███████

Rainbow ride

Actual result is in color

���������������������

Doesn't use 256 colors when running a screen session

Lolcat always used 256 colors for me, until I tried it in a screen session. I added a bunch of stuff to my .screenrc and it's still not working. This is my screenrc:

defscrollback 5000

termcapinfo xterm* ti@:te@

altscreen

attrcolor b ".I"
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
defbce "on"
term screen-256color-bce

The last 4 lines is what I did to try to get lolcat to use 256 colors.

Error when attempting to cat /dev/urandom | lolcat

Command cat /dev/urandom | lolcat constantly gives me following error:

Traceback (most recent call last):
        10: from /usr/bin/lolcat:23:in `<main>'
         9: from /usr/bin/lolcat:23:in `load'
         8: from /usr/lib/ruby/gems/2.5.0/gems/lolcat-90.8.8/bin/lolcat:32:in `<top (required)>'
         7: from /usr/lib/ruby/gems/2.5.0/gems/lolcat-90.8.8/lib/lolcat/cat.rb:102:in cat!'
         6: from /usr/lib/ruby/gems/2.5.0/gems/lolcat-90.8.8/lib/lolcat/cat.rb:102:in `each'
         5: from /usr/lib/ruby/gems/2.5.0/gems/lolcat-90.8.8/lib/lolcat/cat.rb:108:in `block in cat!'
         4: from /usr/lib/ruby/gems/2.5.0/gems/lolcat-90.8.8/lib/lolcat/lol.rb:42:in `cat'
         3: from /usr/lib/ruby/gems/2.5.0/gems/lolcat-90.8.8/lib/lolcat/lol.rb:42:in `each'
         2: from /usr/lib/ruby/gems/2.5.0/gems/lolcat-90.8.8/lib/lolcat/lol.rb:44:in `block in cat'
         1: from /usr/lib/ruby/gems/2.5.0/gems/lolcat-90.8.8/lib/lolcat/lol.rb:53:in `println'
/usr/lib/ruby/gems/2.5.0/gems/lolcat-90.8.8/lib/lolcat/lol.rb:53:in `gsub!': invalid byte sequence in UTF-8 (ArgumentError)

It completely blocks my work with the program, what are chances to fix the problem?

lolcat should be ansi control character aware

When coloring terminal output that uses control characters, the control characters are interrupted by the color codes. The proper behavior would be that the ANSI control code is not colored, and lolcat skips to the next printable character.

A good test case for this behavior is using lolcat with sl (steam locomotive).
Try sl | lolcat in your preferred shell.

Bonus Points:
If the coloring was seeded based on character position, instead of incremental color changes, (ie. doing coloring statelessly) then coloring could be consistent within a single execution of the program. It would of course be ideal to have the coloring randomly seeded per execution so the effect continues to stay novel.

LoadError on Mac

/usr/bin/lolcat:19:in `load': no such file to load -- /Library/Ruby/Gems/1.8/gems/lolcat-42.0.21/bin/lolcat (LoadError)
from /usr/bin/lolcat:19

uncat like behavior

Type this into your terminal:
while true; do echo -n $RANDOM | cat; done
The output is as expected, now type this into your terminal
while true; do echo -n $RANDOM | lolcat; done
As you can see lolcat is putting everything on a new line

Invalid byte sequence in UTF-8

Regression after #68 in lolcat 99.9.10.

❯ brew install lolcat
🍺  /usr/local/Cellar/lolcat/99.9.10: 187 files, 413.7KB

❯ ponysay -f crakle "i'm a pony." | /usr/local/bin/lolcat
lolcat-99.9.10/lib/lolcat/lol.rb:69:in `sub!': invalid byte sequence in UTF-8 (ArgumentError)
	from lib/lolcat/lol.rb:69:in `println'
	from lib/lolcat/lol.rb:57:in `block in cat'
	from lib/lolcat/lol.rb:55:in `each'
	from lib/lolcat/lol.rb:55:in `cat'
	from lib/lolcat/cat.rb:108:in `block in cat!'
	from lib/lolcat/cat.rb:102:in `each'
	from lib/lolcat/cat.rb:102:in `cat!'
	from bin/lolcat:32:in `<top (required)>'

My pony no longer talks to me...

ponysay -f crackle | lolcat -> 99.9.10 invalid byte utf-8

There's less rainbow in my forecast...

curl -s wttr.in/Winnipeg | lolcat -> 99.9.10 invalid byte utf-8

❯ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.11.6

❯ locale
LANG="en_CA.UTF-8"
LC_COLLATE="en_CA.UTF-8"
LC_CTYPE="en_CA.UTF-8"
LC_MESSAGES="en_CA.UTF-8"
LC_MONETARY="en_CA.UTF-8"
LC_NUMERIC="en_CA.UTF-8"
LC_TIME="en_CA.UTF-8"
LC_ALL=

lol.rb:45:in `gsub!': invalid byte sequence in UTF-8 (ArgumentError)

in my mac, when I exec ps aux | lolcat, and I got

_coreaudiod      183   1.4  0.1  2476256   6032   ??  Ss   三01下午   6:13.47 /usr/sbin/coreaudiod
/Users/weiwei/.rvm/gems/ruby-1.9.3-p194/gems/lolcat-42.0.99/lib/lolcat/lol.rb:45:in `gsub!': invalid byte sequence in UTF-8 (ArgumentError)
    from /Users/weiwei/.rvm/gems/ruby-1.9.3-p194/gems/lolcat-42.0.99/lib/lolcat/lol.rb:45:in `println'
    from /Users/weiwei/.rvm/gems/ruby-1.9.3-p194/gems/lolcat-42.0.99/lib/lolcat/lol.rb:36:in `block in cat'
    from /Users/weiwei/.rvm/gems/ruby-1.9.3-p194/gems/lolcat-42.0.99/lib/lolcat/lol.rb:34:in `each_line'
    from /Users/weiwei/.rvm/gems/ruby-1.9.3-p194/gems/lolcat-42.0.99/lib/lolcat/lol.rb:34:in `each'
    from /Users/weiwei/.rvm/gems/ruby-1.9.3-p194/gems/lolcat-42.0.99/lib/lolcat/lol.rb:34:in `cat'
    from /Users/weiwei/.rvm/gems/ruby-1.9.3-p194/gems/lolcat-42.0.99/lib/lolcat/cat.rb:113:in `block in cat!'
    from /Users/weiwei/.rvm/gems/ruby-1.9.3-p194/gems/lolcat-42.0.99/lib/lolcat/cat.rb:107:in `each'
    from /Users/weiwei/.rvm/gems/ruby-1.9.3-p194/gems/lolcat-42.0.99/lib/lolcat/cat.rb:107:in `cat!'
    from /Users/weiwei/.rvm/gems/ruby-1.9.3-p194/gems/lolcat-42.0.99/bin/lolcat:25:in `<top (required)>'
    from /Users/weiwei/.rvm/gems/ruby-1.9.3-p194/bin/lolcat:19:in `load'
    from /Users/weiwei/.rvm/gems/ruby-1.9.3-p194/bin/lolcat:19:in `<main>'
    from /Users/weiwei/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
    from /Users/weiwei/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'

Please help.

Please use any OSI approved license over the WTFPL non-license

Howdy, Sorry to bother you with this, but WTFPL is not a real usable license, please see:
https://en.wikipedia.org/w/index.php?title=WTFPL&oldid=712812819#Effectiveness_as_license_or_waiver
https://en.wikipedia.org/w/index.php?title=WTFPL&oldid=712812819#Characteristics

I realize you might find the legalese distinction silly, but lawyers in big companies tend not to, and in ours are banning all WTFPL software since the license grant is insufficient and unlikely to hold up in court as explained in the wikipedia article.
While I'm not exactly worried about getting sued over lolcat, sadly when we manage tens of thousands of users and tens of thousands of software packages for our users, we don't really have time to make a legal risk assessment for each individual package with a weird license.
Since your intent was likely to give the most free license you could, would you consider relicensing to MIT or BSD license?
Thank you on behalf of some of our users who like your software and us who won't have to pull your package, if you're willing to do this.

Invalid byte sequence in US-ASCII

Hello,
I have installed and have no problem using lolcat on my Linux system. However, on my Mac OS X, when I connect via SSH to my Linux machine, I cannot properly use lolcat and get the following error

screenshot from 2015-08-11 13 55 55

lolcat fails with emoji

I pipe a few scripts through lolcat because rainbow output is awesome. However, I noticed that when a script includes an emoji in its output (such as 🍺 from certain homebrew output lines), lolcat fails at the emoji and the remaining output is dropped.

For reference, I'm on OSX 10.13.4 and installed lolcat using homebrew.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.