202102

まとめてcherry-pick - git

% git cherry-pick [start_commit]..[end_commit]
% git cherry-pick master~7..master
% git cherry-pick aaaaaaa..fffffff

start_commit は採用したいcommitの一つまえを選ぶことに注意.rebaseとかと一緒.

docker-hubから特定のimageのtagsをリストでとる

function docker-taglist (){
  local image=${1}
  local limit=${2:=1}

  # official image exists under /library path
  if [[ ! "${image}" =~ ^.+/.+$ ]]; then
    image="library/${image}"
  fi
  local next="https://registry.hub.docker.com/v2/repositories/${image}/tags"
  local names
  while [[ ${limit} -gt 0 && ${next} != "null" ]]
  do
    response=$(curl --silent --show-error "${next}")
    names="${names}\n$(echo ${response} | jq -r ".results|map_values(\"${image}:\"+.name)|.[]")"
    next=$(echo ${response} | jq -r .next)
    limit=$((${limit}-1))
  done
  echo -e "${names}"
}

エラトステネスのふるい

  • O(nlog(log(n)))