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
function collapse_pwd { | |
echo $(pwd | sed -e "s,^$HOME,~,") | |
} | |
function prompt_char { | |
if [ $UID -eq 0 ]; then | |
echo "%{$fg_bold[red]%}#"; | |
else | |
echo "$"; | |
fi |
function collapse_pwd { | |
echo $(pwd | sed -e "s,^$HOME,~,") | |
} | |
function prompt_char { | |
if [ $UID -eq 0 ]; then | |
echo "%{$fg_bold[red]%}#"; | |
else | |
echo "$"; | |
fi |
#!/bin/bash | |
# Source: https://bugs.launchpad.net/byobu/+bug/1393793 | |
# Step 1: Create ~/.byobu/f-keys.tmux | |
cat > ~/.byobu/f-keys.tmux <<"EOM" | |
bind-key -n F2 new-window -c "#{pane_current_path}" \; rename-window "-" | |
bind-key -n C-F2 display-panes \; split-window -h -c "#{pane_current_path}" | |
bind-key -n S-F2 display-panes \; split-window -v -c "#{pane_current_path}" |
Source: http://www.johnstowers.co.nz/blog/pages/bash-cheat-sheet
This file contains short tables of commonly used items in this shell. In most cases the information applies to both the Bourne shell (sh) and the newer bash shell.
Tests (for ifs and loops) are done with [ ] or with the test command.
# 10_basic.py | |
# 15_make_soup.py | |
# 20_search.py | |
# 25_navigation.py | |
# 30_edit.py | |
# 40_encoding.py | |
# 50_parse_only_part.py |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import caffe | |
import numpy as np | |
# References: https://prateekvjoshi.com/2016/04/26/how-to-extract-feature-vectors-from-deep-neural-networks-in-python-caffe/ | |
# --------------------------------- | |
# Load Model |
# | |
# Download Peco: https://github.com/peco/peco | |
# | |
function peco-select-history() { | |
local tac | |
if which tac > /dev/null; then | |
tac="tac" | |
else | |
tac="tail -r" | |
fi |
# | |
# Edit file ~/.gitconfig, add to git alias | |
# | |
# Download peco: https://github.com/peco/peco | |
# | |
[alias] | |
logp = "!git log --oneline $@ | peco" | |
showp = "!git show `git log --oneline | peco | cut -d' ' -f1`" | |
showpfile = "!git show --name-only `git log --oneline | peco | cut -d' ' -f1`" |
# Author: Cuong Tran | |
# | |
# Build: docker build -t cuongtransc/kubectl:1.9.1 . | |
# Run: docker run -it --rm cuongtransc/kubectl:1.9.1 sh | |
# | |
FROM roffe/kubectl:v1.9.1 | |
COPY kube_config /root/.kube |