April 6th, 2013
|03:20 am - still exist|
March 7th, 2010
|02:04 pm - growing kernels in Ubuntu grub|
Since Ubuntu 9.10, they have grub 2.0, which uses /boot/grub/grub.cfg file. Every time ubuntu gets a new generic kernel it updates grub.cfg and includes all kernels present. This leaves a huge boot menu with kernels galore. I think you can simply delete the kernels you don't want. I'm not sure though, so I don't. I do however comment out all the older kernels in grub.cfg, so I only have the latest kernel that works listed. This can be easily done with sed. For example, I found recently that lines 65 - 159 in /boot/grub/grub.cfg create the menu items for all the other kernels but the latest. $ sudo sed -i '65,159 s/^/#/' /boot/grub/grub.cfg
First I backup /boot/grub/grub.cfg before I execute the following:
And here is my new grub.cfg file, so you can see how it looks. Note the beginning of that file says "DO NOT EDIT THIS FILE" I guess it should more aptly say "DO NOT EDIT THIS FILE, UNLESS YOU KNOW WHAT YOU ARE DOING!" :)
January 21st, 2010
|10:01 am - ubuntu packages memory|
Here is a little script I have in /etc/cron.daily to keep track of my Ubuntu (debian) packages on a day to day basis:
Each day it prints out a list of all packages and stores it in a file /etc/packages.list
Before it does this, it copies the current /etc/packages.list (which was created yesterday) to /etc/packages.list.yesterday
Then it it notes the differences in the two files. These differences along with a date header are copied to a file /etc/packages.change
If something new was installed it will appear like this:
If a package was removed, it will appear like this:
My brain works chronologically. Today I remembered I installed a package back in December, but I can't recall which. So I went back through that file and looked for December dates and I found the package I was looking for. Pretty nifty.
Another thing I used it for was when I did a fresh install of Ubuntu 9.10 last Fall. I went through my /etc/packages.list file and pared it down to what I knew I wanted. After I installed 9.10, I issued the apt-get install <my package list> to install all those packages I wanted (and any dependencies were automatically installed too).
January 14th, 2010
|09:44 pm - randoms|
Wow, I think I played online poker once since September--and that was with some people I know online, just a $5 tourney.
I have been obsessing over linux a lot. Doing a lot of shell scripting, which is more of a cerebral activity for me. My scripts are probably a bit sloppy and inefficient, but that doesn't matter too much. So here are a couple, maybe I will improve over time...
Here's a simple alarm.Here's one I wrote to rip and encode mp3s from a CD, it queries freedb for cddb info. I haven't tested it too much, but I did make some modifications so that it (might) work on compilation CDs.
Also I really like the imagemagick suite which does a lot of cool stuff to photos from the command line. It has very powerful things which I haven't even touched the surface of, but it also does something I like and very easily: shrinks photos to my liking, e.g.
$ convert myimage.jpg -resize 40% myimage_sm.jpg
I liked it so much I made a script to batch shrink photos and place them in a sub-directory called small. :D
Imagemagick is also available in cygwin, so you can do these wonderful things in windows too!
November 11th, 2009
|11:39 am - How to convert a flash video to DVD in Ubuntu 9.10|
Sometimes I think the command line is handier if you know what to do.
Here is how to convert a youtube video (.flv) to a dvd iso image, which can be burned with your favorite program.
This is derived from this tutorial on converting an avi to dvd.
In Ubuntu, you need to install a few things:
$ sudo apt-get install mplayer ffmpeg videotrans dvdauthor genisoimage libxvidcore4 clive
Download the video, using clive (I mentioned this in an earlier post).
$ clive http://www.youtube.com/watch?v=jD6biAcET2g
Conver the flv to mpeg2 using ffmpeg. My video was 16:9 aspect:
$ ffmpeg -i movie.flv -target ntsc-dvd -aspect 16:9 output.mpg
Then I use dvdauthor to create the dvd structure and title:
$ dvdauthor -o dvd/ -t output.mpg
$ dvdauthor -o dvd/ -T
Finally I convert the dvd folder structure into a dvd iso image:
$ mkisofs -dvd-video -v -o MyMovie.iso dvd
You can now burn the iso image using your favorite burning app. In nautilus (GNOME), I opened the folder with the iso image, and just right-clicked on the iso image and selected "Write to disc."
May 17th, 2009
|03:19 pm - The worst hand in hold'em|
One time, I was playing a juicy live 4/8 game in Vegas and an irritated, somewhat irate player was arguing with another player. Then he turns to me and asks, "hey, what's the worst hand?" I know what he wants me to say, but instead, I respond, "It depends." He says more emphatically, "No! What's the worst hand?" I respond the same. He finally says, "7-2 ! Everybody knows this!" I added no further comment, he was a terrible player, but he was right in a sense--it is often stated that 7-2 is the worst hand, so it is generally accepted as such. The thinking here is that 3-2 can make a straight with both hole cards, while 7-2o cannot. Never mind that flopping a straight happens less than 1% of the time, however it does really depend. Read on.
You can get the free software (not open source) PokerStove which does those awesome calculations of equity like those shown on tv--the percentages. For example, the classic coin flip AKo (o means offsuit) vs 55 is considered a "coin flip." Putting these into pokerstove, here is what the output looks like:
So it's close to 50:50, but 55 is actually a slightly better hand when matched up with A-K. Everyone should take 55 here on an even money bet.
Now let's come back to 72o. The so-called worst hand. Indeed, it is better in performing against many hands heads-up than 32o. Here are some common match-ups vs big hands. Here is how each hand matches up vs some clearly better hands:
hand 32o 72o
vs AA 12.8% 11.8%
vs KK 14.3% 12.1%
vs AKo 34.0% 32.4%
vs JTo 32.8% 30.5%
Note the percentages are quite close. In the above match-ups, 32 is relying on the small chance that it makes a straight to give it a slightly better equity. Consider when these hands are matched up with small pairs, and other weaker hands:
hand 32o 72o
vs 55 12.1% 28.4%
vs 66 13.5% 27.8%
vs A2o 25.3% 25.0%
vs A5o 32.4% 34.4%
vs 66 or 55, 7-2 just blows away 3-2. Let's consider why. In 32o vs 55, the fives are "blockers" preventing 32o from making a wheel. Only two fives left would allow 32o to make a straight. However, this is only 1%, so again, it's not a big deal. The same argument can't be used for 66. The reason should be obvious: 72o can improve to a better pair with the one overcard. 32o can't do this. It needs 2-pair or better to beat any pocket pair. In this situation, if your opponent had 55 and you had to choose between 32o and 72o, your choice would clearly be 72o.
Now, what if these hands are matched up against one another? In this case, we get:
Not surprisingly, 72o has the clear advantage as it is dominating 32o. If 32o pairs the 2, it's none the better. It should be noted that the percentages are technically 72o=56%, 32o=26%, and 9% of the time both hands tie.
In our final scenario, we may ask which hand is better when sitting amongst 8 other random hands at a 9-handed poker table. In pokerstove, I have to choose the "Monte Carlo" option as it would take an enormous amount of time to calculate the actual percentages of 8 random hands. Here are the results for that:
72o 4.9% vs 8 random hands
32o 4.9% vs 8 random hands
So, let's not lose too much perspective here: Both hands are junk hands, and should rarely be played at a full table!
April 11th, 2009
|02:10 pm - clive - get flash video|
Just found clive, which will get flash videos from youtube, i.e.:
March 2nd, 2009
|06:01 pm - maybe gonna start posting useful linux commands|
So when you type:
gives you pretty colors for filetype / directory. This is usually aliased in bash as
I frequently use
However, it is not in color, but I discovered that
ls --color |less -R
retains the colors.
March 8th, 2008
|11:07 pm - the truth about bad poker players|
shh..don't tell anyone.
People who aren't very good at poker often complain about bad losing streaks or whatever, like they have some abnormal sort of bad luck. The losing streaks are standard to most everyone who plays the game. The problem that those bad players don't acknowledge is that they focus on the times when they lose a medium-biggish pot with a "good hand" and forget about the milieu of times they lose a small pot with a mediocre hand.
February 28th, 2008
|12:00 am - wicd as an alternative network manager in linux|
I have been using Gnome Network Manager since I installed Ubuntu on both of my laptops. It has handled wifi decently, but there have been some issues. I read about wdic as an alternative network manager. Like nm-applet, it can sit in the tray. It also is more configurable.
For ubuntu, I merely added the line to /etc/apt/sources.list as such:
deb http://apt.wicd.net gutsy extrasInstalling wicd, then uninstalls the gnome network manager. So you will be momentarily offline. It is probably a good idea to locally cache the FAQ page before installing:
Followed by executing the following to update repos and install:
sudo apt-get update
sudo apt-get install wicd
For me, there was a minor issue due to the fact that the daemon for gnome network manager was still floating around even after uninstalling. A reboot fixed it.
More information on wicd at sourceforge.