variable substitution, leading tab retained, overwrite file, echo to stdout
tee /path/to/file <<EOF
${variable}
EOF
no variable substitution, leading tab retained, overwrite file, echo to stdout
variable substitution, leading tab retained, overwrite file, echo to stdout
tee /path/to/file <<EOF
${variable}
EOF
no variable substitution, leading tab retained, overwrite file, echo to stdout
| #!/usr/bin/env bash | |
| # Export CA | |
| kubectl config view --minify --raw --output 'jsonpath={..cluster.certificate-authority-data}' | base64 -D > ca.crt | |
| # Export Client Cert | |
| kubectl config view --minify --raw --output 'jsonpath={..user.client-certificate-data}' | base64 -D > client.crt | |
| # Export Client Key | |
| kubectl config view --minify --raw --output 'jsonpath={..user.client-key-data}' | base64 -D >client.key | |
| # Usage: | |
| curl -k --cert client.crt --key client.key --cacert ca.crt https://[K8S_HOST]:6443/api/v1/pod |
| version: '3' | |
| services: | |
| logs: | |
| image: gerchardon/docker-logio | |
| links: | |
| - logio:logio | |
| volumes: | |
| - /var/run/docker.sock:/var/run/docker.sock | |
| command: -h logio -n docker | |
| privileged: true |
| cat /proc/sys/kernel/random/entropy_avail | |
| # around 5 | |
| apt install -y haveged | |
| systemctl status haveged.service | |
| cat /proc/sys/kernel/random/entropy_avail | |
| # 2400 or more |
Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort:
# myapp.rb require 'sinatra' get '/' do 'Hello world!'
| alias dns="scutil --dns | grep 'nameserver\[[0-9]*\]'" | |
| alias ffile='function __ffile(){if [ -z $2 ]; then _loc=".";else _loc="${2}";fi; if [ -z $1 ]; then echo "use: ffile [filename] [path]";else find "${_loc}" -type f -iname "*$1*" 2>/dev/null;unset -f __ffile;fi }; __ffile' | |
| alias create-ssh-key='function _create(){SUFFIX=$(date +%Y%m%d_%H%M%S);ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519_${SUFFIX}_wheelq -C "id_ed25519_${SUFFIX}_wheelq"; unset -f _create;echo -e "Key: ${HOME}/.ssh/id_ed25519_${SUFFIX}_wheelq\n\n$(cat ${HOME}/.ssh/id_ed25519_${SUFFIX}_wheelq.pub)"};_create' |
| #echo "alias go=' function __go(){ docker run --rm -v \"\${PWD}:/usr/src/myapp\" -w /usr/src/myapp -it golang:latest go \$@;unset -f __go;}; __go'"|tee -a ~/.bash_profile >> ~/.bashrc | |
| echo -e "#\!/usr/bin/env bash\nfunction __go(){ docker run --rm -v \"\${PWD}:/usr/src/myapp\" -w /usr/src/myapp -it golang:latest go \$@;unset -f __go;}; __go \$@" > /usr/local/bin/go && chmod 755 /usr/local/bin/go |
| #echo "alias terraform=' function __terraform(){ docker run --rm -v \"\${PWD}:/src\" -w /src -v ~/.terraform.d:/root/.terraform.d -it hashicorp/terraform:light \$@;unset -f __terraform;}; __terraform'"|tee -a ~/.bash_profile >> ~/.bashrc | |
| echo -e "#\!/usr/bin/env bash\nfunction __terraform(){ docker run --rm -v \"\${PWD}:/src\" -w /src -v ~/.terraform.d:/root/.terraform.d -it hashicorp/terraform:light \$@;unset -f __terraform;}; __terraform \$@" >/usr/local/bin/terraform && chmod 755 /usr/local/bin/terraform |
| #!/bin/bash | |
| SOURCE=$1 | |
| DEST=$2 | |
| SOURCE_ARR=(${SOURCE//:/ }) | |
| DEST_ARR=(${DEST//:/ }) | |
| if [[ ${#SOURCE_ARR[@]} -eq 2 && ${#DEST_ARR[@]} -eq 1 ]]; then | |
| VOL=${SOURCE_ARR[0]} |
Logstash cheatsheet
mutate { add_field => {"event_data.Suspicious" => "Suspicious Activity"} } --> Dest=>Values Adds field with data.
mutate { add_field => {"event_data.Suspicious" => "[event_data][Foo]"} }