As subtle as a flying brick.

Author Archive

Boston police blow up traffic counter chained to lightpost

Thanks to the Boston Police bomb squad, this is one traffic counter box that won’t get a chance to kill anyone.


Yes, I know. But it wasnt my fault.

So… My site was down for a couple weeks. Not my fault. Normally when it goes down, the host is back up in a couple days max, so i waited per the norm for things to go back to normal. after 3 weeks I said “Ok, time to move it”, which I did. Sadly, I also had my linux box freak on me and I lost my local backup of the site. So I’ll be starting again from scratch until I can get access to my previous host.
Which means, I’m forced to pick a new site style for now. I was thinking of doing it, but I guess I’m forced to now. Oh well.


Graffit is Fun!

grafitti-fun-crime.jpg


I’m sorry to do this to you.

I’m sorry to do this to you, but you must share my agony. Let me know if you get #41 (I have to skip it every time).


Porno-Terrorism?

Is Porn out of Control? As the internets exploded, Clinton didn’t seem to care.. Should the government now focus on shutting down the industry? Some loudly think so.


Kids today

Vanity on the rise among young people today. Findings from a recent San Diego State University workshop shows that a couple decades worth of self-esteem parenting, may have engendered an entire generation of narcissists.


Have sex with a dead dog in Michigan, go to jail

If your idea of an ideal romantic partner is a deceased canine and you live in Michigan, well, better start thinking about internet dating instead. A state judge has rejected the argument that “a dead dog is not an animal and therefore cannot be violated against its will.”


Biodiesel from liposuctioned human ass-fat powers race boat

Here’s some video from a Current TV segment about a biodiesel boat race to circumnavigate the globe. The boat featured in the video runs on a mixture of fuel from various sources — 4 gallons of the stuff was produced from liposuctioned butt blubber (a hundred grams of that came from the captain’s own backside). Welp, there’s a renewable fuel source America has plenty of. Here’s a blog post with more info about EarthRace.


Disney Princess wedding dresses

Disney is launching a line of $1,100 – $2,900 “Princess” wedding dresses. Talk about life-cycle marketing — from tiny costume dresses you can put your toddler in all the way up to the wedding gown. If you are looking for other beautiful wedding dresses then go to Frox of Falkirk. All that’s missing is a burial tiara and sceptre to take to your grave.

Parks and Resorts Chairman Jay Rasulo said he expected the dresses to be a hit among brides to be, especially given the increasing popularity of weddings at Walt Disney World, the site of about 2,000 nuptials each year.

“If you do 2,000 weddings a year, think of all the people who say, ‘I can’t, I have to get married in my hometown, my own church,’ but they certainly may still have that princess dream as part of it,” Rasulo said.


Hello?! Who is it?!

Spam!.
Back from the dead and ready to go, more to come!


Bash For Loop Examples

How do I use bash for loop to repeat certain task under Linux / UNIX operating system? How do I set infinite loops using for statement? How do I use three-parameter for loop control expression?

A ‘for loop’ is a bash programming language statement which allows code to be repeatedly executed. A for loop is classified as an iteration statement i.e. it is the repetition of a process within a bash script.

For example, you can run UNIX command or task 5 times or read and process list of files using a for loop. A for loop can be used at a shell prompt or within a shell script itself.

for loop syntax

Numeric ranges for syntax is as follows:

for VARIABLE in 1 2 3 4 5 .. N
do
	command1
	command2
	commandN
done

This type of for loop is characterized by counting. The range is specified by a beginning (#1) and ending number (#5). The for loop executes a sequence of commands for each member in a list of items. A representative example in BASH is as follows to display welcome message 5 times with for loop:

#!/bin/bash
for i in 1 2 3 4 5
do
   echo "Welcome $i times"
done

Sometimes you may need to set a step value (allowing one to count by two’s or to count backwards for instance). Latest bash version 3.0+ has inbuilt support for setting up ranges:

#!/bin/bash
for i in {1..5}
do
   echo "Welcome $i times"
done

Bash v4.0+ has inbuilt support for setting up a step value using {START..END..INCREMENT} syntax:

#!/bin/bash
echo "Bash version ${BASH_VERSION}..."
for i in {0..10..2}
  do
     echo "Welcome $i times"
 done

Sample outputs:

Bash version 4.0.33(0)-release...
Welcome 0 times
Welcome 2 times
Welcome 4 times
Welcome 6 times
Welcome 8 times
Welcome 10 times

The seq command (outdated)

WARNING! The seq command print a sequence of numbers and it is here due to historical reasons. The following examples is only recommend for older bash version. All users (bash v3.x+) are recommended to use the above syntax.

The seq command can be used as follows. A representative example in seq is as follows:

#!/bin/bash
for i in $(seq 1 2 20)
do
   echo "Welcome $i times"
done

There is no good reason to use an external command such as seq to count and increment numbers in the for loop, hence it is recommend that you avoid using seq. The builtin command are fast.

Three-expression bash for loops syntax

This type of for loop share a common heritage with the C programming language. It is characterized by a three-parameter loop control expression; consisting of an initializer (EXP1), a loop-test or condition (EXP2), and a counting expression (EXP3).

for (( EXP1; EXP2; EXP3 ))
do
	command1
	command2
	command3
done

A representative three-expression example in bash as follows:

#!/bin/bash
for (( c=1; c<=5; c++ ))
do
	echo "Welcome $c times..."
done

Sample output:

Welcome 1 times
Welcome 2 times
Welcome 3 times
Welcome 4 times
Welcome 5 times

How do I use for as infinite loops?

Infinite for loop can be created with empty expressions, such as:

#!/bin/bash
for (( ; ; ))
do
   echo "infinite loops [ hit CTRL+C to stop]"
done

Conditional exit with break

You can do early exit with break statement inside the for loop. You can exit from within a FOR, WHILE or UNTIL loop using break. General break statement inside the for loop:

for I in 1 2 3 4 5
do
  statements1      #Executed for all values of ''I'', up to a disaster-condition if any.
  statements2
  if (disaster-condition)
  then
	break       	   #Abandon the loop.
  fi
  statements3          #While good and, no disaster-condition.
done

Following shell script will go though all files stored in /etc directory. The for loop will be abandon when /etc/resolv.conf file found.

#!/bin/bash
for file in /etc/*
do
	if [ "${file}" == "/etc/resolv.conf" ]
	then
		countNameservers=$(grep -c nameserver /etc/resolv.conf)
		echo "Total  ${countNameservers} nameservers defined in ${file}"
		break
	fi
done

Early continuation with continue statement

To resume the next iteration of the enclosing FOR, WHILE or UNTIL loop use continue statement.

for I in 1 2 3 4 5
do
  statements1      #Executed for all values of ''I'', up to a disaster-condition if any.
  statements2
  if (condition)
  then
	continue   #Go to next iteration of I in the loop and skip statements3
  fi
  statements3
done

This script make backup of all file names specified on command line. If .bak file exists, it will skip the cp command.

#!/bin/bash
FILES="$@"
for f in $FILES
do
        # if .bak backup file exists, read next file
	if [ -f ${f}.bak ]
	then
		echo "Skiping $f file..."
		continue  # read next file and skip cp command
	fi
        # we are hear means no backup file exists, just use cp command to copy file
	/bin/cp $f $f.bak
done

Recommended readings:

  • man bash
  • help for
  • help {
  • help break
  • help continue

Updated for accuracy!


William Shatner.. How I hate you.

“I’m type cast!” the cry of the washed up actor. William Shatner claims to be typecast as James T. Kirk. Typecasting is a crock of shit, its the battle cry of the bad actor. Look at Richard Dean Anderson, and Scott Bakula, they pulled it off.

Now with Invasion Iowa I’m even more in awe of how much I hate bad actors.


The Amber Room

The Amber Room. Stolen by the Nazis in WWII from the Catherine Palace in St. Petersburg, Russia, the Amber Room remains one of the greatest missing treasures of Europe. The room has now been reconstructed, and the search for the original may have come to an unhappy end


*Makes TARDIS noise, dematerializes*

Christopher Eccleston, the new Doctor Who, has tendered his resignation. Geez, his first episode wasn’t that bad.


Fear me, For I am A Geek.

I’m such a geek, but I love it.

For my reward for being a geek, I gave myself this.

boxset.jpg

A nice box for my complete set of Lord of The Rings, extended editions. Best part is, I got it for 4$, vs getting screwed into having to buy a full box set vs just a box for my existing full collection.

May need to watch those again soon.


Alarm clock that hides

Clocky is an alarm clock that hides when you hit its snooze button. It was developed by Gauri Nanda at the MIT Media Lab. From the project description:

When the alarm clock goes off and the snooze button is pressed, Clocky will roll off the bedside table and wheel away, bumping mindlessly into objects on the floor until it eventually finds a spot to rest. Minutes later, when the alarm sounds again, the sleeper must get up out of bed and search for Clocky. This ensures that the person is fully awake before turning it off. Small wheels that are concealed by Clocky’s shag enable it to move and reposition itself, and an internal processor helps it find a new hiding spot every day.

I don’t like being told when to wake up but I’ve come to terms with the idea that I have to. In designing Clocky, I was in part inspired by kittens I’ve had that would bite my toes every morning.


Cat Hate

Ok, I like my cats a lot, theyre cute and super smart. But there are times when you can have a good reason to hate cats. However if that is not enough, this guy has 32 other reasons to hate cats.


Canada’s DMCA proposal: not great, could be LOTS worse

p>Canada’s DMCA proposal: not great, could be LOTS worse

The Canadian government has introduced its draft legislation for a “Canadian DMCA” — a suite of laws to bring Canadian copyright into harmony with the bad treaties that broke the American copyright system in 1998 with the Digital Millennium Copyright Act.

In many respects, this is vastly superior to the US version — after seven years of horror stories, it would be criminally stupid for any government to consider a law as bad as the DMCA — but there are still some substantial problems.

Michael Geist, the Canadian academic copyright lawyer and columnist, has a great first look at the new proposal:

The package will include an anti-circumvention provision applied to copyright material. There is no mention of extending the provision to devices (as is the case in the U.S.) and the specific reference to applying the provision to copyright material suggests that the provision will limit its applicability to circumvention to commit copyright infringement. The rights management information is similarly limited to instances to “further or conceal copyright infringement.” While no anti-circumvention provision would be better, this suggests that the Canadian provision will feature some real balance.

Moreover, the FAQ makes clear that “the circumvention of a TPM applied to copyright material will only be illegal if it is carried out with the objective of infringing copyright. Legitimate access, as authorized by the Copyright Act, will not be altered.” This is very different from anti-circumvention provisions found in the U.S. However, the FAQ also notes that circumvention for the purposes of private copying will not be permitted, meaning people may find themselves paying for a CD and paying a levy on blank CD yet unable to make the copy of the underlying CD.

More here, also the government has posted the full text of all 700 comments from the public review process.

Tod Maffin of the CBC’s Definitely Not the Opera has identified some broadcasting-related submissions:


With great power comes better special effects.

New Chemical Brothers video.


Have you fought your cereal lately?

Breakfast Brawl is some very fun Flash Mike Tyson’s Punch-Out style.


Yay to Google Adsense

Finally got around to adding google adsense to my site. Here‘s how it works.


it’s all on livejournal

Jeff Weise’s livejournal. The rumors over at livejournal are that Jeff Weise, the shooter in the Red Lake school shooting was a member.


Fifteen Elvish Ways to Die

Fifteen Elvish Ways to Die. Tidy creatures, elves insist on the cleanest of bathrooms. But don’t mix bleach and ammonia. Lohaton’s skill with the longbow is of no use to him now.


Point of interest sir, it also means bloody

Have you checked your humors today? Not the gunky jelly stuff in people’s eyes, the other kind.

Are you melancholic, phlegmatic, sanguine, or choleric? Are you a salamander, gnome, nymph or sylph? Earth, water, air or fire? Elf, Ninja, Pirate or Dwarf? (arrrr! buckets of blood! flagons of phlegm and barrels of black bile!)

If nothing else, the theory of humors adds to one’s arcane vocabulary.