Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am alantrrs on github.
  • I am alantrrs (https://keybase.io/alantrrs) on keybase.
  • I have a public key ASBhJbJmFVxr8DK_ceyPemAX7tb-MiDGCc0YCoFVloGMJwo

To claim this, I am signing this object:

def handle_concurrency(request, resource):
if request.session_id is None \
# Check matching session_id
or request.session_id != resource.last_session_id \
# Check valid window
or datetime.now() > resource.updated_at + timedelta(seconds=30):
# Validate etag
if request.etag != resource.etag:
return Response("Etag mismatch", 422)
# Update last_session_id

GitHub Flow

When developing we'll be following the GitHub flow. This includes some of the following guidelines:

  • Always branch out from master
  • Name your branches with something descriptive (e.g. style-documentation)
  • Create PRs early in order to discuss and get feedback
  • Link to the issues from the PR. See closing issues via commit messages

Merging PRs

Rebase before merging

@alantrrs
alantrrs / rotate.sh
Created April 18, 2017 21:23
Strips out IPhone rotation metadata
if [ -z $1 ] || [ -z $2 ]; then
echo "Usage: rotat.sh in.mov out.mov"
fi
ffmpeg -i $1 -strict -2 -metadata:s:v:0 rotate=0 $2
@alantrrs
alantrrs / CLOC.sh
Created September 22, 2016 09:33
Count lines of code for JS projects
find \( -name "*.js" -o -name "*.jsx" -o -name "*.json" \) -not -path "./node_modules/*" | xargs wc -l
RUN apt-get install -y wget
RUN wget http://download.zeromq.org/zeromq-4.1.3.tar.gz
RUN tar xvfz zeromq-4.1.3.tar.gz
RUN cd zeromq-4.1.3 && ./configure --without-libsodium && make && sudo make install
RUN sudo ldconfig
@alantrrs
alantrrs / OpenCV3.0.Dockerfile
Created November 25, 2015 23:29
OpenCV 3.0 snippet for docker
# Dockerfile
# Install OpenCV 3.0
RUN apt-get -y update
RUN apt-get -y install python-pip git nano curl tmux htop mc wget libeigen3-dev
RUN apt-get install -y build-essential cmake libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev ocl-icd-opencl-dev libcanberra-gtk3-module
RUN pip install matplotlib
RUN git clone https://github.com/Itseez/opencv.git
RUN mkdir /opencv/build