BenV's notes

Tag: perl

dos2unix

by BenV on Aug.21, 2009, under Morons, Software

Another annoying thing: morons that save their files with dos line endings.
Also known as “I’ve got motherfucking ^M in my file, AAAIIEEEEYGGrrgrll“.
I usually find out about this when bash complains about stuff like this:

benv@janeman:~$ ./bla.pl
-bash: ./bla.pl: /usr/bin/perl^M: bad interpreter: No such file or directory

(HAAAAAT!!!)

Solution:

benv@janeman:~$ vim kankerfile
:set fileformat=unix
:wq

(Don’t confuse fileformat with filetype, one is used for encoding, the other for things as syntax highlighting)

Solution 2:

benv@janeman:~$ dos2unix kankerfile

I never use this since I never have that piece of cancer called dos2unix, but some distros do.

Solution 3:

sed -ie 's/\r//g' bla.pl

That should fix it. On to the “let’s trash my home directory with my fancy new perl script that I just converted” ;)

Leave a Comment :, , more...

(n)Curses magic part 2: magic!

by BenV on Aug.08, 2009, under Boring, Fun, Software

So while messing around with some perl/curses stuff I got fancy with colors and soon found out about the limited support of colors in terminals and therefore also Curses.
Anyway, I made this little “fractal plasma” thingy with it, see if you can get it running ;)
It’s not really a fractal plasma, so don’t get technical on that, but it describes it best I think.

To get it running, open up your favorite terminal that supports 256 colors and allows palette changing – I found both xterm and urxvt to work.
Make sure your TERM variable is set to something that allows this, for instance in urxvt:

$ export TERM=rxvt-256color
$ ./fractplasm.pl

or this worked for me with xterm:

$ export TERM=xterm-256color
$ ./fractplasm.pl

Something like this is the result:
fractplasm
fractplasm2

fractplasm.pl - Version 0.1 - SHA: 83086edd86b25eed5fddcbbf6beaae53924e06f6

Enjoy!

1 Comment :, , more...

(n)Curses magic: are you a magician?

by BenV on Aug.07, 2009, under Morons, Software

Hej readers,

I decided to work on making slackbuild.pl a bit more acceptable in terms of usability and looks. The reason for this is that the dialog program doesn’t exactly do what I want.
That is, it works…. but that’s pretty much all I can say about it. It doesn’t allow me to make a comined checkbox/menu thing that I want for my configure options part. Next to that it’s tedious to fork and parse its output all the time, and let’s not even get started about looks and input issues.
So I figured: hmm, dialog is made in ncurses, perl has a Curses lib…. let’s play! (continue reading…)

Leave a Comment :, , , more...