A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. heroku create
. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.
Note that on Heroku, you must always use master
as the destination branch on the remote. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch
seen below (in this example, we push the local staging
branch to the master
branch on heroku.
$ git remote add staging https://git.heroku.com/staging-app.git
#! /usr/bin/env python3 | |
"""Fixing bluetooth stereo headphone/headset problem in debian distros. | |
Workaround for bug: https://bugs.launchpad.net/ubuntu/+source/indicator-sound/+bug/1577197 | |
Run it with python3.5 or higher after pairing/connecting the bluetooth stereo headphone. | |
This will be only fixes the bluez5 problem mentioned above . | |
Licence: Freeware |
pdftk original.pdf output uncompressed.pdf uncompress | |
LANG=C sed -n '/^\/Annots/!p' uncompressed.pdf > stripped.pdf | |
pdftk stripped.pdf output final.pdf compress |
Roll your own iPython Notebook server with Amazon Web Services (EC2) using their Free Tier.
#!/usr/bin/env python | |
# Implementation of algorithm from http://stackoverflow.com/a/22640362/6029703 | |
import numpy as np | |
import pylab | |
def thresholding_algo(y, lag, threshold, influence): | |
signals = np.zeros(len(y)) | |
filteredY = np.array(y) | |
avgFilter = [0]*len(y) | |
stdFilter = [0]*len(y) |
# -*- coding: utf-8 -*- | |
""" | |
ReST directive for embedding Youtube and Vimeo videos. | |
There are two directives added: ``youtube`` and ``vimeo``. The only | |
argument is the video id of the video to include. | |
Both directives have three optional arguments: ``height``, ``width`` | |
and ``align``. Default height is 281 and default width is 500. |
#cython:boundscheck=False | |
#cython:wraparound=False | |
import numpy as np | |
from cython.parallel cimport prange | |
from libc.math cimport sqrt | |
cdef inline double dotp(int i, int j, int N, double[:, ::1] X) nogil: | |
cdef: | |
int k |
import numpy as np | |
import scipy.linalg.blas | |
cdef extern from "f2pyptr.h": | |
void *f2py_pointer(object) except NULL | |
ctypedef int dgemm_t( | |
char *transa, char *transb, | |
int *m, int *n, int *k, | |
double *alpha, |