Skip to content

Instantly share code, notes, and snippets.

View lordofthedanse's full-sized avatar

Dan Brown lordofthedanse

View GitHub Profile
@lordofthedanse
lordofthedanse / homebrew_jupyter.md
Created August 25, 2021 14:02
Instructions for setting up Homebrew & Jupyter (notebook) for ISYE_6414

Install Homebrew and Jupyter Notebook

  1. Open your terminal (on Mac, the default terminal is named ... Terminal)
  2. Go to Homebrew and paste script at the top into Terminal
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install jupyter: brew install jupyter
  2. Open a new notebook to confirm: jupyter notebook
  3. If you don't have the R kernel when you open a new notebook (and you probably shouldn't), then you'll need to install the IRkernel: from the terminal, open R: then install.packages("IRkernel")
  4. Create a Jupyter notebook with the R kernel.
if ENV['PROFILE']
config.cache_classes = true
config.eager_load = true
config.logger = ActiveSupport::Logger.new(STDOUT)
config.log_level = :info
config.public_file_server.enabled = true
config.public_file_server.headers = {
'Cache-Control' => 'max-age=315360000, public',
@lordofthedanse
lordofthedanse / create_postgresql_user.txt
Created April 29, 2019 11:38
Create postgresql user
From the command line:
createuser postgres -s -d (s is for superuser privileges, d is for creating DBs; capital S/D are the negations)
@lordofthedanse
lordofthedanse / restart postgresql.txt
Last active April 29, 2019 11:41
Restart PostgreSQL when getting not accepting TCP/IP connections on port 5432
Manually:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log restart
With homebrew:
brew services restart postgresql (if postgres version is pinned (postgresql@10), then sub postgresql@10 for postgresql)
Can also
brew services stop postgresql
brew services start postgresql
@lordofthedanse
lordofthedanse / After running squasher.md
Last active December 26, 2018 19:33
After using squasher to squash Rails migrations ...

Here are a few gotchas:

  1. If you were running spring and didn't stop it before you squashed migrations, spring might have it's database config change (it'll look for the squasher database that was created temporarily). If you want to go back to your development database, just spring stop and then setup your database (however you do that) again.
  2. You can run into rake db:migrate problems because the new squashed migration version has not been added to the schema_migrations table that tells Rails what migrations have already been run. Thus, your rake db:migrate command will be trying to create tables (via the squasher XXXX_init_schema migration) that already exist. The solution to this is to manually insert the value of your XXXX_init_schema migration into the schema_migration table:
  • psql
  • insert into schema_migrations (version) values ('99999999999999');, where the 99999999999999 value is actually the timestamp that appears in the XXXX_init_schema migration.
Install Homebrew
1. xcode-select --install
2. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
3. brew doctor
Install Python3 using Homebrew
1. brew install python3
Install packages for Python3
1. pip3 install [package name without brackets]
@lordofthedanse
lordofthedanse / _upgrade-pg9.4-to-pg9.5.md
Created March 2, 2016 13:24 — forked from chbrown/_upgrade-pg9.4-to-pg9.5.md
Upgrade PostgreSQL 9.4 to 9.5 on Mac OS X with Homebrew

First, check your current config (example output in homebrew.mxcl.postgresql.plist.xml lower down in this gist):

cat ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

Most importantly, note the -D /usr/local/var/postgres argument.

Second, shut down your current PostgreSQL.

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist