Skip to content

Instantly share code, notes, and snippets.

Brian Dixon bjdixon

Block or report user

Report or block bjdixon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bjdixon
bjdixon / .vimrc
Last active Aug 29, 2015
Vim config
View .vimrc
set autoindent
filetype indent on
filetype on
:set nu
syntax on
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set smarttab
@bjdixon
bjdixon / scipy-install
Created Feb 21, 2014
Install SciPy stack on ubuntu/debian
View scipy-install
sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose
@bjdixon
bjdixon / TouchpadOff
Created Mar 6, 2014
Touchpad on/off (ubuntu on lenovo carbon)
View TouchpadOff
synclient TouchpadOff=2
synclient TouchpadOff=1
@bjdixon
bjdixon / bootstrap-equal-height-columns
Created Apr 2, 2014
bootstrap equal height columns
View bootstrap-equal-height-columns
.row {
display: table;
}
[class*="col-"] {
float: none;
display: table-cell;
vertical-align: top;
}
@bjdixon
bjdixon / .gitignore
Created Apr 6, 2014
.gitignore for python
View .gitignore
__pycache__
*.py[cod]
*.py~
@bjdixon
bjdixon / Beautiful-Idiomatic-Python
Last active Aug 29, 2015
Beautiful, Idiomatic Python or Don't do this, do this - Raymond Hettinger presentation (pycon 2013)
View Beautiful-Idiomatic-Python
Replace traditional index manipulation with Python’s core looping idioms.
Learn advanced techniques with for-else clauses and the two argument form of iter().
Clarify function calls with keyword arguments.
Tuple packing and unpacking
Don’t under‐estimate the advantages of updating state variables at the same time. It eliminates an entire class of errors due to out­of-order updates. It allows high level thinking: “chunking”.
Decorators and Context Managers
Helps separate business logic from administrative logic. Clean, beautiful tools for factoring code and improving code reuse. Good naming is essential.
@bjdixon
bjdixon / create_funfactory_project
Created May 11, 2014
Create a funfactory project called blog
View create_funfactory_project
$ virtualenv venv
$ source venv/bin/activate
$ pip install funfactory
$ funfactory --python=2.7 --pkg=blog
create mysql database
add to blog/settings/local.py
@bjdixon
bjdixon / create_mysql_db
Last active Aug 29, 2015
create mysql database with owner for django
View create_mysql_db
$ mysql -h host -u user -p
mysql> CREATE DATABASE dbname;
mysql> USE dbname
mysql> GRANT USAGE ON *.* TO dbuser@localhost IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON dbname.* TO 'dbuser'@'localhost';
mysql> quit
@bjdixon
bjdixon / git_init
Created May 16, 2014
Init git and push to github
View git_init
$ git init
$ git add .
$ git commit -m "initial commit"
$ git remote add origin git@github.com:bjdixon/project_name.git
$ git push -u origin master
@bjdixon
bjdixon / remove_pyc_from_git
Created May 20, 2014
Because sometimes I forget to exclude .pyc until after I've tracked a couple
View remove_pyc_from_git
git rm --cached *.pyc
or
git update-index --assume-unchanged *.pyc
You can’t perform that action at this time.