Instantly share code, notes, and snippets.

View delete-from-v2-docker-registry.md

One liner for deleting images from a v2 docker registry

Just plug in your own values for registry and repo/image name.

registry='localhost:5000'
name='my-image'
curl -v -sSL -X DELETE "http://${registry}/v2/${name}/manifests/$(
    curl -sSL -I \
        -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
View ._README.md

Docker DTR V2 Distribution Registry: Manual Authentication

In this #HOWTO, we'll use a set of user:password credentials to obtain an auth token from an enterprise Docker Trusted Registry DTR (archived page snapshot of docs.docker.com/ee/dtr).

Required information

  • Registry hostname
  • Account username and password

Use credentials to obtain an auth token

View download-instance-attributes.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Recursive AWS-style instance attributes downloader."""
import logging
import os
import re
import requests
View camel_case_to_snake_case.py
#!/usr/bin/env python
"""
Convert camel-case to snake-case in python.
e.g.: CamelCase -> snake_case
Relevant StackOverflow question: http://stackoverflow.com/a/1176023/293064
"""
View ._README.md

set_system_clock_from_google.sh

Sets system time based on what is reported by google.com. Useful for cases where it is not possible to use the standard ntpdate command. For eample, if a Linux machine is on a network which is only able to reach the internet through an HTTP proxy.

Inspired by ryenus' answer @ https://superuser.com/a/807326/72342

Installation

# Download latest set_system_clock_from_google.sh script.
View thrift-configure-mac-osx-20170504.md
View gta-petstuffers-radio-ad-transcript.md

https://www.youtube.com/watch?v=6xpZbQsHSHU

Male: Oh Max, We go everywhere together,
      right boy?

Female: At Petstuffers we know there's
        nothing more then a relationship
        between man and his dog, sometimes
        you just can't let go.
View yaml2json.py
python -c 'import json, sys, yaml ; y = yaml.safe_load(sys.stdin.read()) ; print(json.dumps(y))'
View log4j2.properties
status = error
dest = err
name = PopertiesConfig
property.logDir = /var/log/elasticsearch
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n