Short (72 chars or less) summary
More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).
Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def resize_area(size: Tuple[int, int], target_area: float) -> Tuple[int, int]: | |
""" | |
Calculates new dimensions with the same aspect ratio as the input | |
such that the total number of pixels is close to the specified target are. | |
:param size: The original size of the image. | |
:param target_area: The targeted number of pixels (e.g. 512*512). | |
:return: The new image size. | |
""" | |
w, h = size |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
conda create -n boost python=3.6 | |
export CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:$HOME/anaconda3/envs/boost/include/python3.6m | |
./bootstrap.sh --prefix=boost_output --with-python=python3 --with-icu | |
./b2 -j9 toolset=gcc cxxflags="-std=c++14" link=static threading=multi --layout=tagged |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# https://github.com/kubernetes/kubernetes/issues/17512#issuecomment-304069458 | |
set -euo pipefail | |
echo -e "Iterating...\n" | |
nodes=$(kubectl get node --no-headers -o custom-columns=NAME:.metadata.name) | |
for node in $nodes; do | |
echo "Node: $node" | |
kubectl describe node "$node" | sed '1,/Non-terminated Pods/d' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://unix.stackexchange.com/a/10065 | |
# if stdout is a terminal | |
if test -t 1; then | |
# see if it supports colors | |
ncolors=$(tput colors) | |
if test -n "$ncolors" && test $ncolors -ge 8; then | |
bold="$(tput bold)" | |
underline="$(tput smul)" | |
standout="$(tput smso)" | |
normal="$(tput sgr0)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl get secrets secret-name -o json --namespace old | jq '.metadata.namespace = "new"' | kubectl create -f - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import struct | |
import binascii | |
from base64 import b64encode | |
from typing import Union, Iterable | |
def main(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument('number', type=float, nargs='+', help='The number to convert.') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check for the presence of AVX and figure out the flags to use for it. | |
macro(CHECK_FOR_AVX) | |
set(AVX_FLAGS) | |
include(CheckCXXSourceRuns) | |
set(CMAKE_REQUIRED_FLAGS) | |
# Check AVX | |
if(MSVC AND NOT MSVC_VERSION LESS 1600) | |
set(CMAKE_REQUIRED_FLAGS "/arch:AVX") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import os | |
import sys | |
from typing import Iterable | |
import tensorflow as tf | |
parser = argparse.ArgumentParser() | |
parser.add_argument('file', type=str, help='The file name of the frozen graph.') | |
args = parser.parse_args() |