View passwd-auth-script.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Environment variables: | |
# username (required) | |
# password (optional for all except check) | |
# Usage in openvpn-server.conf: | |
# auth-user-pass-verify "/etc/openvpn/passwd-auth-script" via-env | |
# script-security 3 | |
# verify-client-cert none |
View find-proxmox-macaddr-dups.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# string samples: | |
# /etc/pve/nodes/node1/lxc/123.conf:net0: name=eth0,bridge=vmbr0,firewall=1,gw=10.20.30.1,hwaddr=1A:2A:3A:CC:C0:0A,ip=10.20.30.40/24,type=veth | |
# /etc/pve/nodes/pm8/qemu-server/134.conf:net0: virtio=A1:B2:C3:B4:D5:E6,bridge=vmbr0,firewall=1 | |
use strict; | |
use warnings; | |
open F, "grep -R hwaddr= /etc/pve |" or die "Cannot grep /etc/pve: $!\n"; |
View proxmox-shrink-pct-rootfs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
# Based on https://serverfault.com/a/787380/228027 | |
CT="123" | |
DIR="/$VE-$(date +%Y-%m-%d-%H%M)" | |
NEWSIZE="100G" | |
UNPRIV="1" # ..missed by dump/restore => should be selected explicitly | |
mkdir -p "$DIR" |
View swap-flush.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
test "0" = "$(grep -vc '^Filename' /proc/swaps)" && exit 0 # ..no swaps | |
SWAP_FREE="$(awk ' | |
/^SwapTotal:/ { total = $2 } | |
/^SwapFree:/ { unused = $2 } | |
END { printf "%d\n", 100 * unused / total }' /proc/meminfo)" | |
test "$SWAP_FREE" -lt "${SWAP_NEED_FREE:-55}" || exit 0 |
View find-jdups.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Usage sample: | |
# python find-jdups.py dir1 dir2 ... | grep -v = | sort | uniq | awk -F/ '{ print $NF }' | |
import os | |
import sys | |
import zipfile | |
pathlist = dict() |
View cassandra.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Cassandra NoSQL DBMS | |
Requires=network.target | |
Wants=nss-online.target | |
After=nss-online.target network.target | |
Documentation=https://gist.github.com/s0undt3ch/969b744d3d7b88c29cba#gistcomment-3188779 | |
[Service] | |
Type=forking | |
Restart=on-failure |
View esdedupe.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/esdedupe/esdedupe.py b/esdedupe/esdedupe.py | |
index 749615e..3e56e90 100755 | |
--- a/esdedupe/esdedupe.py | |
+++ b/esdedupe/esdedupe.py | |
@@ -23,6 +23,7 @@ class Esdedupe: | |
def __init__(self): | |
self.log = getLogger('esdedupe') | |
+ self.total = 0 | |
View zkDeleteOldLocks.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
MAX_DEL = int(os.getenv('MAX_DEL','10')) | |
MAX_AGE = int(os.getenv('MAX_AGE', '7')) | |
DRY_RUN = int(os.getenv('DRY_RUN', '0')) | |
QUIET = int(os.getenv('QUIET', '0')) | |
import time |
View killtree-multipass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
KILLSIG="" | |
walktree() { local p=""; for p in "$@"; do walktree $(pgrep -P "$p"); echo $p; done; } | |
test "${1#-}" != "$1" && KILLSIG="$1" && shift | |
test $# = "0" && echo "Usage: ${0##*/} pid ..." && exit | |
PIDS="$(walktree "$@")" |
View sysctl-compare.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
die "Usage: $0 sysctl1.lst sysctl2.lst\n" if @ARGV != 2; | |
sub file2list($) { | |
my $fname = shift; | |
open F, $fname or die "Cannot open $fname: $!\n"; |
NewerOlder