Skip to content

Instantly share code, notes, and snippets.

@pulecp
pulecp / vault_grep.sh
Last active August 18, 2021 10:09
Recursively search a key-value storage in Vault for a regex
#!/bin/bash
prefix_input="$1"
prefix=${prefix_input:=puppet/vault_hiera/}
read -p "Regex to search: " search
search_for_keys() {
if grep -q '\/$' <<< $1; then
subkeys=`vault kv list $1 | sed '1,2d'`
#!/usr/bin/env python
# This is simple HTTP server that times out every request.
import datetime
import time
from flask import Flask, request
app = Flask(__name__)

Keybase proof

I hereby claim:

  • I am pulecp on github.
  • I am pulecp (https://keybase.io/pulecp) on keybase.
  • I have a public key ASAzufGOU7I5KYtovNrs6y5FryuKEkB9chTF624_S4JKPAo

To claim this, I am signing this object:

@pulecp
pulecp / check_A_and_PTR_records.sh
Created June 20, 2018 08:55
Script which checks if A and PTR records match in your zone files of bind server
#!/bin/bash
data_dir=/var/named/chroot/var/named/data/
[[ -d $data_dir ]] || { echo 'Run me on master bind server, exiting'; exit 1; }
echo '###############################################'
echo 'Checking if all IP addresses have a PTR record'
echo 'and if that PTR matches with the A record'
echo '###############################################'
echo
@pulecp
pulecp / mongo_space_available_for_reuse.js
Last active August 3, 2018 09:41
MongoDB - show space available to reuse per collection
// mongo --quiet 127.0.0.1:27017/admin mongo_space_available_for_reuse.js
db.getMongo().setSlaveOk()
var dbs = db.runCommand({ "listDatabases": 1 }).databases
var total_available_space_to_reuse = 0
print("Space available to reuse per collection:\n")
dbs.forEach(function(database) {
db = db.getSiblingDB(database.name)
@pulecp
pulecp / storm-spring-rabbitmq_build_rpm.sh
Last active May 29, 2018 06:48
Build RPM package of Spring RabbitMQ Support
#!/bin/bash
VERSION=2.0.3
URL="http://central.maven.org/maven2/org/springframework/amqp/spring-rabbit/${VERSION}.RELEASE/"
SRC_FILE="spring-rabbit-${VERSION}.RELEASE.jar"
[ -f $SRC_FILE ] || wget "${URL}${SRC_FILE}"
rm -f *.rpm
@pulecp
pulecp / wkhtmltopdf_build_rpm.sh
Created May 25, 2018 16:41
Build RPM package of wkhtmltopdf tool
#!/bin/bash
URL=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/
SRC_FILE=wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
WORK_DIR=wkhtmltox
VERSION=0.12.4
[ -f $SRC_FILE ] || wget "${URL}${SRC_FILE}"
rm -rf $WORK_DIR
@pulecp
pulecp / change_mongodb_port.sh
Created August 8, 2017 07:19
Change MongoDB default port
#!/bin/bash
echo 'DISABLE PUPPET ON ALL MONGO MACHINES AT FIRST'
old_port=27017
new_port=27018
# This script change default port of mongod instance and keep old port
# redirected to a new port
@pulecp
pulecp / setup.sh
Created April 14, 2017 22:23
Counter Strike 1.6 Server
apt-get update
apt-get install unzip -y
apt-get install expect -y
# Counter strike
mkdir server ; mkdir steamcmd ; cd steamcmd
wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz
tar -xvzf steamcmd_linux.tar.gz
expect -c 'set timeout 9999; \
@pulecp
pulecp / heal_gluster.sh
Last active April 11, 2022 14:25
This script looks for gluster volumes, checks their heal statuses and tries to fix all the unhealed files/dirs.
#!/bin/bash
# thanks to Niels de Vos (https://gist.github.com/nixpanic/5460521), this script
# is based on his one
RED='\033[1;31m'
GREEN='\033[1;32m'
NC='\033[0m' # No Color