Delete docker image from dockerhub (v2 api)

In order to delete a docker image from a private dockerhub repository server you need to know the digest which can easyly be determined from the header of a manifest request for a specific image tag.

Get a list of available docker image tags for a certain image (`application/json` response):
$ curl --silent https://dockerhub.example.com/v2/NAME/tags/list

Having a list of image tags to determine the digest:
$ for tag in latest master-621d4bc master 1.0.0 1.0.1; do \
curl --silent --head -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
https://dockerhub.example.com/v2/NAME/manifests/${tag} | \
grep docker-content-digest; done | sort | uniq -c

Do delete a specific docker image use the relevant digest and curl a DELETE request to the dockerhub API:
$ curl --silent -X DELETE https://dockerhub.example.com/v2/NAME/manifests/${digest}

Kubernetes helm: Incompatible client:server versions Max OS X)

If running a `helm` command is returning an ‚incompatible versions‘ error like the following, you can either upgrade the server version or downgrade the client version.

Error: incompatible versions client[v2.13.1] server[v2.11.0]

I decided to install several client versions and switch on demand, because upgrading the server version was not an option for me. In addition, having multiple client versions is more flexible in dealing with multiple kubernetes cluster having different versions.

Install the matching `kubernetes-helm` version manually via `brew`:

  1. Search on Github for the kubernetes-helm.rb file for the required version (2.11.0 in my case): https://github.com/Homebrew/homebrew-core/search?q=kubernetes-helm&type=Commits
  2. Click the commit hash (ee94af7 in my case)
  3. Click the „View“ and then „Raw“ button to copy the raw url.
  4. Install the choosen `kubernetes-helm` version (see commands below)
  5. Switch between your installed versions

$ brew unlink kubernetes-helm
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/ee94af74778e48ae103a9fb080e26a6a2f62d32c/Formula/kubernetes-helm.rb
$ brew info kubernetes-helm
$ brew switch kubernetes-helm 2.11.0

Fetch the value of a key from memcache server with telnet

In case you want to fetch the value of a key stored in a memcache you could connect to the memcache server via telnet and query the server for the key:

Connect to the memcache server via telnet:
:$ telnet memcache-server-host 11211

Query for stats slabs and use the slab number t query with cachedump:

stats slabs
STAT 25:chunk_size 21696
STAT 25:chunks_per_page 48
...
END

stats cachedump 25 0
ITEM GTLD_DATA [18459 b; 1520683204 s]
END

get GTLD_DATA
VALUE GTLD_DATA 1 18459
a:2:{...}
END

Read more:

How to fetch field(s) from MySQL query result in bash

In case you want to fetch/export the result of a mysql query into a text file, but you don´t have the option to use the OUTFILE command you can simple use the following bash command:

:~$ mysql -u USER -p PASSWORD -h HOST --silent --skip-column-names -e 'select field1, field2, field3 from table' > query-result.csv