Skip to content

Instantly share code, notes, and snippets.

View juris's full-sized avatar

Juris Pavļučenkovs juris

View GitHub Profile
@juris
juris / redis-cluster-backup.sh
Last active March 21, 2023 14:27
Redis Cluster backup script
#!/bin/sh
readonly cluster_topology=$(redis-cli -h redis-cluster cluster nodes)
readonly slaves=$(echo "${cluster_topology}" | grep slave | cut -d' ' -f2,4 | tr ' ' ',')
readonly backup_dir="/opt/redis-backup"
mkdir -p ${backup_dir}
for slave in ${slaves}; do
master_id=$(echo "${slave}" | cut -d',' -f2)
@juris
juris / filebeat-cloudfront.yml
Created August 6, 2021 13:06
Filebeat config for AWS CloudFront log processing
---
logging.metrics.enabled: false
filebeat.inputs:
- type: aws-s3
queue_url: <SQS_NAME>
processors:
- drop_event:
when:
regexp:
message: "^#.*"
@juris
juris / OpenVPN-per-client-iptables-README.md
Last active March 12, 2021 11:40
OpenVPN scripts for per client iptables configuration

Every time a new client connects to OpenVPN server, ovpn_connect.sh script creates set of individual iptables rules based on client common name and content of ccd files. When client disconnects from OpenVPN server, ovpn_disconnect.sh removes these individual rules. opvn_run.sh can be used to launch OpenVPN in docker contaner.

This should be a part of openvpn.conf file for scripts to work

# Client configuration
script-security 2
ccd-exclusive
client-config-dir /etc/openvpn/ccd

Keybase proof

I hereby claim:

  • I am juris on github.
  • I am jurisp (https://keybase.io/jurisp) on keybase.
  • I have a public key ASCN7LsJI-gkDy7KG94WxRa0tEGGF8pdyFw6rKrh2Z38oQo

To claim this, I am signing this object:

@juris
juris / spinner.sh
Created September 13, 2017 15:11
bash spinner function
# Simple spinner function to show rotating stick
# while process is doing something useful
spinner() {
local pid=$!
local spin='-\|/'
while kill -0 $pid 2>/dev/null
do
i=$(( (i+1) %4 ))
printf "\r${spin:$i:1}"