Us geeks mostly think of the command line as the best place for text
manipulation. It’s a natural with
grep and shell scripts. But
although you can’t necessarily view your results from within a typical
terminal window, it turns out to be pretty darn easy to analyze and
manipulate images from within a shell script.
In my last
article, I had some fun looking at the children’s game of rock,
paper, scissors, writing a simple simulator and finding out that some
strategies are better than others. Yes, I used “strategy” and
“rock, paper, scissors” in the same sentence!
In this article, I’m going to tackle a children’s game that’s extraordinarily
complicated, with many variations, and the programming task is going to be quite
tricky. Just kidding! Rock Paper Scissors (or RPS, as it’s known) is
pretty darn easy to simulate because there aren’t really many variants or
Ladies and gentlemen, we’ve left Mars. Well, at least I’m done with the
Martian lander from my past few articles. I hope you had chance to experiment with
it and find out that it’s not too easy to land a craft on any planet!
I’ve written a little about PHP before, because I think it’s a great
utility language for writing quick things you need to do. Plus, it
allows you to use a web browser as your interface, and everyone has
a web browser. That makes it very convenient for my family, because I
can make simple web interfaces for the various things I normally have to
do from the command line. more>>
In my last few articles (“Let’s Go
to Mars with Martian Lander” and “Mars
Lander, Take II: Crashing onto the Surface”), I’ve been building a variant on the classic video
game Lunar Lander, with a few simplificatio more>>
In this article, I’m covering something that’s a little
abstruse: converting numeric bases within shell scripts. more>>
In this article, I want to cover a more fundamental
aspect of shell scripting: working with command arguments.
I suspect that most shell scripts go through an evolution with their
command flags, a more>>
I got a great letter from a reader with a puzzle to solve, so let’s dig
in, shall we?
Here’s what he wrote:
Love your column in Linux Journal. I’ve read it
for years and learned a lot about shell scripting, but not quite enough to
solve a puzzle on my own.
For this article, I thought it would be beneficial to go back to some basics of
shell scripting and look at how functions work. Most script writers
probably eschew using functions because it’s a bit antithetical to how
scripts tend to evolve, as a sequence of commands on the command line that
are captured in a file.
Picat is a new logic-based programming language. In many ways, Picat is
similar to Prolog, especially B-Prolog, but it has functions in addition
to predicates, pattern-matching instead of unification in predicate heads,
list comprehensions and optional destructive assignment.
Knowing some Prolog helps when learning Picat but is by no means required.
The last three days, I’ve created a small bash script that outputs some important server health information. I’m using this script for displaying the server health on my Raspberry Pi at home. I’ll buy one of these official 7 inch touch screen displays for the Raspberry Pi and then show these health information on it. […]
Gerhard Gappmeier has submitted a really cool and useful bash script, that he is using for years now. It is very helpful for developers. This scripts can replace file headers from C/C++/JAVA header and source files. Often it’s necessary to replace the license conditions in multiple source files, update the copyright year, or simply make […]
The following script was written by me to be able to get the really used amount of memory for one single application. Since it isn’t that easy to get the used memory through “top” or “ps” or similar tools, this may be helpful for somebody. The output is in megabytes and looks like this:
The following small script was written by me in order to be able to simply cut parts from very large text files. It is very useful for database administrators to for example cut the SQL statements for creating and restoring one single table from a really large SQL dump. For this you would need to […]
After years of making it clear that I’m not a developer in just
about every article I’ve written here at Linux Journal, I do have a
confession to make. I can write the “Hello World” equivalent in almost
every programming language out there. In assembly, it might have been
“1+1”, but my lack of advanced skills should be evident. more>>
A reader wrote a letter to me (oh happy day!), and although I’m still
not entirely sure what she’s trying to accomplish, it’s an interesting
puzzle to try to tackle anyway. Here’s what she asked:
In my last article, we began an exploration of date math by validating a given date
specified by the user, then explored how GNU date offers some slick math
capabilities, but has some inherent limitations, the most notable of which is
that it isn’t on 100% of all Linux and UNIX systems.
Alert readers will know that I’m working on a major revision to my popular
Wicked Cool Shell Scripts book to come out later this
most of the scripts in this now ten-year-old book still are current and
valuable, a few definitely are obsolete or have been supplanted
by new technology or utilities. No worries—that’s why I’m doing the
OpenGL is a well-known standard for generating 3-D as well as 2-D graphics
that is extremely powerful and has many capabilities. OpenGL is defined
and released by the OpenGL Architecture Review Board (ARB).
This article is a gentle introduction to OpenGL that will help you
understand drawing using OpenGL.