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
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 Aug 20, 2019
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 ' ' ',')
mkdir -p /opt/redis-backup
for slave in ${slaves}
do
master_id=$(echo "${slave}" | cut -d',' -f2)
@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.