Skip to content

Instantly share code, notes, and snippets.

Avatar

Juris Pavļučenkovs juris

View GitHub Profile
View keybase.md

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 / OpenVPN-per-client-iptables-README.md
Last active May 30, 2019
OpenVPN scripts for per client iptables configuration
View OpenVPN-per-client-iptables-README.md

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
@juris
juris / redis-cluster-backup.sh
Last active Jul 1, 2020
Redis Cluster backup script
View redis-cluster-backup.sh
#!/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
@juris
juris / spinner.sh
Created Sep 13, 2017
bash spinner function
View spinner.sh
# 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}"
You can’t perform that action at this time.