Skip to content

Instantly share code, notes, and snippets.

Juris Pavlyuchenkov juris

Block or report user

Report or block juris

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
juris /
Last active May 30, 2019
OpenVPN scripts for per client iptables configuration

Every time a new client connects to OpenVPN server, script creates set of individual iptables rules based on client common name and content of ccd files. When client disconnects from OpenVPN server, removes these individual rules. 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
client-config-dir  /etc/openvpn/ccd
juris /
Last active Oct 17, 2019
Redis Cluster backup script
readonly cluster_topology=$(redis-cli -h redis-cluster cluster nodes)
readonly slaves=$(echo "${cluster_topology}" | grep slave | cut -d' ' -f2,4 | tr ' ' ',')
mkdir -p /opt/redis-backup
for slave in ${slaves}
master_id=$(echo "${slave}" | cut -d',' -f2)
juris /
Created Sep 13, 2017
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
i=$(( (i+1) %4 ))
printf "\r${spin:$i:1}"
You can’t perform that action at this time.