January 19th, 2008

Finally got a shaving brush

shaving brush, shaving cream, Gillette Sensor razor

Ever since I read an article a year or two ago about how to get a better shave, I’ve been wanting to try out some of their tips. I believe that’s when I started shaving in the shower, which I definitely like better than trying to shave at the sink. I’ve had “shaving brush” on my Christmas, birthday, and Father’s Day wish lists, but it just never happened… until this past Christmas (2007). Lacey bought me a shaving brush and shaving cream.

I’m not brave enough or motivated enough to try a different type of razor, at this point, so I’m sticking with either my Gillette Sensor (which I’ve had since Gillette was nice enough to send me a free one for my 18th birthday; nice marketing, Gillette!) or my Schick Quattro. I prefer the Quattro, but the cartridges are more expensive so I only get them occasionally (sale + coupon is always good!). I can usually get a big pack of Sensor cartridges for a less outrageous price, although even those seem pretty darned expensive. I actually tried some generic cartridges last year, which fit Sensor razors, but the difference in quality was quite noticeable. I’ll stick with the name brands.

Anyways, I’ve used the shaving brush + shaving cream 4-5 times, now, and I’m definitely a fan. I’ve been able to get the closest shaves I’ve ever had, with no irritation, and have even been able to get more uses out of a single razor cartridge than I could when I just used regular store-bought mainstream shaving gel (i.e. chemical-rich goo).

If you’ve never tried using a good shaving cream and a badger-hair shaving brush, you don’t know what you’re missing. I’ve always hated shaving, and although the brush+cream didn’t make me actually enjoy shaving, like they have done for some people, they definitely make shaving less annoying.

I’m not sure where the article that I read a couple years ago, that first sparked my curiosity on this subject, but here are a couple that I’ve read since then:

and a couple of pages with links to more shaving-related information/tips/etc.:

July 3rd, 2007

Google Maps adds drag and drop tweaking

Read about this on one of my favorite geek/productivity blogs, lifehacker:

Google Maps: Drag and drop to tweak your driving route
Don’t like the driving route Google Maps doled out to you? Now you can change the driving directions by grabbing the blue route line and dragging it to create a new destination point, which will in turn create a new route.

I’ve been wanting this feature from any online mapping service, for *years*. I’ve talked about it countless times with friends, co-workers, classmates, etc. The ability to say “No, dummy, I’m not taking 66. It’s rush hour!” or “Ack! No way, they’re doing road work on that road this week, and it’s a mess.” is something that I’ve always wished for.

I haven’t tried this feature on Google Maps yet, but I look forward to playing with it sometime in the near future!

August 2nd, 2006

screen in cygwin needs System attribute on SockDir files

This will not be of use to many, if any, but I expended effort trying to figure out how to solve this today, so I’m posting it here for future reference, if nothing else.

Today, at work, I ssh’d to my home computer, and tried to run ‘screen -r -d‘, to reattach to an existing session of gnu screen at home. Here’s what happened:

$ screen -r -d
There is no screen to be detached.

I knew this was not true, so I tried this:
$ screen -list
No Sockets found in /tmp/uscreens/S-myusername.

I didn’t believe it, because I knew I had an existing session open, so I looked for myself:
$ ls -l /tmp/uscreens/S-myusername/
total 2
-rw——- 1 myusername None 54 Jul 24 14:35 1696.tty0.spugbrap-home
-rw——- 1 myusername None 54 Aug 2 14:19 3500.tty0.spugbrap-home

I saw it right there, so I looked to see if one of the processes that I had running in my existing screen session was still running:
$ ps | grep perl
3204 368 3204 1760 13 1003 14:20:05 /usr/bin/perl

Sure enough, there it was… So, I took a look at my SockDir on my laptop, at work, to see if permissions might be involved in some way:
$ ls -l /tmp/uscreens/S-myusername/
total 3
srwx—— 1 myusername None 53 Aug 2 14:18 2568.tty1.dave-laptop
srw——- 1 myusername None 53 Jul 4 01:05 3600.tty1.dave-laptop
srw——- 1 myusername None 53 May 15 15:42 960.tty1.dave-laptop

Ah hah! There was a difference! The ’s’ at the beginning of the permissions list on my laptop’s SockDir contents, but not on my home machine’s.

So, I went searching for what the heck that ’s’ stands for, since usually, if anything, I either see an ‘l’ (L) or a ‘d’. I checked the help, info, and man pages for ‘ls’ and ‘chmod’, but didn’t find anything that actually matched this flag. The closet thing was ’suid + executable’, but when I tried to chmod that onto one of my files, the permissions showed ‘-rws——’, which is not what I was looking for.

A google search or two, for things like ‘srwx——‘, ‘srw——-‘, ‘srwx srw‘, ‘cygwin srw‘, etc. didn’t turn up anything useful - at least not in the first pages of results.

I tried looking at my laptop’s SockDir in windows explorer, and looking at the advanced security properties of one of the files. Nothing looked interesting. Then I looked at it from a command prompt (4nt), and saw this:
[c:\]dir c:\cygwin\tmp\uscreens\S-myusername
[…]
0 bytes in 0 files and 2 dirs

Oops, let’s try with ‘attrib’ instead of ‘dir’:
[c:\]attrib c:\cygwin\tmp\uscreens\S-myusername
__SA_ C:\cygwin\tmp\uscreens\S-myusername\2568.tty1.dave-laptop
__SA_ C:\cygwin\tmp\uscreens\S-myusername\3600.tty1.dave-laptop
__SA_ C:\cygwin\tmp\uscreens\S-myusername\960.tty1.dave-laptop

Ah hah! The ’system’ and ‘archive’ attributes were set on these files. So, I verified that these flags were NOT set on the files on my home machine:
$ attrib “c:\\cygwin\\tmp\\uscreens\\S-myusername\*”
C:\cygwin\tmp\uscreens\S-myusername\1696.tty0.spugbrap-home
C:\cygwin\tmp\uscreens\S-myusername\3500.tty0.spugbrap-home

Sure enough, there’s the difference. So, I set the ’system’ attribute on those files (didn’t bother with ‘archive’ attribute, though I’m not sure what causes it to be there on my laptop but not on my home):
$ attrib +”c:\\cygwin\\tmp\\uscreens\\S-myusername\*”

Verified that it worked:
srw——- 1 myusername None 54 Jul 24 14:35 1696.tty0.spugbrap-home
srw——- 1 myusername None 54 Aug 2 14:19 3500.tty0.spugbrap-home

Then, I tried connecting to my existing session, and it succeeded.

While preparing this post, I experimented a little bit more, and noticed that, for some reason, my home pc is not creating these screen socket files with the required ’system’ attribute at all, anymore. I’m not sure why this is happening, now, because I can’t think of anything I’ve done, recently, that might have caused any different behavior as far as permissions and such.

I will post again if I figure this out, but for now I am content with adjusting the attribute manually. In theory, I can keep each screen session alive until my next reboot (which is rare), so I shouldn’t have to do too many manual adjustments like this. I also welcome any comments on how to solve this problem, or any other useful tips for effectively using gnu screen in cygwin.

July 13th, 2006

Generating a random fake name from the commandline

Today I needed to come up with a list of lots of fake names for test data. In the past, I either manually entered well-known fictional character names (e.g. Homer J. Simpson), or used strings of characters (like ‘asdf g. hjkl’ or ‘aaaaaaaaaaaaaa’).

I remembered seeing some sort of test data generator, somewhere, recently, so I googled for “fake name generator test data“.

What I found was http://www.fakenamegenerator.com, which generates realistic test data based on country, name origin, and gender specifications. More info on the site at the end of this post. Here’s a set of commands that I put together to retrieve one fake name from that site:

curl -s -b agreement=Yes “http://www.fakenamegenerator.com”
| grep -o ‘on Google”>\([^<]\+\)’
| sed -e “s/[^>]*>\([^<<]\+\)<.*/\1/g”

When you use the site like a normal human being, the fake data that is generated includes full name, address, email address (usable, provided by an anonymous email service), phone number, mother’s maiden name, date of birth, and credit card number (+ expiration date). Very cool! For a very small fee, you can also order a bulk batch of data, which also includes fake Social Security Numbers).

However, being the penny-pinching and geeky type, I wanted to be able to generate my own list of fake names (without all the other info), for free. The set of commands listed above work right now, from a cygwin bash shell, but will probably break sometime in the future, when the HTML structure of the page changes. Oh well.

Oh yeah, don’t forget to read their terms of service* before using the service… Right now, I could not find anything prohibiting the use of automated tools to generate and retrieve names, but use the above set of commands at your own risk!

* The terms of service page only displays one time, unless you clear/disable your cookies.

July 13th, 2006

Using ImageMagick and 4NT to find jpegs by quality level

Using ImageMagick and 4NT to find and modify all jpegs in the current dir who have quality level 94:

for %f in (*.jpg) do (echo %f
& identify -verbose %f | grep Quality
| grep -o “[0-9]*”)

iff “%@execstr[identify -verbose %f
| grep Quality | grep -o “[0-9][0-9]”]” == “94″
then & echo %f & endiff

for %f in (*.jpg) do
(iff “%@execstr[identify -verbose %f
| grep Quality | grep -o “[0-9][0-9]”]” == “94″
then & echo %f &
mogrify -strip -quality 84 %f & endiff)


Unrelated side note:
This is one of several posts that I will be making in the near future, which come directly from my ever-growing toblog.txt file… No code cleanup or lengthly explanations, just commands I’ve run at some point that I thought were worth saving.