# images field type is nested
GET products/_search
{
"track_total_hits": true,
"size": 0,
"aggs": {
"counts": {
"terms": {
"script": "params['_source']['images'].size()",
gunicorn run:app --workers=9
gunicorn run:app --workers=9 --worker-class=meinheld.gmeinheld.MeinheldWorker
Macbook Pro 2015 Python 3.7
Framework | Server | Req/s | Max latency | +/- Stdev |
---|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ref: https://play.golang.org/p/OeEmT_CXyO | |
package main | |
import ( | |
"fmt" | |
"runtime" | |
"strconv" | |
"strings" | |
"sync" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | |
export NVM_DIR="$HOME/.nvm" | |
. "$(brew --prefix nvm)/nvm.sh" | |
# --------------------------------------------------------------------------- | |
# | |
# Description: This file holds all my BASH configurations and aliases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expbackoff() { | |
# Exponential backoff: retries a command upon failure, scaling up the delay between retries. | |
# Example: "expbackoff my_command --with --some --args --maybe" | |
local MAX_RETRIES=${EXPBACKOFF_MAX_RETRIES:-8} # Max number of retries | |
local BASE=${EXPBACKOFF_BASE:-1} # Base value for backoff calculation | |
local MAX=${EXPBACKOFF_MAX:-300} # Max value for backoff calculation | |
local FAILURES=0 | |
while ! "$@"; do | |
FAILURES=$(( $FAILURES + 1 )) | |
if (( $FAILURES > $MAX_RETRIES )); then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.lang.reflect.Method; | |
import java.net.URL; | |
import java.net.URLClassLoader; | |
/** | |
* | |
* @author apemanzilla | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From Andy Jarretts post: | |
# http://www.andyjarrett.co.uk/2016/08/02/secured-bash-script-to-backup-a-mysql-rds-dump-to-s3/ | |
#!/bin/bash | |
SQLDUMP="$(date +'%Y%m%d%H%M').sql.gz" | |
echo "Creating backup of database to $SQLDUMP" | |
mysqldump --login-path=local --databases YourDatabaseName | gzip -9 > $SQLDUMP | |
echo "Dump Zipped up" |
bin/kafka-topics.sh --zookeeper localhost:2181 --list
bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic
bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000
... wait a minute ...
Picking the right architecture = Picking the right battles + Managing trade-offs
- Clarify and agree on the scope of the system
- User cases (description of sequences of events that, taken together, lead to a system doing something useful)
- Who is going to use it?
- How are they going to use it?
NewerOlder