Sunday, December 09, 2007


The semester is almost over. All I can say is that calculus is awesome. I have my final on Wednesday, I expect it's going to be fun.

In other news I'm having alot of fun with programming. I added CS 1400 Fundamentals of programming to my spring semester schedule. Yesterday I managed to execute an erlang module written and compiled on my linux box on my omniFlash. Pretty soon here I'll have Yaws and ErlyWeb running. Not too bad for a 200MHz arm with 32MB ram.

I'm pretty sure that the CS 1400 class is going to be kind of a walk. I'll be excited to see how it all works out.

Saturday, August 18, 2007

More fun with the hobie

Last week I went sailing up at bear lake. Today, I went sailing with my brother. I think the first lesson I learned today is that I need to get up earlier. If I get to the lake and the wind is already blowing pretty well, I've wasted that good sailing time.

Another lesson I learned is to make sure I secure the tiller extension arm before travel. The extension arm that makes it so you don't have to be sitting on the back edge of the boat the whole time in order to steer. The extension arm also costs $80, so if you drive out of the bear lake marina without securing it that's what the replacement is going to cost you.

I'm pretty sure it's a mistake that only has to be made once.

Other than that I've used silicone to cover the cracks in the starboard transom that were leaking so I should be good at least until the end of the season.

I bought some spare parts at my local Hobie dealer. I picked up some shackles lest I lose one while rigging the boat. I also got a new wind indicator. Apparently the flag decided to fall of of my old one between where I stepped the mast and where I put the boat in the water. Go figure.

I'm not sure how much this boat will end up costing me, but I'm pretty sure it will be worth it.

The adventures of Baron Munchausen

I'm watching this film right now. One of my favorite lines is from Baron Munchausen when speaking of the turks:

"They are inviting us to defeat them... We must ablige them!"

Tuesday, August 07, 2007

DDR Again

Today I played DDR for the first time in months. A friend of mine wanted to get StepMania and was having all kinds of trouble finding songs for it. She came over and I got her setup with the songs and then I proceeded to give myself a beating on the dance pad.

The last time I really played much DDR was last December. I was scoring low and breathing heavy. Too bad, I was getting pretty good before.

Saturday, August 04, 2007

Sink and sunburn

Thursday I took my hobie out and I made two mistakes. I discovered the first one about 200 feet out from the dock at deer creek. I noticed the boat was riding a bit low and didn't really know why it was performing so badly. I suddenly realized I had forgotten to put in the drain plugs. I usually give the matter of jumping off of a perfectly good boat in the middle of a lake some thought, but I figured this was a situation where I didn't want to waste too much time thinking about my options. The fact that the boat tilted sharply, submerging the end of the trampoline, when I crawled toward the back also helped me commit to jumping in.

We took on enough water for the boat to ride four inches low once we got off of it. I'm not sure how many pounds of water it was, but it felt like a significant amount. We got back to the dock just in time to catch a few people there. They were kind enough to help me drain my hulls by pulling the boat onto the dock and tilting it such that all the water would run out. The left hull was draining fast for a full 5 minutes.

Another mistake I made was not putting on sunscreen. It was overcast and didn't feel like I would burn all that much. The one thing I forgot is that I could burn with sufficient exposure to a full moon. Strictly speaking I wasn't that badly burned. The only part that was really bad was the tops of my feet. I went for the sandal strap burn pattern. Once I acquired the burn I quickly realized that these sandals were all I was going to be able to wear for a few days.

My roommate suggested aloe vera lotion instead of gel. I've used about half of a bottle and I think its helping my burns quite nicely. I base this observation on previous experience with the many sunburns I have had in my life. The only thing I don't understand is why it is that sunburns take so long to develop. I was feeling fine when I got out of the sun. It was just over the next 3 hours that my burns developed into the painful things that they are. Go figure...

The biggest loss from all of this was that I wasn't able to go sailing today as I expected my burns were going hurt too much. It also doesn't help that I'm still sore from stepping the mast on thursday. It took four tries to raise it. I never supposed that rigging a hobie would be so non-trivial.

Political Impact

A strange thing happened a few weeks ago when I declared my departure from political parties. Right after I finished writing that I went to give blood. I was denied because my blood pressure was 160/110.

Funny thing that. I guess I get a little worked up about these things.

Sunday, July 29, 2007

Hobie Cats are fast

Last week I bought a used Hobie 16. Yesterday I was able to take it out for the first time. I always heard they were fun, but I had no idea just how fun it would be.

My friend kentos and I got one hull out of the water. The only shame was that we weren't ready for it so it started coming out too far. As the other hull started dipping below the water I had to quickly let out the main sheet to keep us from tipping. It was awesome.

I think I'll be sailing as much as possible until the end of the season. As long as I can find a friend to handle the jib I'll be in good shape.

Saturday, July 14, 2007

My political resignation

Hash: SHA1

This morning I left the Democratic state convention at 10:12. I have decided to discontinue my official affiliation with the democratic party; something I already had to do a few years ago with the republican party.

There are many reasons for this. The first of which is that I believe that no group of politically driven people will accomplish anything if others in their group do not care enough about the rule of law to try to enforce it. It seems the only people concerned with impeachment are the citizens who are farthest from it.

Secondly, I believe that both parties are anti competitive in nature. In the state of Utah, for most elections, a candidate either has to have a long list of signatures or the nomination of one of the established parties in order to be listed on the ballot. It is my opinion that any person wishing to be considered by the public should be allowed to run. This would include multiple people from each party. At which point conventions would be where a candidate runs for the endorsement not nomination of a party. Conceivably, a candidate could receive the endorsement of two or more parties (yes, there could be more than two).

I love freedom, I wish to always be free. When I participate in any political organization it makes me feel sad. It's almost as if people are sacrificing their personal initiative for the will of the group. We all join groups and subgroups. Why? Is it because we don't want to be alone in what we believe? In what we value? Perhaps there's some benefit to being alone. If you are alone you may be better able to act independently of what others think of you.

I do not support government welfare, a big issue in the democratic party. By making that statement some would assume that I do not believe in christian charity. On the contrary I do not support it because of my belief in christian charity. Charity is only charity when an individual decides to give. It is because it was that individual's choice. The choice is taken away, and thus the charity destroyed, when a government taxes from one and gives to another against the will of the taxed. This also destroys the benefit of the relationships that can be formed when individuals help each other through acts of charity.

Our political process is highly broken. Candidates seem to win more by advertising budget than by what they plan on doing once they get into office.

There are many problems. So many that I'm not prepared to discuss a tenth of the ones I have ever noted. Suffice it to say that there is sufficient group-think in both of our parties that until there is a change in the minds and attitudes of the people in our country we will continue to get farther from the freedom we could enjoy. Our country does not suffer so much from oppression of government, though it is rising, as it does from blindness of mind.

And thus I resign from my active involvement in political parties.

Shaun Kruger
Version: GnuPG v1.4.6 (GNU/Linux)


Thursday, May 10, 2007

Debian gets feisty

A couple of weeks ago I upgraded my Debian box to Ubuntu feisty. The upgrade went ok, though today I found that my machine was having some issues and needed to be restarted. This is all fine and good except that I learned that the root filesystem is selected differently in feisty than it is in Debian.

Feisty wants to mount by UUID and my old upgraded Debian system wanted none of it. It had a kernel panic.

The fix?

I changed /etc/grub/grub.conf from root=UUID={...} to root=/dev/sda5.

I can't say I'm surprised. I've been a Debian user for coming up on 9 years. If I wasn't so comfortable with it I probably wouldn't have attempted the upgrade just because I know something is likely to go wrong when converting between distributions that just happen to use the same package manager.

Lets remember that this upgraded from a kernel I compiled myself with lilo as my boot loader. Ubuntu installed its own kernel and it uses grub unless you really have an opinion on the matter.

All told it was only a 15 minute fix and that's how I learned a valuable lesson.


Funny thing I just heard

"Dude, it worked. I just drew the internet with it!"

Sunday, May 06, 2007

Programming Erlang

Last night I pre-ordered my copy of Programming Erlang: Software for a concurrent world.

After having read the example chapters I think this is going to be a really good book on the subject. Granted, by the time it gets here I may not really need it, but it will still be nice to have.

One of my favorite things about buying books like this is that I can get a better view of what the author thinks is really important about the language. Instead of a language reference where everything is given equal time. (because that's what you need in a reference) You get a view of some of the best practices around using certain parts of the language.

Languages have syntax, libraries, and idioms. You don't get the idioms from the library reference. You also don't get them from the language reference, it's too busy describing the syntax.

I like what I've seen, and I'm excited to get my copy when it ships later this summer.

More erlang awesomenes

This weekend I started playing with erlang again, and erlang started impressing me again.

I just declared a lexically scoped anonymous function and sent it to a different node. I then executed it on that node and it worked as expected.

For those who are not familiar, an anonymous function is a function that exists, but that is not associated with a function name in a global table of functions. It only exists by a variable reference that can and will go away at some point.

Lexical scoping is when you use a variable in an anonymous function that exists in the current scope where the function is created. That is the only copy of the variable that will be used in the execution of the anonymous function, even in the case that another variable of the same name is seen near the anonymous function later.

Creating the lexically scoped anonymous function and sending it to the other host:

(nomad@nomad)43> Var = 4.
(nomad@nomad)44> Fn = fun(X) -> Var * X end.
(nomad@nomad)45> global:send(slim_proc,Fn).

Receiving the anonymous function into the variable Fn and executing it using map and executing it directly:

(slim@slim)28> receive Fn -> Fn end.
(slim@slim)29> L = [1,3,4].
(slim@slim)30> lists:map(Fn,L).
(slim@slim)31> Fn(3).

Remember: these are on two different machines executing in a clustered erlang environment.

Is this not awesome?

Saturday, May 05, 2007

If you die in Canada you die in real life!

In the event you haven't noticed. I would have to say that is my favorite web comic.

That said, it looks like I'm going to PGCon at the University of Ottawa in a couple of weeks. This will be my first conference of this variety. I'm highly excited.

Monday, April 16, 2007

New website

Ever since I got my new job at I've been a little busy.

OK... Very busy.

There is however one thing I thought was really cool. This video was put up on for a few weeks before it was to launch.

It's nice to work for people who can have some fun.

Monday, March 19, 2007

Income sources

Sunday night I was over at my parents house. My brother and his wife were trying to do their taxes and having trouble classifying things. Our Dad printed a copy of Publication 525 and found this great little bit on page 32.

Stolen property.
If you steal property, you must reports its fier market value in your income in the year you steal it unless in the same year, you return it to its rightful owner.

I already owe enough taxes. It's a good thing I didn't steal anything last year.

Thursday, March 08, 2007

Interesting news about bad behavior or "I'm shocked! Well, not that shocked..."

Last friday morning at 11:01 I got an interesting text message from Bob.

"Sarahbellum has been asked to stop blogging by the company. See her blog or mine."

I worked with Sarah until just over a month ago. Now, I really don't like working for companies that show signs of retardation and I must say that Protherics is just such a company.

I am not surprised that they asked her to stop blogging. It fits right in with their general way of doing things that can be best summed up thus:

"Lets not tell anyone what's going to happen and when we decide to roll something out lets do it so fast that we can't take time to avoid mistakes."

I don't put up with this kind of retarded behavior in the companies I work for. If a company starts getting too retarded I start sending out my resume.

I must admin though, I am biased. After all, I did leave.

Monday, March 05, 2007

Thorw a snowball day!!!

I just noticed Bob's post commemorating throw a snowball day.

Today is the 237th anniversary of the Boston Massacre where some people threw snowballs at British troops and were shot in return.

Some part of me wants to go throw a snowball at some TSA people. Nothing like a reenactment involving the latest oppressors to celebrate those that misbehaved before us.

If you think about it this isn't so different as it may appear. At the time they were throwing snowballs at representatives of their current legitimate government.

I wonder how fast would I be beaten and tried as a terrorist if I tried throwing snowballs at TSA staff today?

Monday, February 26, 2007

Preparing for fab

This last week I've been working with my favorite circuit board design software. It's no secret to many who know me that I'm a serious nerd so it should come as little surprise that I'm finally getting one of my projects I've worked on fabricated.

It's a power control board. I'll hook it up to a computer serial port and issue the PIC16F688 commands to enable and disable power through any one of the 4 relays on the right side of the board.

I've never done this before. In fact... I'm not even sure it's going to work. Sure, I'm confident enough to spend $78 for a run of boards and $35/board on parts, but really, do I KNOW it's going to work?

Keep reading to see how Shaun's first steps into embedded design go.

Sunday, February 18, 2007


I have been talking to a fried who has had some legal trouble within the jurisdiction of holaday city.

Between this and the legislature being in session it has caused me to ponder what is going on with our laws. They're pretty messed up.

I think it's a matter of broken trust.

We as citizens need to be able to trust all three branches of our government.
We need to trust the legislative that it will pass laws for our benefit, but not to the point of controlling us and our behavior.

We need to trust the executive that the police officers that are doing enforcement are doing so for our benefit and not for selfish reasons of having power over others.

We need to trust the judicial that it will take the time to understand the intent of the laws and that there may be real justice for all; both for the accuser and the accused.

Finally, these branches of government need to trust that the people they serve (for they exist only to serve these people) are capable of doing what is best for their own lives or living by the consequences of their actions.

I have come to the realization that what really has gone wrong is that this trust is broken.

The legislature doesn't trust that we can be aware enough to be responsible for our selves so they pass laws that make decisions about personal liability criminal infractions.

We no longer trust the legislature that they are listening, and that our representatives understand the proper role of government.

We no longer trust our law enforcement that they will respect our rights as citizens.

We no longer trust our judges that they will, with full fairness, consider the law or even be available without great expense.

Most of all, we no longer trust each other.

How many of us are there that will have a conversation with our neighbor before seeking for remedy by calling the police?

How many of us seek to change annoying behavior by having a law passed?

How many of us will try to force someone to change because we think what they are doing is foolish?

I firmly believe that every person has the ability to determine for themselves what is right for them. I also believe that it is not the place of government to stop someone who is on a path of self-destruction; it is possible that trying to force them to stop may perpetuate it further. It is the place of the people in the community to reach out to those that are harming themselves by their actions.

I don't think people in this country understand what it means to be free anymore, or what it requires. Many don't believe they can allow others to be entirely free because they don't trust anyone to use freedom responsibly.

The trust in all directions has been broken.

Tuesday, February 13, 2007

Ward websites

I'm the ward website administrator for my ward. This means I'm supposed to update the calendar and do other helpful things.

Today there was a training meeting where we discussed the proper use of the ward websites. I being the restless person that I am decided to figure out how to automate exporting the calendar. It took about an hour.

Here's how I did it. wget is a wonderful tool. It's good for downloading web pages.

wget --keep-session-cookies --save-cookies cookies.txt\
wget --load-cookies cookies.txt\

You find the loginForm target path by looking at the source of

You find the path to the calendar by observing the calendar link target.

The monthIndex and currentYear variable are required. You will end up with an error page if you don't supply them.
I generate their values using the date command:
MONTH=`/bin/date +%m|sed -e s/0//g`;
YEAR=`/bin/date +%Y`;

The sed command is meant to strip the leading 0 off of the month number.

The final thing I do is
grep `date +%m/%d/%y` calendar.csv
This returns the list of records for the current date. This is going to allow me to generate an RSS feed so that I can see each activity on the day when it comes up.

I just won't be able to tell you where the feed is. I have to keep it to myself because this data doesn't have easy public exports (like RSS feeds and ical subscriptions) for confidentiality reasons.

However, this does not diminish the coolness of the hack.

I can supply the shell script (passwords removed) to anyone interested in downloading their calendars in an automated way.

Disclaimer: This is in no way supported by the LDS church. If you use this information to automate the downloading things from your ward website it is up to you to act responsibly and not break the terms of use. This information was obtained by viewing the source of the main login page and reading the wget(1) man page.

Saturday, February 10, 2007


This week I decided to rent a room and move in with my grandpa.

The first thing that this means is that I need to go through my crap and throw a bunch of it away.

The second thing it means is that I'm not going to run for holladay city council this year. It probably would have been fun, but I don't think I would have time with my job at Either way, I can still run for state legislature. I could support the de-retardation of our state's laws.

It's still 6 weeks away, but it should be exciting.

Sunday, February 04, 2007

Lisp is my calculator

Today I was trying to calculate e.

I find that when I try to calculate things that involve either large exponents or sums of large series regular calculators just don't seem to cut it.

Today's calculation was for e using the formula given with limit notation:

e = lim x -> infinity (1+1/x)x

To do this I decided to select a value of x that is large enough to give a reasonable approximation for the first few digits... 25000

I don't know about you, but I havn't found many hand calculators that like to do things like raise numbers to high powers. Most graphing calculators can, but I don't always have one of those around.

The other thing I really appreciate is being able to work with rational numbers without introducing rounding error with floating point.

If I divide 3 by 4 in most calcualtors I would get .25. In lisp I get a fractional number of 3/4. In instances where you really care about rounding error this is a great feature.

The only down side is the calculation time. While I know I'm getting a good number, it can take a little longer. I have generated numbers multiple screens long. When you're dealing with these large numbers without loss you can get into trouble where you are maintaining accuracy you don't need.

For instance, in cryptography when you are trying to find C=PE (mod n) you can apply mod n to each step of finding PE. This keeps the number small enough to be operated upon.

Lisp may not be the best calculator around, but it sure helps get the job done when you need to operate on rational numbers.

Saturday, February 03, 2007

Getting back into things. (Plus a rant)

I haven't been blogging in almost a month. Really, I would have liked to, but how exactly blog about looking for work when you would be leaving multiple jobs at the same time?

Well, ended up offering me a job. It's great, I'm surrounded by smart people. Plus, it's a jump in pay. My main job that I just left was bought last month. You can read sarahbellum's recent thoughts on the matter. Suffice it to say, being a programmer and otherwise curious guy there wasn't much point to me sticking around to do sysadmin, helpdesk, or anything that involves user support.

You might say I've gone to a better place...

For what it's worth, I don't plan on working anywhere that is subject to FDA regulations ever again. It's not that I have any problem with laws that are meant to make people safe.

(I do have some problems with laws that make us more "safe", but that's no my FDA problem.)

No, being a citizen of this fine country I have taken it upon myself to be educated as to its operation. For those of you who may not be from around here, or who never took a civics class here's the breakdown of how laws are made (simplified):

The congress passes bills by voting on them.

The president signs bills into law and manages the departments that do enforcement.

The judicial branch looks at those laws and provides a process for making sure that the laws and their enforcement are within the scope of authority of what the congress and president can do.

Now this system works pretty well. If there is a rule that anyone is bound by there has to have been some unit of government (city, county, state, etc...) that has undergone the due process to make it follow this pattern.

The legislative makes the laws.
The executive enforces the laws.
The judicial determines if the laws are correct/valid.

Well, here we have the FDA. It was created by an act of congress, signed into law by the president, and allowed to continue by the judicial. Everyone dropped the ball.

Why is this a problem?

The congress has the authority to make laws by way of simple majority with the president's signature, or with a 2/3 majority overriding the president.

The congress was not granted authority to delegate its law making authority.

The FDA has a rule making process. The people who make the rules have been placed there by congress, but they are not subject to reelection as are the members of congress. These rules are enforced with the same effectiveness as other laws, but in the case of infractions you are subject to other FDA rules or laws that have been passed by the congress. It's kind of messy.

The biggest problem with this is that if you break an FDA regulation the only remedy is to work with the FDA. There is not a judicial due process in place.

That is to say, when a regulation is broken there is not a judicial line of authority (appeal process) that leads to the supreme court. This precludes regulations from being judged as to their constitutionality.

For what it's worth, I really like our form of government. It would work really great if we used it the way it was designed.

Before we can really be free enough to have a real constitutional government people have to respect the boundaries that are so important to keeping it going. Even worse is that the current iteration we are living under now will have to collapse under its own corruption before it can be replaced by good people who will not support such corruption.

Is my dearest hope that I may one day be worthy to live among people who can abide by a constitutional form of government the way it was meant to be used.

Friday, January 05, 2007

I finally get RSA

Over the last week or so I've been trying to figure out how RSA encryption works. I've been reading books like In Code, and Number Theory.

Today I can say that I properly understand how to do RSA style encryption.

It all starts with finally understanding congruences...

C ≡ PE(mod n)
P ≡ CD(mod n)
where P = plain text and C = Cipher text

For the readers at home this is read as:
C is congruent to P raised to the E power modulo n
This means that if you divide C by n, or P raised to the E by n you will get the same remainder. In the case of cryptography you are seeking C which IS the remainder.

To make life easier I'll write it in a more friendly programming notation:
C = (P^E)%n

Once I understood this much the next part was figuring out how to come up with valid values of n, E, and D. What follows is how you come up with an RSA key.

Before we can find n we need to mind our p's and q's.
p and q are primes.

For the sake of this exercise we will select 31 and 17 as our primes.
p = 31
q = 17
n = p * q = 527
φ(n) = (p-1) * (q-1) = 480

The last one: φ(n) gives us the modulous we need as a base for finding D and E.

We need to find a number that is relatively prime to φ(n) (no common factors). We can use the euclidian algorithm to determine the greatest common divisor. I'll post code at the end.

Let's try 41 for E.
gcd(480,41) = 1

Now we need to find D, the multiplicative inverse of E modulo φ(n).
41*D ≡ 1(mod 480)

This part took me 3 days to figure out. It finally came together when I read about the Extended Euclidean algorithm on wikipedia. I wrote a function that returns the multiplicative inverse based on the modulous.

In this case D = 281.

We have generated a bunch of numbers:
p = 31
q = 17
n = 527
φ(n) = 480
E = 41
D = 281

Now we need to discard p, q, and φ(n).

In RSA encryption p and q are large prime numbers (100+ digits). The reason why it is secure is you need to know p and q to get D from E. When n is the product of large primes it becomes very time consuming to factor back to those primes.

Finally, this leaves us with our key pair.
KE = (41,527)
KD = (281,527)

Now for the code of the gcd function and the multiplicative inverse modulo base function:
(Forgive the indentation, I know no good way of doing this with blogger)

(defun eu-gcd (base num)
(let ((remainder (mod base num)))
(if (eq remainder 0)
(eu-gcd num remainder))))

(defun inverse-modulo (base num &optional (b1 0) (b2 1) orig-base)
(let* ((di (mod base num))
(k (- 0 (/ (- di base) num)))
(bi (- b1 (* k b2))))
(if (eq di 1)
(mod bi orig-base)
(inverse-modulo num di b2 bi (if orig-base orig-base base)))))

How political thinking in utah works

This morning I was thinking about it and realized that my car was hit right under my Pete Ashdown sticker.

I began channeling the standard utah-party-politics-religion paranoia and was thus led to the conclusion that an Orrin Hatch supporter was subliminally led to drive poorly in the Dan's parking lot!

That's it! Republicans don't think democrats should drive decent looking cars!

I'll show them. I'll support legislation that bans business owners from writing off those nice cars they lease. We all know that ALL republicans are business owners so I'll be able to stop them from having nice cars too!

The only trouble is that it won't stop there...

Next week when I get an oil change I'm going to have to make sure that it's a good democrat that does it. If I let a republican do it who knows what they'll sabotage on my car!

You see, those republican business owners want me to do my part in saving the economy by buying things I don't need. Like say, a new car.

The really devious part of it all is that you know the major car companies are run by republicans. That's the real reason they want me to buy a new car. It's all about selling their wares!

Retarded isn't it?

You can't have a reasonable discussion if you're competing with thinking that is on this level. If you don't believe me just wander around the conventions of both political parties and listen in on a few conversations.

If you're not with us you're a heretic.

Who suffers from this? The citizens.
Can you participate in the parties without getting sucked into it? Not really.

Thursday, January 04, 2007

The wonders of Costco

Tonight I called Andy and we went to costco for dinner. It was a pretty ordinary trip. I picked up some bacon and some other food. We paid and decided to get some pizza.

While we were eating, a couple of employees were taking apart some tables. Andy and I overheard how they were trying to figure out how to throw them away.

I knew I had to act fast.

I inquired whether or not I could take one if they were throwing them away. They asked their supervisor and I got myself one free table.

I'm going to have to say that this is the coolest free table I've ever gotten.

Hit & Run

As far as I'm concerned there are only two types of hit & run.

There's the fun type:

And the not fun type:

Some call me a crazy driver, but to my credit I have yet to damage someone elses car while driving.

Tuesday, January 02, 2007

Huzzah! for no clichés

I was going through my RSS reader and found this blog post on coding horror: On the Use of Clichés.

I cut the text of my last post and pasted it into the cliché finder that was referenced. I felt special when it found nothing.

Now to keep up the not quite bad writing...