Paul's Programming Notes     Archive     Feed     Github

Installing Postgres 9.5 On OSX

Edit 12/25/2020: I’d recommend using: https://postgresapp.com/

Ended up being surprisingly easy:

brew uninstall postgresql
brew install postgresql-9.5
brew link -f postgresql-9.5
mv /usr/local/var/postgres /usr/local/var/postgres.old
initdb -D /usr/local/var/postgres
# restore old database?
# pg_upgrade -b /usr/local/Cellar/postgresql/9.0.4/bin -B /usr/local/Cellar/postgresql/9.1.2/bin -d /usr/local/var/postgres.old -D /usr/local/var/postgres
# start postgres
pg_ctl -D /usr/local/var/postgres -l logfile start
view raw gistfile1.txt hosted with ❤ by GitHub

New Macbook Pro Setup

I’m finally switching to a Macbook Pro as my personal computer after a few months of using one at work. Local development on OSX is a lot easier and bug-free than on a Windows computer.

I started a gist with what I did for setup:

Important tips:

  • to open applications quickly, command + space and type the application name
  • mac doesn't have an address bar in finder, you need to use command + shift + g to type a directory path
  • mac doesn't have "snap window to screen" like windows does, you need to install moom for this
  • activity monitor = task manager
  • brew install = apt get install (you'll need to install brew)
  • use command + tilde to switch between windows for the same application

Setup:

view raw mac_setup.md hosted with ❤ by GitHub

Cygwin - Python Compiled Without SSL Support

Download error on https://pypi.python.org/simple/pip/: unknown url type:
https -- Some packages may not be found!

ImportError: cannot import name HTTPSHandler

I was trying to install pip in cygwin when this happened. Searches say openssl-devel needed to be installed, but it already was. Apparently python was compiled without ssl support.

My solution was to install cygwin-x86 instead of the 64x one.

Docker Run In Crontab

"0 5 * * 1 docker run --rm --name=mycontainer ubuntu:13.10 /opt/bin/job"
The above command is an example of how "docker run" would be used in crontab to run once every week at 5am.

  • --rm will delete the container once the job is finished running
  • --name will name the container and prevent duplicate jobs from running
  • You don't need to use "&" at the end, because crons already run in the background.

MySQL Batch Updates Not Working

Looking at "SHOW PROCESSLIST" and it looks like your queries are running individually instead of in batches like you sent?

This happens because MySQL runs each update statement individually, but you should still be able to see the batches when the queries are in the "init" state.

Use this query to see the batched queries:
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST where state="init";