Remove duplicates and recover original filenames on Windows

A pasthard drive meltdown, which was the one I was syncing Google Drive to, continues to strike waves as I try to recover my system, especially my photos which have changed names, went lost, and who knows what else.

One problem I encountered was that many files have been duplicated and Windows graciously gave them dup names (“file.ext” was replicated as “file (1).ext” and a linear legacy of successors). The following two powershell scripts take care of sorting that mess:

(a) Remove duplicate files

 ls * -recurse | get-filehash | sort -property path | group -property hash | where { $_.count -gt 1 } | % { $ | select -skip 1 } | del

(b) Restore filenames when only a filename with a (1) suffix exists

get-childitem * -Recurse | foreach { rename-item $_ $_.Name.Replace(" (1).", ".") }

A key to excellent product

In the same vein as the 10,000 hour rule, I will claim that it takes 10,000 edit/refresh cycles for one to get to an excellent product. From the first prototype that you stand up, through lots of polishing and tweaking, making the user experience delightful to shaving critical milliseconds of unwanted latency, there’s a lot of repetitive editing and refreshing.

Everything that stands in between your edit to your refresh is slowing down your product honing process. Be it compilation, reinterpretation, writing unit and integration tests, or getting approvals from peers / legal – these will all either set you back time-wise or will prevent you from achieving 10,000 edit/refreshes and degrading your product. So make sure you’re unblocking your critical path on the product. Add tests and optimization steps cautiously – they should come in later and you should have a good idea of what reward you’re getting.


P.S. I’m pretty sure there’s a Tim Ferris of product that will find ways of short-cutting the 10k process. I’m also sure some tools and methodologies are totally worth it despire upfront cost. As always, take this post as a mental challenge more than a prescribed way of living.

First Impressions

I was working out in the gym the other day, and I approached another person to ask whether a pair of weights next to them was free. My timing want great: that person had just begun lifting a different pair of weights, and so I stood and waited.

When they were done, they grudgingly said “you don’t talk to a person in the middle of a set. What do you want?”

“Are those weights free?

“No, I’m using them” (still stands there not using them)

“When do you think you’ll be done with them?”

“15 minutes or so”
This is an absurdly long time for a lifting session, and I had a hunch this person was trying to aggravate me, still I made another try.

“Do you think we could share them during this time?”

“No! Absolutely not. You can get one of the powerblocks instead”

I composed myself. “That’s OK, I’ll wait”

I took a mat and did some stretching. As I had hoped, since I didn’t give any excuse to fuel the person’s anger, after a minute or two they returned the weights to the rack and caught my eye to make sure I noticed.

At the time, I was quite shocked by that person – this is the rudest someone has ever been to me at work in 7 years.

Here’s the interesting twist: I was in the middle of a role transition, becoming a manager of a new team. When I came to meet the team – you’ve guessed it – Weights McWeighty was a member.

How do you overcome such a terrible first impression? McWeighty dug themselves deep into a hole they would have a hard time climbing out of.

I was clearly the one with leverage in the situation. On top of being the manager, I was more importantly the one who was able to say “I forgive”. That power allowed me complete freedom in choosing how I want our relationship to unfold.

I find it really important to tell myself the story differently, more empathetically. For instance, Weighty might have had a tough day; a testosterone rush as part of the workout; had someone else pester then earlier during the workout. I try to leave sufficient room for doubt so that my own resentment and anger are at least partially replaced with a fair amount of doubt.

When I first walked into a one-on-one meeting with a red-faced, apologizing Weighty McWeights, I realized this could be a critical moment early in the team’s life. How do you work yourself out of such a situation?

“We didn’t get acquainted in the best circumstance” I opened, “and I can’t say I forgot all about our gym unpleasancy. But we can work together to undo the bad start. Let’s give each other the benefit of doubt and work damn hard to prove each others’ first impression wrong.

Nest/Airbnb is a classic win-win

Nest and Airbnb recently announced a partnership by which Airbnb top rated hosts (superhosts) would get a 30% discount on the nest thermostat.

This is a spectacular win-win(-win) kind of deal where each participant in the Neet-Airbnb-Superhost triangle is getting something valuable without paying a heavy price. Let me explain:

Airbnb‘s investment is endorsing Nest and promoting its product to Airbnb’s clientele. Since Nest is a high-end brand and Airbnb doesn’t do such promotions often means they probably won’t alienate their superhosts. On the contrary, superhosts will take more pride in their special status which offers them exclusive discounts. And, by promoting Nest thermostats (considered more user friendly than the majority of competitors), Airbnb is guaranteeing a (literally) warmer experience to lodgers.

Superhosts have to actually buy the Nest thermostat, which is a non negligible cost even after discount. On the upside, they increase the perceived value of their property and increase the amount of satisfied customers, thus solidifying their continued superhost status with its various perks. Three could be other benefits such as energy conservation and easier remote assistance when using the Nest product.

Nest‘s price cut probably means they’re giving up most of their margin. High end smartphones hit a 50-60% profit margin. Nest probably has smaller scale, but I think in many other ways are comparable and I wouldn’t be surprised to find them at the lower end of that range.

Since Nest are only selling to a confined, small group (I’m guessing 10k-100k worldwide) I doubt this will dramatically affect the bottom line.

In return, Nest is strengthening its luxurious high end brand image. Superhosts are selected by customer reviews, meaning that anyone visiting a superhost is likely to have a terrific time. This experience will now tie in to seeing and using the Nest product. Those customers might have their first ever Nest experience in this setting, c reading a great first impression. They may but one for their own home or bee disappointed when they find inferior thermostats in future rentals, thus driving demand up organically.

I love these sort of clever combinations that add up to more of the sum of the parts. Of course, this deal was just announced and I may be totally delusional about how it plays out. If you have thoughts about this or similar examples, shmichael at gmail.

A proper use for Tasker

Tasker is an Android automation app that existed since pretty much forever. I bought it back when I had an HTC Desire but never found a good use for it.

Fast forward to 2017 and a Pixel phone: one day I start my car and am struck by inspiration: The car speakers are quiet, which has been the case ever since I digitised my entire CD collection and got rid of it. I was mostly using a streaming music service, anyway. But that service wasn’t coming through my speakers right now.

Why was my car quiet? I definitely had the Bluetooth capable audio system installed. It was sheer human laziness. When you enter a cold car wearing gloves, or are in a rush, the last thing you want to do is start fumbling with your phone.

I really can’t explain why it took me so long to realize I need to automate this, but oh it’s so good now. Bluetooth detected -> open music app -> wait 2 seconds -> media play and my life is more upbeat. Or downbeat, if Nick Cave.

I added a follow up, orientation vertical + screen unlocked + bluetooth connected -> open satnav (I don’t know why I’m avoiding a brand name, both are owned by Google). Afterwards, I was sitting with my partner in the car, and put the phone in its cradle. I made a small magic gesture with my hand and kazam! The app opened of itself to my partner’s astonishment.

This is so simple. This doesn’t require anything beyond the most basic tinkering. This was available to me – and colleagues I talked to who set up smart homes or just do amazing stuff for a living – but none of us actually did it for the longest time. Like me and blogging.