Fixing LG French Door Light Coming On Its Own

We bought a LG French Door “knock-on” fridge around 2017 (model #LMXS307xxx). The concept looked cool as fuck on the show floor. But over the following months, I grew to dislike the feature (but that’s a different story). And about a year after that, something absolutely annoying started to happen — The “knock-on” door light would come on all by itself whenever a certain sound frequency around the house is just right that would trigger the light sensor. So if someone talks too loud or maybe dish plates hitting the counter at a certain pitch, the fucking door light comes on. It drove me crazy.

So it turns out there’s a way to dampen the sensitivity of the sensor by simply layering a few pieces of common office tapes on the sensor responsible for detecting the “knock-on” vibrations. Here’s a service bulletin PDF file that LG issued to licensed service technicians on addressing the issue. Note that with some models, the location of the sensor could be slightly different. On my fridge, the location is on the lower right hand side of the door panel. The fix was easy, quick and effective. All is good again.

Changing AWS RDS PostreSQL database name

Working with AWS RDS isn’t always the easiest. That’s the limitations that come with hosted solutions. /shrugs/

For example, you can’t change master username once an instance has been spawned, not even on an instance restored from a snapshot.

But I did figure out how to change a Postgres RDS instance’s database name. To do this, we’ll need terminal connection to the database:

$ psql -U james_holden -h -d donnager
$ password for james_holden: # provide your db password here

At this point, if you attempted to change the database name, Postgres will complain immediately:

donnager=> ALTER DATABASE donnager RENAME TO rocinate;
donnager=> ERROR:  current database cannot be renamed

However, if you get out of the connected db, switch to the standard “postgres” db, it’s all fair game:

donnager=> \c postgres
psql (9.5.5, server 9.5.4)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
You are now connected to database "postgres" as user "james_holden".
postgres=> ALTER DATABASE donnager RENAME TO rocinate;
postgres=> \q

Peace is restored again.

Temporarily Stopping McAfee AntiMalware Agent on the Mac

McAfee’s AntiMalware product can be a real resource hog for some people. Fortunately there’s a way to simply disable it via the command line. It can then be easily re-enabled the same way.

I made an alias in my profile to take care of that:

alias kill-mcafee='sudo /usr/local/McAfee/AntiMalware/VSControl stopoas'

Re-enabling it is just as easy:

alias unkill-mcafee='sudo /usr/local/McAfee/AntiMalware/VSControl startoas'

Downgrade Node.js to a Specific Version Using Homebrew

It’s a pain in the ass to have to look this up every time I do this. So here it goes:

Install Homebrew versions:

$ brew tap homebrew/versions

Look for the package you need:

$ brew search node

That is going to return a list of packages with keywords matching “node”

$ leafnode node node010 node04 node06 node08 nodebrew nodenv

Install the package with the version you need:

$ brew install node010


$ brew link --overwrite node010


Deploying Chef without a Chef Server


Chef is a great tool. I really love it. But to take full advantage of it, you need a Chef server (either build one yourself or have it hosted with Opscode (which we did at my last job). For small businesses and/or personal server(s) of very small scale (I’d suggest up to 3 to 5 servers at most), a nifty tool like LittleChef can really be quite useful. But if servers you manage ever grows more than a handful, I’d highly recommend hosted service like Chef to keep your sanity.

SuperHero.js for Javascript Best Practices

Javascript has been evolving way more quickly than I have been able to keep up. I’m still behind on some of the recommended best practices and modern techniques. Luckily someone had the good sense of putting up and documenting these things. I hope s/he/they keep up the good work to spare the rest of us.

This wonderful resource is SuperHero.js. It keeps up-to-date a list of resources on best practices and latest techniques in the world of Javascript for the rest of us peasant coders. Kudos to the site maintainer(s).

Duck Typing in Javascript

PHP was the first programming language I learned. But Ruby has been the language that I love. One of the patterns Ruby champions is the idea of Duck Typing. It’s a great way to avoid using if/else statements too excessively. In Javascript, this can be easily implemented as well. This article does a great job explaining it with some sample code. It’s a good thing!

Ruby’s #length vs #size vs #count Methods

Before googling for the article, I knew going in that .size is an alias to .length. But I didn’t know there was more to the story. And what about .count?

Here’s what Josh Susser wrote verbatim:

In Ruby, #length and #size are synonyms and both do the same thing: they tell you how many elements are in an array or hash. Technically #length is the method and #size is an alias to it.

In ActiveRecord, there are several ways to find out how many records are in an association, and there are some subtle differences in how they work.

* post.comments.count – Determine the number of elements with an SQL COUNT query. You can also specify conditions to count only a subset of the associated elements (e.g. :conditions => {:author_name => “josh”}). If you set up a counter cache on the association, #count will return that cached value instead of executing a new query.

* post.comments.length – This always loads the contents of the association into memory, then returns the number of elements loaded. Note that this won’t force an update if the association had been previously loaded and then new comments were created through another way (e.g. Comment.create(…) instead of post.comments.create(…)).

* post.comments.size – This works as a combination of the two previous options. If the collection has already been loaded, it will return its length just like calling #length. If it hasn’t been loaded yet, it’s like calling #count.

Retain Vim Color Scheme in sudo

Ever wonder why vim loses its color schemes and settings when you are in sudo mode? I hate it. But there’s a way to preserve your vim settings while in sudo mode.

sudo -E vim some_file.txt



switch is the holy grail. Or you could use sudoedit if you have it set to using vim. And it’d have the same effect.

Speed Up Wake from Sleep Time on Mountain Lion

I bought a very beefy MacBook Air this summer. But I was frustrated with how slow the machine’s wake-from-sleep time was whenever it’s been in sleep mode for an extended period of time. For the longest time I just couldn’t figure it out. But as it turns out, it’s a new “feature” designed to make the batteries last longer.

Basically after certain number of hours, in order to save on energy, Mt. Lion saves most of the content in RAM to disk, thus making the wake up taking much much longer than desired. Here’s the blog I found with instructions to change that.

And here’s the instruction just in case. Open your Terminal via Applications > Utilities >, and issue the following command:

sudo pmset –a standbydelay 43200

43200 is seconds, which is 12 hours. I almost always never leave the laptop unused more than 12 hours, so I set mine to 86400, which is 24 hours. To find out what the current setting is, issue this command:

pmset -g

And there you have it!

Export SVN Repositories to Git on Mac OSX

Once you go git, you can never go back.

1. First, make a directory into which you want the newly minted git repo to live
2. cd into that directory
3. Then execute the following:

git svn clone file://localhost/Users/your-user-name/location/of/svn/repo

And that’s it!

Moving A Folder from One Git Repo to Another While Keeping History

Moving stuff from one git repo to another while keeping the history intact is a cool way to break stuff out of old repos and migrate them around. Here’s how to do it:

git clone --no-hardlinks /path/to/sourcerepository directory-to-move
cd directory-to-move

# remove remote origin just so we can't break anything in the source repository
git remote rm origin

# filter for desired files
git filter-branch --subdirectory-filter new-directory-name HEAD

# move around files, etc.
# then commit
git add .
git commit -m "isolated files"

Refernece: Moving files from a Git repository to another keeping history