Wednesday, May 29, 2013

Python2's urllib2 is a miserable libary

Python2's urllib2 is a miserable piece of shit of a library.  Use requests instead.

Friday, May 10, 2013

Install firefox 20 addons offline (via the command line)

So much misinformation out there, that it took a while to figure this out.  And seeing that the documentation for mozilla firefox is an out-of-date mess, this will probably be out of date in a few versions as well.

Currently the only way I've gotten an add-on to install automatically is as follows:

  1. Download the add-on.  You can simply go to the page for the add-on at https://addons.mozilla.org/en-US/firefox/ and right click on the 'Add to Firefox' button and select 'Save Link As...'
  2. Get the application id of the add-on and rename the .xpi file you downloaded to .xpi.  Typically the id is a uuid like {D4DD63FA-01E4-46a7-B6B1-EDAB7D6AD389}, but sometimes it's a string such as an email address or webaddress.  NOTE that if you have an id of {ec8030f7-c20a-464f-9b0e-13a3a9e97384}, you have the WRONG id.  That is the id for the firefox application itself (this value might change with different versions of firefox).
  3. Move the renamed xpi file to either your local mozilla profile directory at  ~/.mozilla/firefox/-profile_id-/extensions/ or to the global directory at /usr/lib/firefox-addons/extensions/. The -profile_id- can be found in ~/.mozilla/firefox/profiles.ini.  You'll have to find the correct Profile section and then the 'Path' for that profile (usually there's just one profile section, Profile0 with 'Name' = default).
  4. Restart firefox. You'll be prompted to install the add-ons you've added to the extensions directory once firefox starts up.
The same can be done for themes.