CLICK ME
yes, even hidden code blocks!
print("hello world!")
def decorator(func): | |
def inner(*args, **kwargs): | |
# Code in here | |
return func(*args, **kwargs) | |
return inner | |
# Use | |
@decorator | |
def view_function(request): | |
pass |
# Logger specific - good for production | |
import logging | |
def config_logger(name='', level=logging.INFO, _format='%(message)s', handler=logging.StreamHandler, propagate=True): | |
''' configures a logger ''' | |
_handler = handler() | |
_handler.setFormatter(logging.Formatter(_format)) | |
_logger = logging.getLogger(name) | |
_logger.addHandler(_handler) | |
_logger.setLevel(level) |
my_app/ | |
management/ | |
migrations/ | |
templates/ | |
templatetags/ | |
__init__.py | |
admin.py | |
apps.py | |
context_processors.py | |
exceptions.py |
PORT=8000 | |
while true; do echo "hello world" | nc -l ${PORT}; done |
#!/bin/bash | |
KUBERNETES=https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT | |
TOKEN=`cat /var/run/secrets/kubernetes.io/serviceaccount/token` | |
POD=`hostname` | |
curl -s -k -H "Authorization: Bearer $TOKEN" $KUBERNETES/api/v1/namespaces/$KUBERNETES_NAMESPACE/pods/$POD | grep -i hostIp | cut -d "\"" -f 4 |
# import config. | |
# You can change the default config with `make cnf="config_special.env" build` | |
cnf ?= config.env | |
include $(cnf) | |
export $(shell sed 's/=.*//' $(cnf)) | |
# import deploy config | |
# You can change the default deploy config with `make cnf="deploy_special.env" release` | |
dpl ?= deploy.env | |
include $(dpl) |
import logging | |
logging.root.manager.loggerDict |
Rank | Type | Prefix/Suffix | |
---|---|---|---|
1. | Prefix | my+ | |
2. | Suffix | +online | |
3. | Prefix | the+ | |
4. | Suffix | +web | |
5. | Suffix | +media | |
6. | Prefix | web+ | |
7. | Suffix | +world | |
8. | Suffix | +net | |
9. | Prefix | go+ |
#!/usr/bin/env bash | |
set -Eeuo pipefail | |
trap cleanup SIGINT SIGTERM ERR EXIT | |
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
usage() { | |
cat <<EOF | |
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |