Sunday, September 7, 2008

Top 10 Steps to Beautiful Shell Scripts

Linux gurus don’t use cut, awk, and sed when they want to replace or strip out a portion if a variable. They use parameter substitution. You can learn parameter substitution in less than 2 minutes. Here is the ten things you need to know:

  1. Shell variables can be specified like $var or this ${var}.
    $ var='a.ads,fssd2342%asd234#@.,&%,sdfgsdfgas4352'
    echo ${var}
    a.ads,fssd2342%asd234#@.,&%,sdfgsdfgas4352
  2. ${#var} is the length of the variable.
    $ echo ${#var}
    42
  3. ${var:pos} substrings the variable starting at pos.
    $ echo ${var:10}
    2342%asd234#@.,&%,sdfgsdfgas4352
  4. ${var:pos:len} substrings the variable starting at pos with a max length of len.
    $ echo ${var:10:5}
    2342%
  5. ${var#pattern} strips pattern from the front or left hand side of the variable. This form is not greedy meaning it stops as soon as the pattern is matched. ${var##pattern} is the greedy form.
    $ echo ${var#*,}
    fssd2342%asd234#@.,&%,sdfgsdfgas4352
    $ echo ${var##*,}
    sdfgsdfgas4352
  6. ${var%pattern} strips pattern from the back or right hand side of the variable. This form is not greedy meaning it stops as soon as the pattern is matched. ${var%%pattern} is the greedy form.
    $ echo ${var%,*}
    a.ads,fssd2342%asd234#@.,&%
    $ echo ${var%%,*}
    a.ads
  7. ${var/pattern/replacement} replaces pattern with replacement once.
    $ echo ${var/a/A}
    A.ads,fssd2342%asd234#@.,&%,sdfgsdfgas4352
  8. ${var//pattern/replacement} replaces pattern with replacement globally.
    $ echo ${var//a/A}
    A.Ads,fssd2342%Asd234#@.,&%,sdfgsdfgAs4352
  9. ${var/#pattern/replacement} if variable beginning matches the pattern it is replaced with replacement.
    $ echo ${var/#a./llll}
    llllads,fssd2342%asd234#@.,&%,sdfgsdfgas4352
  10. ${var/%pattern/replacement} if variable end matches the pattern it is replaced with replacement.
    $ echo ${var/%352/llll}
    a.ads,fssd2342%asd234#@.,&%,sdfgsdfgas4llll

Wednesday, May 14, 2008

Tux Pumpkin!

What is Halloween with out tux?





Monday, January 28, 2008

Hackers hit Scientology with online attack

A group of hackers calling itself "Anonymous" has hit the Church of Scientology's Web site with an online attack.

The attack was launched Jan. 19 by Anonymous, which is seeking media attention to help "save people from Scientology by reversing the brainwashing," according to a Web page maintained by Anonymous.

Anonymous claims to have knocked the Church's Web site offline with a distributed denial-of-service attack, in which many computers bombard the victim's server with requests, overwhelming it with data in the hope of ultimately knocking the system offline. True to its name, Anonymous does not disclose the true identities of its members.

The attacks were spurred by the Church's efforts to remove video of movie star Tom Cruise professing his admiration for the religion, according to an Anonymous video manifesto posted to Youtube.

"For the good of your followers, for the good of mankind and for our own enjoyment, we shall proceed to expel you from the Internet and systematically dismantle the Church of Scientology in its present form," a creepy computerized voice states in the video. Anonymous followed up this dispatch with a second video blasting the media for failing to completely report the group's criticisms of the church. This video was taken down Friday by Youtube, citing a "terms of use violation."

Anonymous has managed to generate a measurable attack against the Scientology.org Web site. Over the past few days, the site was hit with several DDOS (distributed denial-of-service) attacks, which flooded it with as much as 220Mbps of traffic, according to Jose Nazario, a senior security engineer with Arbor Networks, whose company compiles data on Internet attacks.

The Anonymous campaign shows some level of organization. "220Mbps is probably about in the middle of attack sizes," Nazario said. "It's not just one or two guys hanging out in the university dorms doing this."

On average, the attacks lasted about 30 minutes and used up 168Mbps of bandwidth. In the past year, Arbor has seen attacks on other sites hit 40Gbps, or 200 times the strength of the Anonymous event.

Shortly after it was hit with the DDOS flood, the Scientology.org Web site was moved to a server hosted by Prolexic Technologies, according to data compiled by Netcraft, an Internet monitoring company. Prolexic specializes in protecting companies from DDOS attacks.

A Prolexic spokeswoman confirmed that the Church of Scientology is one of the company's clients, but declined to offer more details on the matter. The Church of Scientology did not answer questions relating to the online attacks, but in a statement it said that the controversy over the Tom Cruise video had driven traffic to its Web site.

The secretive Church of Scientology's practices, including its efforts to use copyright law to restrict the dissemination of information about the church, have engendered a lot of criticism within the Internet community. But one Web site set up to criticize Scientology -- called Operation Clambake -- called the DDOS attacks a bad idea. "Attacking Scientology like that will just make them play the religious persecution card," wrote Andreas Heldal-Lund, the Web site's owner. "They will use it to defend their own counter actions when they try to shatter criticism and crush critics without mercy."

If publicity was Anonymous' ultimate goal, the group has had some success. Late in the day Friday, seven of the top 10 stories on the Digg.com news-linking site related to Scientology or to Anonymous' communiques.

Although the group's Web page exhorts participants to "begin bumping Digg," Anonymous did not manipulate the news site's promotional algorithm system, which determines which stories get top billing, according to Digg CEO Jay Adelson.

"They must have done a very good job of bringing in a diverse set of interests," he said. "It just happened to hit a nerve that the Digg community was interested in."

It is unusual for Digg's front page to be so dominated by a single topic, but not unprecedented, Adelson said. Last year's shootings at Virginia Tech and the 2005 terrorist bombings in London achieved a comparable level of coverage. "In the history of Digg, there's no question that the topic of Scientology has been of great interest to the community," he said. "I can't explain why."

Apple Launches 13-Inch Ultralight MacBook Air

Steve Jobs took the stage to kick off the annual Macworld Expo today. As usual, he brought with him a crushing amount of buzz and a pile of new product announcements. Here's what we'll be seeing from Apple, starting today!

MacBook Air

As widely expected, Apple is launching an ultra-thin notebook called the MacBook Air. At 0.76" thick at its widest point, the three-pound Air has a wedgelike shape that tapers down to 0.16" thick at the front base. LED backlighting on its 13.3-inch screen, multi-touch trackpad (which offers some nifty features like rotating photos, all in the touchpad), and a backlit keyboard. Specs are decent: 1.6 or 1.8GHz Intel Core 2 Duo (on a cleverly shrunken socket), 2GB of RAM, and an 80GB hard drive (or 64GB SSD option). No optical drive (of course), and just one USB port. It'll set you back $1,799, which is on the inexpensive side for ultralight notebooks with specs like this. Ships in two weeks.

(By the way, as great as the MacBook Air sounds, calling this the "world's thinnest notebook" is hyperbole: The Sony X505 was 0.75" thick... and it was released in 2003.) 

iPhone Software Upgrades

Apple isn't resting on its cell phone laurels; after selling 4 million iPhones, it's adding new features to the existing software package (including webclips, which will bookmark not just a web page but a specific zoom and pan and then let you place them on your home screen; multiple recipient SMS; and lyrics support for iTunes). Nothing major, but some nice, incremental upgrades to the existing software. iPod Touch gets the same upgrades as the iPhone, but it will cost you $20.

NOT announced: iPhone 2! 

iTunes Movie Rentals

As widely rumored, Apple is launching a movie rental service to complement its TV and movie sales service as part of iTunes. All major studios are on board. Titles will be available 30 days after their DVD release and can be viewed on a PC or your iPod/iPhone. You have 30 days to start watching and 24 hours after that to finish. The price: $3.99 for new releases, $2.99 for old titles. Launches today. (Hey, that Netflix deal is looking pretty good!)

Also: The flagging Apple TV will get the same rental features, without the need for a computer. You'll also be able to get photos from Flickr and .Mac, podcasts, and YouTube videos via Apple TV. It will still sync with your computer via iTunes, but that isn't required if you just want to use it to watch web content. It also does high-definition... but rentals will run you a whopping $4.99 each. The Apple TV features will be a free software update to existing boxes (available in two weeks). New boxes drop in price to $229 from $299.

Time Capsule Wireless Hard Drive

Also announced: A wireless external hard drive designed to be used as a backup solution (with Apple's Time Machine backup software). $299 (500GB) and $499 (1TB).

Top 40+ GIMP plugins

GIMP is the undisputed king of image editing in Linux platforms, and is next only to Photoshop in popularity in Windows and Mac platforms. With a large community of developers and an even larger pool of users, it is no surprise that GIMP is very popular.

Much like Firefox, GIMP’s strength lies in its plugins, which are developed by the open-source toting community. Since the users themselves develop them, they know all the needs and conceive a plugin for everything (well, except making a coffee for you ;) ).


And what better way for me to endorse GIMP than a list of good plugins? Most of them are aimed at web-designers and photographers, the main users of GIMP. There are also some to fix common problems of GIMP.


Web Design



  • Snow: Generate realistic 3D snow. Caution: Requires large amount of memory and swap memory.

  • Anti-aliasing: Smoothen and fix straight lines.

  • Adaptive contrast enhancement: Intelligent adjustment of contrast.

  • Fourier Transformation: GIMP plugin version of Fourier Transformation.

  • Refract/Reflect: Refraction effects to simulate falling water drops.

  • ShapeIt: Bend text or image according to information in map layer.

  • Borders: Add borders to your image.

  • SoapBubble: Create bubbles. Contains two versions, for GIMP v2.2 and v2.4.

  • Aqua Bou: Create web buttons in ‘Aqua Bou’ style easily.

  • Chrominium: Create a chrome logo with glow and sparkles.

  • Cloud Generation: For easy creation of clouds. Updated to work with GIMP 2.4, the latest version.

  • Gothic Glow: GIMP’s version of Gothic Glow action, originally for Photoshop.

  • Liquid Rescale: Content-aware rescaling. Keeps the features of the image while rescaling along a single direction.

  • Particle Deposition: simulates particle deposition on a surface. It generates small particles with random size and velocity and lets them fall onto the surface where they settle, increasing surface height in the place a bit.

  • Stampify: Make your image look like a postage stamp.

  • Plasma2: Newer version of the original Plasma plugin for GIMP.

  • SaveForWeb: Find optimal compromise between minimal file size and acceptable quality of image quickly. Useful for designers.

  • Steel Text: Create a text effect that looks like shiny steel (or gold) and a dropshadow.


Photography



  • Pandora: Stitch together multiple images to make a panorama.

  • Film Grain: Add film grain for a classic feel, to BW images.

  • Black Ink: Transform an image to a B&W drawing made with ink.

  • Copyright Text: Add a copyright text to image.

  • DeNoise: Noise reduction plugin using a modified Gaussian blur algorithm.

  • DustCleaner: Detect and remove the dust spots in digital image.

  • Astro-plugins: A set of plugins for astronomical image processing.

  • FocusBlur: Makes an image out of focus with luminosity and depth.

  • Lomo: Make photos clear, sharp and crisp. Especially useful for outdoor photographs.

  • ISO Noise Reduction: Implements an ISO noise reduction, using different methods (masking the edges, then blurring the individual color channels or the lumimance channel only).

  • Photo Effects: A bunch of scripts brought together in one script-fu file. Contains cartoon, color pencil, conte crayon, cutout, Drawing, ink pen, note paper, paint dot image, palette knife, pastel, stamp, water paint effect, wrap effect, angled strokes, crosshatched, chrome image, cross light, funky color, soft focus, solarisation, brick wall, patchwork, stained glass, texturizer, high pass, scroll effects.

  • RedEye: Quickly remove red eye effect caused by camera flashes.

  • ShadowRecovery: Recover image information in darked regions.

  • Shadows/Highlights: Eliminate shadows and highlights in photographs.

  • Refocus: Opposite of FocusBlur(listed above), this refocuses images. Provides better results than Unsharp masking which is built into GIMP.

  • PhotoToolbox: Perform several actions on a photo at once such as defocus, desaturate (several papers emulations), toning, add grain.

  • Light Filter: Provides basic filtering by adjusting colour levels of each pixels.

  • Gradient Along Path: Strikes a vector applying a gradient orthogonally to the path.

  • Landscape painter: Creates interesting paint effect that looks best with landscapes.

  • EZ Improviser: Improve dull, dingy images.

  • Edgy: Make an image look edgy.

  • Digital IR: Simulate a black and white infrared image.

  • Colour saturation: Change the color saturation of your image.

  • Blot: GIMP avatar of BlotBrush. Based on blot algorithm and works well with spatter or cloudy image.

  • GimpPublishr: Publish images to Picassa and Flickr directly from inside GIMP.


Miscellaneous



  • GIMP Dewierdifyer: (for Windows) Get rid of common window annoyances in the GIMP. It adds a background window that sits under GIMP. It groups other GIMP windows into one, so that when you’re alt+tabbing to other apps, only one icon of GIMP gets in your way.

  • Turing Pattern: Renders a kind of Turing pattern.

  • Yin-Yang+: A seemingly useless plugin, but fun nonetheless. Add yin and yang symbols. Also optionally add drop-shadows.


Further resources



  1. Writing a GIMP plugin: Plugin guide in PDF, HTML, archive and XML formats.

  2. GIMP plugin template: A blank plugin template that has the basic structure and reduces the time required to develop a plugin considerably. The direct link is currently here, but may change in future (if it changes, click the link on “GIMP plugin template”.

  3. Writing plugins: Another guide for writing plugins, this one from GIMP.org’s developer site.

  4. Writing Plugin: Another guide at GIMP.org main site.

Sunday, January 27, 2008

20 MOST Popular Linux Games

I spent some time compiling this list and seeing how many nice games are available for Linux I couldnt help but wonder: why are we still using Vista? There are so many Windows advocates who bring as anti Linux argument an “absence” of games for Linux. Well, they are wrong! There are enough games from Linux and the great news is that they are free and fun!


In comparison, almost everything that comes on Windows, with a few exceptions (solitaire and the like) comes with a price.


The Linux games are open source. Than means that they are: free, with no string attached, created by people who love Linux and are painless to install. Besides, they are Windows compatible. So you can enjoy Linux fun on a Windows platform at any time!


1. Do you like cars? Are you a fan of the fast game races? Linux has a free game for that too: Maniadrive. This one even has a cool soundtrack!


2. And let’s not forget TORCS – a game with a tradition of 10 years. Car race simulator as addictive as any other car race game. Linux and Windows compatible.


3. And if you like 3D war games, you’ll have lots of fun with America’s Army. Play it by the rules, or make your own. LMAO!





4. Another fun 3D game is Alien Arena. The newest version of the game was released not long ago.


5. You can play Mahjongg on Linux. Of course you can. It is called KMahjongg and it is one of the most popular games developed for Linux. In many “top ten” tops it occupies the tenth position. Top Hosting Center doesn’t make a top, just a list.


6. Fully compatible with both Windows and Linux The Battle for Wesnoth is a strategy game you will never forget.You have an amazing world to explore and you can play with up to 8 friends (this makes the game a multi-player game too). Enjoy the trailer:





7. Another interesting tactical Linux and Windows compatible game is Crimson Fields. Personally I like The Battle pf Wesnoth more, but strategy games are strategy games. For those who prefer more modern stories, Crimson Fields might be cool.


8. Xbubble is simple and you can play alone or against an opponent, which makes the game perfect for family fun. Besides it doesn’t require too much skill, so even younger players can join the fun.


9. Frozen Bubble has nicer graphics but the principles are pretty similar. This is a clear Linux game (penguins and all) available in several languages. You can play it alone and even with other players in a network.


10. If you like shooter games, Cube 2 is the one for you.


11. True Combat: Elite is really cool. I love the 3D graphics and the features. It is based on Enemy Teritorry so if you are a fun of that game you will never miss it.


12. Or the cool Nexuiz?





13. Pingus runs on Linux and Windows but when you see the little Tuxes you can only think Linux. Cute, cute! And very popular too. What other better revenge against Vista than to play a free Linux game on it?


14. Are you skilled enough to play Neverball? The game has a very popular forum where you can learn tips and tricks to improve your skill.


15. I am not that amazed by GLtron, but some Linux enthusiasts are. Besides the official site has some personal touches of the author that really convinced me to include the game on the list. Love and passion for a dream are always rewarded by the THC team.


16. Frets on Fire works for both Linux and Windows. And even if you are not a musician this game can be addictive. You’ll be playing a virtual guitar. I like the graphics.


17. I almost forgot Tux Racer! This was amazingly popular in 2001 – I remember playing it once at a friend’s house. I have no idea who still plays it, but it does deserve a place on the list.





18. Scorched 3D is something I haven’t tried yet but I think it would be fun to play.


19. Tremulus is as interesting as any other shooter game could be – I am not very fund of those.


20. Last, but not least, FlightGear – a flight simulator I am sure you will enjoy.


Tuesday, January 22, 2008

Top 10 Linux problems

Here's an interesting result of a linux poll. Although there were not too many votes this poll is relevant and even addicted Linux users will agree with some of these problems (like I agree that Windows development process is out of control for example).

1. The worse Linux problem: installation of applications

Installation of applications in Linux seems to be its greater problem. People mention problems with the diversity of distributions, dependencies, conflicts with versions, compilation problems, etc.

2. Lack of drivers

Even if drivers exists people have problems in finding the version that corresponds to the distribution which they are using.

3. Deficiency of a standard

In many cases can be a true problem. The people suggested that when they become familiar to a distribution, the next version is totally different. Or when they change the distribution, the files are stored in other locations. Almost all the voters suggest the differences in the interface, differences in the availability of the commands and the differences in the configuration of the applications make difficult the learning of this operating system.

4. Problems with modems

This seems to be the device most complicated to run in Linux.

5. Linux is slow

21 votes mention that Linux is much more slow that Windows XP.

6. “X” applications

17 votes mention the lack of availability of applications for Linux. Particularly they stand out the lack of applications to use for web design, audio production, graphic design, etc. Also there were many commentaries of the type “lack good games for Linux”.

7. The GUI has deficiencies

With 14 votes, problems in the more popular visual interfaces as GNOME and KDE are located in the seventh position. Problems of usability, management, etc. appear in the descriptions of the users. Many people complain that “Linux does not order the icons automatically”.

8. Problems with printers/new hardware

Printer appears like the second device more difficult to use in Linux. Other 13 votes suggest the “new hardware” is practically impossible to install/use in Linux.

9. Linux is seen “ugly”/“is difficult to use”

11 votes suggest Linux is seen “ugly” compared with other operating systems. Other 11 votes suggest simply “is more difficult to use that Windows” without giving too many explanations of the cause.

10. Problems using the scanner/complicated File system

Scanner seem to be another one of the devices most difficult to run in Linux. Finally, 10 votes suggest the Linux file system is “too complicated”.

Hope the next version ubuntu 8.04 is free from allthese. Express your views in the comment section.