Emacs, gpg and pinentry on Mac

I use Emacs and GnuPG to save my passwords to an encrypted file. I’m really happy with this, as I save the encrypted file in Dropbox, and I can decrypt it across all machines and Operating Systems, and it syncs automatically. My Emacs config looks as follows:

(setenv "GPG_AGENT_INFO" nil)
(require 'password-cache)
(require 'epa-file)
(epa-file-enable)
(setq password-cache-expiry (* 15 60))
(setq epa-file-cache-passphrase-for-symmetric-encryption t)

Continue reading “Emacs, gpg and pinentry on Mac”

Automating my life

Lately I’ve been doing a lot of work on automating my life. It’s been a lot of fun! I’ve been using Python and Jupyter a lot to create scripts to make myself more productive. I have been customising my notebook to create an optimal work environment. I’ve been setting up my Emacs environment to make it more effective. It’s been nice having the space to do this!

Installing PostgreSQL from source on my Mac

In order to build PostgreSQL from source on my MacBook Pro running El Capitan, I first downloaded the git repo:

git clone git://git.postgresql.org/git/postgresql.git

I then built it:


cd postgresql
./configure
gmake
sudo make install

This will install the binaries to the default location of “/usr/local/pgsql”.

I already had a user called “_postgres” in my /etc/passwd file, so I configured to run PostgreSQL as this user:
Continue reading “Installing PostgreSQL from source on my Mac”

Python OAuth2 failing with X509 error

I’ve just spent about 20 minutes trying to authenticate with Twitter using the Python OAuth2 module. I kept on getting an X509 error, specifically:

ssl.SSLError: [Errno 185090050] _ssl.c:343: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib

The solution to this is that the cacerts.txt file in the Python installation is only readable to the root user / wheel group. In order to fix that up, first find the cacerts.txt file:

find /Library/Python/ -name cacerts.txt

Then modify the permissions on the file:

sudo chmod 644 /Library/Python//2.7/site-packages/httplib2-0.7.7-py2.7.egg/httplib2/cacerts.txt

Note that the URL endpoints for twitter on the python-oauth2 Github page are currently wrong. To use the “Twitter Three-legged OAuth Example” change http://twitter.com/oauth/request_token to https://api.twitter.com/oauth/request_token, etc.

Renaming XCode Projects

It turns out that renaming XCode projects is easy! This StackOverflow thread showed me the trick. All you need to do is double-click slowly on the Project Name in the project hierarchy tree. This allows you to change the name. You then get a dialog showing the refactoring of everything related to the new project name.

Bug with streaming audio to Apple TV

So it appears that there is a occasionally a problem in streaming music to the Apple TV from the Mac. The symptom is that you can see the “Audio TV” device in your Sound -> Output window, but every time you try to select it, the selection reverts to the “Internal Speakers” line.

The easiest way to reset this, is to go up to the menu bar at the top of the screen and switch off your Wifi Network, leave it off for a second, then switch it back on. When you reconnect to your wifi network you should be able to select the “Apple TV” device in your Sound/Output pane in the System Preferences.

Restarting Fitbit on the Mac

I seem to have a problem with my Fitbit Ultra and my Mac Air running OS/X 10.8. What happens is the fitbit daemon doesn’t seem to work properly if I suspend the notebook by closing the lid. After awakening, my Fitbit profile never seems to update with the latest data from the device. A solution to this problem is to restart the fitbit daemon. You can use launchctl to stop and restart the daemon, which should mean that your data then gets transferred from the device properly.

sudo launchctl stop com.fitbit.fitbitd
sudo launchctl start com.fitbit.fitbitd

Hacking the EZ430 Chronos Watch on the Mac

Today my TI EZ430 Chronos Watch arrived, and I spent a little bit of time hacking it on my MacBook Air. It turns out that even though the documentation seems to require either a Windows machine or a Linux box, you can communicate with the watch from the Mac by modifying the serial port information in the TCL source. I learnt this from a Google Groups post, and I’ve copied the modified TCL source onto my Github account.

Continue reading “Hacking the EZ430 Chronos Watch on the Mac”