For symmetic encryption, you can use the following:
To encrypt:
openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt
To decrypt:
# Add this snippet to the top of your playbook. | |
# It will install python2 if missing (but checks first so no expensive repeated apt updates) | |
# [email protected] | |
- hosts: all | |
gather_facts: False | |
tasks: | |
- name: install python 2 | |
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal) |
## This configuration file expects certain environment variables to be available. | |
## You can add them to /etc/default/td-agent: | |
## AWS_REGION | |
## AWS_VPC_ID | |
## AWS_INSTANCE_ID | |
<source> | |
@type syslog | |
port 42185 | |
bind 127.0.0.1 | |
tag rsyslog |
package main | |
import ( | |
"fmt" | |
"sync" | |
"time" | |
) | |
func main() { | |
var myWaitGroup sync.WaitGroup |
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done' | |
# also check https://gist.github.com/rgl/c2ba64b7e2a5a04d1eb65983995dce76 |
// curl -X POST -H "Content-Type: application/octet-stream" --data-binary '@filename' http://127.0.0.1:5050/upload | |
package main | |
import ( | |
"fmt" | |
"io" | |
"net/http" | |
"os" | |
"time" |
# 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) |
# | |
# Read from journalctl outputting json and sort the data by program frequency | |
# | |
# https://blog.kylemanna.com/linux/systemd-journalctl-sort-by-frequency | |
# | |
# Author: Kyle Manna | |
# | |
# invocation: journalctl -o json --since "1 month ago" | jq -s -f systemd-journalctl-sort-by-program-frequency.jq | |
# |
git remote add upstream https://github.com/whoever/whatever.git
git fetch upstream
journalctl -u postfix -o json | jq -r 'select(.MESSAGE | contains("to=")) | .["_SOURCE_REALTIME_TIMESTAMP"]' | awk '{sec=int($1/(1000*1000)); print sec, int(sec/(60*60*24))}' | uniq -f 1 -c | sort -rn | head | while read count stamp day; do printf '%s\t%s\n' "$count" "$(date -Idate -d @$stamp)"; done |