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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
When working with Git, there are two prevailing workflows are Git workflow and feature branches. IMHO, being more of a subscriber to continuous integration, I feel that the feature branch workflow is better suited, and the focus of this article.
If you are new to Git and Git-workflows, I suggest reading the atlassian.com Git Workflow article in addition to this as there is more detail there than presented here.
I admit, using Bash in the command line with the standard configuration leaves a bit to be desired when it comes to awareness of state. A tool that I suggest using follows these instructions on setting up GIT Bash autocompletion. This tool will assist you to better visualize the state of a branc
#!/bin/bash | |
set +x | |
# Setup all of the pyenvs | |
export PATH="$HOME/.pyenv/bin:$PATH" | |
export CONFIGURE_OPTS='--enable-shared' | |
eval "$(pyenv init -)" | |
pyenv shell 2.7.6 | |
pyenv virtualenvwrapper | |
pyenv rehash |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
# Paramiko SSH Object with batch commands and stdin | |
# Blake VandeMerwe July 2014 | |
# | |
# Adapted from Joe Linoff's code at http://joelinoff.com/blog/?p=905 | |
# his did not work for me, so I fixed it and added some features. | |
# | |
import re | |
import string | |
import logging | |
import socket |
#!/bin/bash | |
# Set up the packages we need | |
apt-get update | |
apt-get install libffi-dev libssl-dev git vim libxml2-dev libsqlite3-dev libxslt1-dev -y | |
# Clone the repos we need | |
git clone https://github.com/openstack/barbican.git /tmp/barbican | |
git clone https://github.com/openstack-dev/devstack.git /tmp/devstack |
It's a common misconception that [William Shakespeare][1] and [Miguel de Cervantes][2] died on the same day in history - so much so that UNESCO named April 23 as [World Book Day because of this fact][3]. However because England hadn't yet adopted [Gregorian Calendar Reform][4] (and wouldn't until [1752][5]) their deaths are actually 10 days apart. Since Ruby's Time
class implements a [proleptic Gregorian calendar][6] and has no concept of calendar reform then there's no way to express this. This is where DateTime
steps in:
>> shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
=> Tue, 23 Apr 1616 00:00:00 +0000
>> cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
=> Sat, 23 Apr 1616 00:00:00 +0000
#!/bin/bash | |
echo "Please use stackme.sh from https://github.com/rm-you/devstack_deploy instead! Always the latest:" | |
echo "bash <(curl -sL bit.do/devstack)" | |
exit | |
BARBICAN_PATCH="" | |
NEUTRON_LBAAS_PATCH="" | |
OCTAVIA_PATCH="refs/changes/30/278830/6" |
#!/bin/sh | |
MYIP=$(/sbin/ifconfig eth0|grep 'inet addr'|awk -F: '{print $2}'| awk '{print $1}'); | |
COUNT=0 | |
while true; do | |
OUTPUT_STR="Welcome to $MYIP connection $COUNT\r" | |
OUTPUT_LEN=${#OUTPUT_STR} | |
echo -e "HTTP/1.0 200 OK\r\nContent-Length: ${OUTPUT_LEN}\r\n\r\n${OUTPUT_STR}" | sudo nc -l -p 80 | |
if [ $? == 0 ]; then | |
let "COUNT++" |