Linux Blog

How Android apps are useful to get new blogging ideas

Filed under: General Linux — TheLinuxBlog.com at 9:51 pm on Thursday, October 18, 2012

 

This post is a guest post written by Brianne. She is blogger by profession. These days she is working on online promotion for Go Pilot

It is true that the bloggers will need some applications which will help them to connect with their blogging on the move. So the Android applications come handy in this connection. Moreover, you will keep touch always through these applications with your blog. Since, the Android applications provide the ample advantages to the bloggers. Even, these Android applications will give you an extra fillip for running smoothly your blogging habit. 

(Read on …)

Command Line Image Editing with ImageMagick

Filed under: Linux Software — TheLinuxBlog.com at 1:52 pm on Friday, February 13, 2009

Image Magick

Image editing is often considered a pitfall of the Linux desktop. When I was in school a number of years ago a Windows user (that later converted to the hipster OS X “better than thou” type) said to me:
“I don’t know why any one uses the command line anymore, it’s obsolete”
People often forget about the power of the command line. The command line may not be the best utility for everything but image editing is a shining example of how it can be used. I wouldn’t recommend trying to type a command that touches up your photos, but any operation that has to be repeated a number of times can be easily accomplished through a series of commands.

While there are many command line image editing tools available, this post focuses on the ImageMagick suite. While all of this can be read in the man page I aim to simplify and document for both myself and other casual ImageMagick users. By far the most valuable resource for ImageMagick is the online documentation.

Basically ImageMagick takes a number of parameters depending on the function you are to perform. Most commonly an input filename, an operation and an output filename. You can specify the same filename for both input and output in most cases, unless you are trying to keep the source image in its original form.

Here are some of my favourite and most used functions of imagemagick:

Resize an image
To resize an imagemagick is very simple. Using convert you specify the -resize option. You have several options when resizing, resize by width or height. You can also resize while adding a background color if your image has strange dimensions

Rotate an Image
Rotating an image is a snap, using convert with the source file -rotate <degrees> out file you can rotate by any number of degrees. 90, 180, 270 are most common, to change orientation but other angles may be used. Keep in mind that you may want to set a background color to do this.

Flipping an image
There are two ways to flip and image and they get sort of confusing. Imagemagick uses -flip for vertical images and -flop for horizontal flipping.

Quality
Adjusting the quality of an image is sometimes desirable for saving files to the web. Use -quality <0-100> (100 being the best) to adjust the quality

Working with GIFS
Gif’s can be edited or created by those patient enough to do so. The major think about working with gifs is the -coalese option. This takes each frame from the gif and makes it its own image. Be careful when using this as it will make Filename.gif Filename-1.gif, Filename-2.gif, Filename-3.gif and overwrite those files if they already exist. You can then work on each frame individually, or with a script and then join them back together.

Charting your boot processes with bootchart

Filed under: Linux Software,Quick Linux Tutorials — TheLinuxBlog.com at 4:57 pm on Monday, September 22, 2008

Linux users often like to boast about their awesome bootup times. I thought that there was nothing cooler than getting a wicked fast bootup time, until now. A while back I found this nifty application called bootchart and shoved it in my bookmarks. I was randomly surfing my bookmarks, came across it again and gave it another shot. (Read on …)

Reworking Shell Scripts

Filed under: Shell Script Sundays — TheLinuxBlog.com at 7:02 am on Sunday, August 24, 2008

To me shell Scripts are all about automation, their primary purpose is to get stuff done. If you have a one liner, snippet or other script you use on a regular basis, have you thought about how you could rework it for it to become more in handy?

Lets take last weeks snippet from this column. It was a simple one liner to reconnect to a host. Now, I knew when I posted this article that it was a helpful snippet of code. Now, how can this script be adapted to be a neat utility that we use on a regular basis? Over the next few week’s we’ll find out.

The first thing that I will note on is that this script or shell snippet is a pain to remember. Does a script save you time if you can’t remember how it works? Is it worth the hassle? Not exactly. So, in order to make this snippet a little better the first thing we are going to do is add something that it needs: parameters. Adding parameters to shell scripts is actually easy, much easier than adding parameters to some other languages that we wont mention. although this script does not use it getopts can be used. I’ve covered how to do this with getopts in other posts. Just do a site search (located at the bottom of the right bar for getopts.)

So, here is the modified script that automatically reconnects to a host by using ping and SSH:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
 
# Sleep Time Default: 15 seconds
STIME=15
 
# Set a default user up
USERNAME=LinuxBlog
 
#usage function
usage () {
echo -e "Usage: $0 host [user] [Sleep Time]"
}
 
# display usage if no host is specified
[ -z $1 ] && { usage && exit 1; }
 
# set the variables
[ $1 ] && { HOST=$1; }
[ $2 ] && { USERNAME=$2; }
[ $3 ] && { STIME=$3; }
 
# trying:
echo -e "host: $HOST \nuser: $USERNAME \ndelay: $STIME"
 
while ! ping -W 1 -c 1 $HOST 2>&1 >/dev/null; do true; done && echo "Successful waiting: $STIME secs"; sleep $STIME; ssh $USERNAME@$HOST

Now that you have that done, all you need to do is give the file a name (I called mine ssh_auto) and put it in a folder in your path. Use the filename and parameters defined in the script to connect to the host.

The next shell scripting article I demonstrate how you can further rework shell scripts to better suit your needs.

Bash Aliases

Filed under: General Linux,Linux Software,Quick Linux Tutorials — TheLinuxBlog.com at 12:23 pm on Wednesday, June 25, 2008

Have you ever wanted to make a command for something that did not exist? Perhaps modify the functionality of a particular application to something more suitable? I know I have. For example, and I know that there is probably a better way to do this, but on certain Linux machines (such as servers), I like to clear the output before exiting. While I can type the command:

 clear; exit

this still leaves me with a line at the top of the screen. Some distributions clear this automatically, for those that don’t an alias can be used.The basic principal for a bash alias is easy. You set an alias up and then use that alias instead of the command.
It appears that aliases have precedence over any already existing applications in the path so it becomes handy if you wish to override a command or perform a task before launching a built in command. I’m sure that this option can be changed if needed.

Now you know what aliases are here is how to use an alias to override the exit command in bash.

alias exit="clear; exit > /dev/null 2&> /dev/null"

Aliases with parameters can get tricky, the best workaround I have found is to write a shell script and put it in your local bin directory.