All My Brain Where stuff from my brain lands

June 2, 2012

git diff with color words

Filed under: Programming — Tags: , , , — Dennis @ 7:10 am

I had these files with very very long lines of text on each line. It was paragraphs worth of words but not word wrapped. These files were stored in a git repository. Now and then, someone would change a word. Diff with line based output was difficult to find what actually changed.

I figured there must be a way to see just the words. A little searching around the docs and I found it.

> git diff --word-diff=color

Perfect. I still got ling scrolling lines though. You can override that with your $GIT_PAGER variable or I just piped the output manually for a one time fix:

> git diff --word-diff=color | less -r

Much easier to see the changes!

April 3, 2012

Storing Lipo batteries for faster charging times and longer lipo life

Filed under: Radio Control — Tags: , , , , — Dennis @ 7:33 pm

I just finished a quick flight at the park with my Trex 550e. What a fun bird to fly.

Trex 550e Upside down hover

That picture was taken last year on a nice summer morning. No pictures today but it’s the same heli.

Anyway, the point of this post is about lipo batteries. I just brought up the heli fly because I had such a great experience with it’s battery. Coincidentally, I was just talking today with someone about charging batteries and they wished they could charge 4 6S batteries in 20 minutes. You need a lot of Watts to do that. A 6S lipo is 22.2V nominal and the batteries for these helis are 5000mAh. So if W=A*V then 4 of these things take ~444W to charge in an hour. Triple that to do it in 20 minutes. The only charger I know of that can do close to that is the Powerlab 8. Given a big enough input power supply it can do 1344W output.

Step back a bit. When I first started flying RC airplanes and helis I wanted to fly all the time. Well, I still do but I was pretty gung ho from the beginning. I’d do like 3 or 4 flights per day if the weather wasn’t bad. Morning, evening, it was all good. We live by a park big enough to fly my small trainer so I’d just run out for a couple quick flights and then go back to doing whatever. I didn’t have time to charge my batteries before every flight so at the time I just charged them after the flights and left them charged all the time. It worked out pretty well except after a while I started learning that it might be best to not store them charged all the time. Apparently it breaks down the chemistry faster when they have a full charge. A day before you’re probably fine but charged all the time is going to wear them out much faster.

Ok, side note again. All my batteries that I did that with are still fine. I use them in planes and even an EDF still and as far as I can tell that early storing stuff didn’t do much harm to them. BUT… you know, the experts must have something they know so I better heed advice.

Fast forward a bit. I decide I should probably not store my batteries charged. I think this is the point I started flying less often. If I wanted to go fly something I had to take a moment and charge some batteries. You can see why someone would want to be able to charge their batteries FAST.

I got a better charger.

OK, so I have this charger that can charge faster than the original one I had but I have a lot of batteries by this time too. I hook them all up and charge most of them at the same time. It can take over an hour still. In the mean time, I keep learning and reading things and I find out that the experts are advocating not storing the batteries all the way discharged too. Apparently storing them discharged has a similar effect to when you store them charged. How much? I have no idea. My philosophy is that I’ll probably destroy the battery before I find out if the way I stored it has much effect. However, this is good news because 1) My fancy pants charger has “store” mode and 2) I get to fly faster if they are already charged a bit.

Store mode on these chargers puts the charge on the pack back to about 70% capacity. Somewhere around 3.85-3.9V/cell. So now I get to feel all dandy because I’m storing my batteries in such a way that the experts won’t complain AND, my charging time is cut in half. I just charge the packs before a flight, go fly, then stick the packs back on the charger for their storage charge and I’m good to go for next time.

Back to the heli flight today. I was smiling because I just stuck that one 6S 5000mAh pack on for a quick charge and 20 minutes later I was ready to go.

March 16, 2012

Quick convert raw g711 uLaw audio to a .au file

Filed under: Programming — Tags: , , , , — Dennis @ 4:31 pm

I had reason to playback some raw g.711 audio data. I made the following script to convert the data to a .au file that is playable.

From the AU file spec.. which is way simple by the way:
You just need to add 6 32-bit header flags.

import struct

header = [ 0x2e736e64, 24, 0xffffffff, 1, 8000, 1 ]
o.write ( struct.pack ( ">IIIIII", *header ) )

raw = open('in.raw','rb').read()

You can probably see that this would be extremely simple to use with other audio formats too. Modify as you need.
Header Bytes:

  1. Const AU identifier: 0x2e736e64
  2. Size of Header: 24.
  3. Size of File: use 0xffffffff for unknown, or you could replace with the actual size.
  4. Audio format. 1 is uLaw. From the spec choose whatever you need if it isn’t uLaw.
  5. Sample rate. uLaw is always 8000.
  6. Channels. 1 channel in this case.

February 23, 2012

How to correctly calculate break even time on a refinance – For Math Geeks

Filed under: Miscellaneous — Tags: , , , , , — Dennis @ 8:13 am

After my last post on refinancing, I found a refinance calculator on that compared loans the way I suggested. It has a shortfall though, it calculates break even time with the difference in your new payment compared to the difference in your old payment. This is actually quite incorrect. That number is good to show you how much money you’ll have extra in your bank account each month if you are making only the minimum payment. What if you pay extra on the mortgage though? In order to make almost any refinance the most beneficial, you need to pay extra on the new mortgage so that it doesn’t take as long as the new term of the loan to actually pay off the mortgage. i.e., you should at least pay what you were paying on your old mortgage.


January 29, 2012

Should I refinance my house?

Filed under: Miscellaneous — Tags: , , , , — Dennis @ 7:28 pm

OK, disclaimer: I’m not a financial professional. That said, I do enjoy financial topics and am somewhat of a hobbyist. I’ve written articles in the past about how I do envelope budgeting with Gnucash for instance. That said, I’ve been thinking a lot on these interest rates lately and thought I’d write down a few thoughts.

Anyway, if you haven’t noticed, long term interest rates are quite low. At time of writing, my local credit union is offering 30 year mortgages at 4% and 15 years for 3.25%. Naturally, I got an email from the broker we worked with last time we refinanced saying we might be interested in another refinance. I figured lots of other people are in a similar type of situation so I thought I’d write down a few tips.


December 13, 2011

Upgrading Software

Filed under: Software — Tags: , — Dennis @ 7:07 am

I can never resist. When a new version is available I have to have it. Upgrade to WordPress 3.3 was seamless. Devils is always in the details though. I’ll probably find a post or a plugin that doesn’t work the same way.

Oh well, I’m on the latest and greatest right?!

« Newer PostsOlder Posts »

Powered by WordPress

%d bloggers like this: