See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod |
Get Git log in JSON format
git log --pretty=format:'{%n "commit": "%H",%n "abbreviated_commit": "%h",%n "tree": "%T",%n "abbreviated_tree": "%t",%n "parent": "%P",%n "abbreviated_parent": "%p",%n "refs": "%D",%n "encoding": "%e",%n "subject": "%s",%n "sanitized_subject_line": "%f",%n "body": "%b",%n "commit_notes": "%N",%n "verification_flag": "%G?",%n "signer": "%GS",%n "signer_key": "%GK",%n "author": {%n "name": "%aN",%n "email": "%aE",%n "date": "%aD"%n },%n "commiter": {%n "name": "%cN",%n "email": "%cE",%n "date": "%cD"%n }%n},'
The only information that aren't fetched are:
%B
: raw body (unwrapped subject and body)%GG
: raw verification message from GPG for a signed commitservice.beta.kubernetes.io/aws-load-balancer-access-log-emit-interval
(in minutes)service.beta.kubernetes.io/aws-load-balancer-access-log-enabled
(true|false)service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-name
service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-prefix
service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags
(comma-separated list of key=value)service.beta.kubernetes.io/aws-load-balancer-backend-protocol
(http|https|ssl|tcp)service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled
(true|false)jsonData='[{"name": "name#1","value": "value#1"},{"name": "name#2","value": "value#2"}]' | |
for row in $(echo "${jsonData}" | jq -r '.[] | @base64'); do | |
_jq() { | |
echo "${row}" | base64 --decode | jq -r "${1}" | |
} | |
# OPTIONAL | |
# Set each property of the row to a variable | |
name=$(_jq '.name') | |
value=$(_jq '.value') |
openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem | |
chmod 600 id_rsa.pem |
/** | |
* Find the longest class names in Spring. | |
* Also find FactoryFactory classes. | |
* a goof-off project by @thom_nic | |
*/ | |
import java.util.jar.* | |
defaultTasks 'longest', 'factoryfactory' |
""" | |
Create a spinning cursor or progress bar in terminal can be useful | |
for some scripts. | |
1. Use '\r' to move cursor back to the line beginning. Or use '\b' | |
to erase the last character. | |
2. The standard out of Python is buffered, which means it will | |
collect some data written to standard out before it actually | |
writes to the terminal. | |
The code snippet |
''' quick example showing how to attach a pdf to multipart messages | |
and then send them from SES via boto | |
''' | |
from email.mime.text import MIMEText | |
from email.mime.application import MIMEApplication | |
from email.mime.multipart import MIMEMultipart | |
import boto |