dannyman.toldme.com

This page features every post I write, and is dedicated to Andrew Ho.

July 17, 2008
doodles

Woman

Link: https://dannyman.toldme.com/2008/07/17/woman/

My other favorite. She kind of came out of nowhere, and for me evoked Jordan while doodling in Thailand.

Feedback Welcome

July 10, 2008
doodles

Violet Guy

Link: https://dannyman.toldme.com/2008/07/10/violet-guy/

Inspired by a guy in Hat Yai, Thailand, but all mixed up, Picasso-style.

Feedback Welcome

July 4, 2008
Featured, FreeBSD, Linux, Mac OS X, Technical

HOWTO: Random Number in Shell Script

Link: https://dannyman.toldme.com/2008/07/04/shell-sh-bash-random-splay/

The other day I was working on a shell script to be run on several hundred machines at the same time. Since the script was going to download a file from a central server, and I did not want to overwhelm the central server with hundreds of simultaneous requests, I decided that I wanted to add a random wait time. But how do you conjure a random number within a specific range in a shell script?

Updated: Due to much feedback, I now know of three ways to do this . . .

1) On BSD systems, you can use jot(1):
sleep `jot -r 1 1 900`

2) If you are scripting with bash, you can use $RANDOM:
sleep `echo $RANDOM%900 | bc`

3) For portability, you can resort to my first solution:
# Sleep up to fifteen minutes
sleep `echo $$%900 | bc`

$$ is the process ID (PID), or “random seed” which on most systems is a value between 1 and 65,535. Fifteen minutes is 900 seconds. % is modulo, which is like division but it gives you the remainder. Thus, $$ % 900 will give you a result between 0 and 899. With bash, $RANDOM provides the same utility, except it is a different value whenever you reference it.

Updated yet again . . . says a friend:
nah it’s using `echo .. | bc` that bugs me, 2 fork+execs, let your shell do the math, it knows how
so $(( $$ % 900 )) should work in bsd sh

For efficiency, you could rewrite the latter two solutions:
2.1) sleep $(( $RANDOM % 900 ))
3.1) sleep $(( $$ % 900 ))

The revised solution will work in sh-derived shells: sh, bash, ksh. My original “portable” solution will also work if you’re scripting in csh or tcsh.

2 Comments

July 4, 2008
About Me, Featured, Politics, Religion, Testimonials

One Nation, Indivisible

Link: https://dannyman.toldme.com/2008/07/04/one-nation-indivisible/

“I pledge allegiance, to the flag, of the United States of America. And to the Republic, for which it stands, one nation, indivisible, with Liberty and Justice for All.”

IMG_0940

Notice anything missing?

Some time in grammar school I figured there was something wrong with an Atheist pledging allegiance “under God” and after some time I came to pause when we would recite those two words. “one nation . . . indivisible.”

Paul Burd asks “do you remember the words to the Pledge of Allegiance?”

I am overly aware of the words. I responded:

I can recite the Pledge of Allegiance no problem. But as a devout Atheist and an honest patriot I skip the Joseph McCarthy “under God” feature because it is sacrilegious to make false professions, and dangerously reckless to claim holy sanction for the State.

So, here’s to Independence from Tyranny and state-sanctioned religion!!

Feedback Welcome

July 3, 2008
doodles

Slick

Link: https://dannyman.toldme.com/2008/07/03/slick/

Yeah!

Feedback Welcome

July 1, 2008
Featured, News and Reaction, Politics, Technology

California to Manufacture Electric Cars!

Link: https://dannyman.toldme.com/2008/07/01/tesla-san-carlos/

Ed tipped me off that the North American factory for the new electric sports car, the Tesla Model S, will be in the San Francisco Bay Area. San Carlos is about half way between San Francisco and San Jose. It was thought the factory would be opened in Mexico, which offered government incentives. California offered its own incentives, and The Governator owns a Tesla Roadster. (And a Hummer.)

Gay marriage and electric sports cars! What awesome new stuff will we embrace next?

Feedback Welcome

June 26, 2008
doodles

Sketches

Link: https://dannyman.toldme.com/2008/06/26/sketches/

Feedback Welcome

June 19, 2008
About Me, doodles, Free Style

Self Portrait

Link: https://dannyman.toldme.com/2008/06/19/self-portrait/

Done in Thailand. I don’t recall if this was before or after I got sunburned. Pretty colorful for a white guy!

Feedback Welcome

June 16, 2008
Excerpts, Good Reads, Testimonials

Depression

Link: https://dannyman.toldme.com/2008/06/16/depression/

And one more excerpt from Mister Pip which so aptly describes depression:

The only thing I could think to do was to get into bed. And there I stayed.

For six days I didn’t get up except to make a cup of tea, or fry an egg, or lie in the skinny bath gazing at a cracked ceiling. The days punished me with their slowness, piling up the hours on me, spreading their joylessness about the room.

I listened to the buses change down gear outside the boardinghouse. I listened to the hiss of tires on the wet road. I lay in bed listening to the woman downstairs get ready for work. I listened to her run the shower and the shrill whistle on her kettle. I waited for her footsteps on the path below my window, and as that brief contact with the world departed I shut my eyes and begged the walls to let me go back to sleep.

A doctor would have said I was suffering from depression. Everything I have read since suggests this was the case. But when you are in the grip of something like that it doesn’t usually announce itself. No. What happens is you sit in a dark, dark cave, and you wait. If you are lucky there is a pinprick of light, and if you are especially lucky that pinprick will grow larger and larger, until one day the cave appears to slip behind, and just like that you find yourself in daylight and free. This is how it happened for me.

Lloyd Jones
Mister Pip

1 Comment

June 16, 2008
Excerpts, Good Reads

Epitaph for Mr Watts

Link: https://dannyman.toldme.com/2008/06/16/mr-watts-epitaph/

“Mr. Watts was as elusive as ever. He was whatever he needed to be, what we asked him to be. Perhaps there are lives like that–they pour into whatever space we have made ready for them to fill. We needed a teacher, Mr. Watts became that teacher. We needed a magician to conjure up other worlds, and Mr. Watts had become that magician. When we needed a savior, Mr. Watts had filled that role. When the redskins required a life, Mr. Watts had given himself.”

Lloyd Jones
Mister Pip

I like that epitaph: a life lived for others. It is also a reminder that whoever you may think you are, more versions of you come to exist in the minds, hearts, and souls of the people you come to know.

Feedback Welcome

June 12, 2008
doodles

Rhinoceros

Link: https://dannyman.toldme.com/2008/06/12/rhinoceros/

I was sitting in the Danish cafe in Kata, Thailand. I was thinking of the rhinoceros I photographed two months before at the Berlin Zoo. I drew him from memory, so this guy is one horn short and has floppy ears like my old dog, Max. I did try to move him, in my fantasy, from institution to the great outdoors.

This is a favorite of mine.

Feedback Welcome

June 11, 2008
Sundry

Free Bacon

Link: https://dannyman.toldme.com/2008/06/11/free-bacon/

I love sleeping. I have a peculiar fondness for that lazy part of the morning drifting in and out of consciousness, especially if the sun is shining through the window upon those parts of me where the sun don’t shine. I can hit the snooze button for hours.

I have put away the alarm clocks, and lately I have set my mobile phone and watch on the far side of the room. I’m getting back toward childhood when waking up in the morning meant stretching and scampering out of bed to discover what the world has in store. The mystery of not knowing what time it is sort of helps this.

That, and sunshine fills me with hope. Overcast, chilly days trigger my hibernation instinct.

This morning I walked to the post office to send a book to 季庄. Along the way I considered the relative merits of relaxing a bit at the coffee shop versus just heading straight to work because Wednesday is Donut Day. Then I recalled that Wednesday is also street cleaning day where I last parked. So, after the Post Office it was back up the hill to hop in the car. It was a pleasant drive with a great breeze because I lowered the back window. All the same, my heart is in public transit.

When I arrived at work, I found a donut, and headed upstairs. “I smell bacon,” I thought. I wondered at this, and then saw out front of one of our training rooms that breakfast had been served! Now, this food is not intended for me, but when our clients have fed themselves the employees take it upon themselves to clean up the leftovers. Because I had driven to work I was standing in front of the bacon . . . and eggs, and orange juice, at that critical time between when the customers have had their fill and the employees have cleaned up.

Today is off to a good start.

3 Comments

« Newer Stuff . . . Older Stuff »
Site Archive