Tuesday, 4 August 2015

GIT- Rebase a branch to fix a conflict

To manually rebase. If I want to merge, but there are conflicts:
- on feature branch:
git rebase master
- read the conflicting files. Open it and fix it. Then:
git add modified_file
git rebase --continue
- repeat until no more conflicts, then:

git push --force

Sunday, 2 August 2015

Postgres output to CSV with special characters

\copying a table to csv and you want to open in Excel, specifying
WITH(format csv, encoding 'latin1', header true)

results in correct special characters. 

Monday, 20 July 2015

Virtualenv and python 3 on Mac OSx

brew install python3
which python3
Look at the path and:
mkvirtualenv --python=python3_path python3


Inspired by
http://www.marinamele.com/2014/07/install-python3-on-mac-os-x-and-use-virtualenv-and-virtualenvwrapper.html
https://djangosteps.wordpress.com/2013/09/25/setup-a-virtualenv-for-python3/

Push non-master branch to Heroku

Push branch to Heroku


git push heroku_repo_name branch_name:master

Thursday, 4 June 2015

Output to a CSV file from a Postgres query

Write the query in script_name.sql file. Run:



        psql database --no-align -F"," -P "footer=off" --quiet -f script_name.sql -o output_file.csv