Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am weldpua2008 on github.
  • I am weldpua2008 (https://keybase.io/weldpua2008) on keybase.
  • I have a public key ASDhW4TL8xIzzcW59jLW-MHbLiPY14TyjvY31nsht7GvMQo

To claim this, I am signing this object:

@weldpua2008
weldpua2008 / nginx.ocsp.fetcher.sh
Created August 15, 2018 11:41
PRE-CACHED ssl_stapling_file UNDER EACH CERTIFICATE, DRAMATICALLY IMPROVE STARTUP TIME OF NGINX
#!/usr/bin/env bash
### CREATE TO SUPPORT PRE-CACHED ssl_stapling_file UNDER EACH CERTIFICATE, DRAMATICALLY IMPROVE STARTUP TIME
IFS=$'\n'
CERT_ROOT_PATH="${1:-/etc/ssl/certs}"
CERT_OCSP_CACHE="${CERT_ROOT_PATH}"
DIR=$CERT_ROOT_PATH/*.crt
CUR_TIMESTAMP="$(date '+%s')"
cache_expiration_minutes=$((60*13))
if [ ! -d "$CERT_OCSP_CACHE" ]; then
@weldpua2008
weldpua2008 / disable-transparent-hugepages.sh
Created August 15, 2018 09:18
SystemV Init script to disable hugepages for MongoDB
#!/bin/bash
### BEGIN INIT INFO
# Provides: disable-transparent-hugepages
# Required-Start: $local_fs
# Required-Stop:
# X-Start-Before: mongod mongodb-mms-automation-agent
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Disable Linux transparent huge pages
# Description: Disable Linux transparent huge pages, to improve
@weldpua2008
weldpua2008 / Optimize-nics.sh
Created August 15, 2018 09:14
Optimize max RX/TX for ixgbe with ethtool on bond interfaces
#!/bin/bash
### BEGIN INIT INFO
# Provides: optimize-nics
# Required-Start: $network
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# chkconfig: 2345 98 90
# Short-Description: Enable optimization of NICs RX/TX
# Description: Sets RX/TX to maximum, to improve
@weldpua2008
weldpua2008 / Jenkins-LLD-Jobs.py
Created August 15, 2018 08:39
Example LLD of Jenkins Jobs for Zabbix
#!/usr/bin/env python
###################################################################################
# desc: simple tool use to monitoring and discover jenkins jobs
###################################################################################
# Author Valeriy SOloviov <weldpua2008@gmail.com>
# - 21.12.2017
#############################################################
import json
import requests
@weldpua2008
weldpua2008 / prometheus.yml
Created August 15, 2018 06:16
Ansible template from prometheus
## {{ ansible_managed }}
# Ansible vars
# prometheus_jobs:
# - default
# add_to_prometheus: yes
# prometheus_pattern_regex: "backend-.*"
# prometheus_group: "BackEnd"
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
@weldpua2008
weldpua2008 / Go server init script.sh
Created August 15, 2018 06:04
Example init script for Go Service (SystemV)
#!/bin/sh
#
# GO - this script starts and stops the Event server daemon
#
# chkconfig: 345 85 15
# description: GO - server written in golang
# processname: go
# config: /config/go.json
# pidfile: /var/run/go.pid
@weldpua2008
weldpua2008 / nginx_worker_cpu_affinity_calc.sh
Created August 15, 2018 05:02
Calculate CPU affinity for NGINX
#!/bin/bash
conf=/etc/nginx/workerprocesses.conf
cpu=$(awk '/^processor/{n=$3} END{print n}' /proc/cpuinfo 2> /dev/null || echo 0)
[[ ${2:-0} -gt 0 ]] && cpu=$(($2 - 1))
workers=$1
if [[ "$workers" = "" ]] || [[ ${workers:-0} -le 0 ]];then
workers=$(( cpu * 75 /100 ))
[[ ${workers:-0} -le 0 ]] && exit
fi
@weldpua2008
weldpua2008 / leaseweb_all_servers_passwords.py
Created August 15, 2018 04:58
Get root password on all servers via LeaseWEB API v2.0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import json
apiurl = 'https://api.leaseweb.com/bareMetals/v2/servers'
apikey = '****-****-***'
headers = {"X-Lsw-Auth": apikey}
results = []
debug = 0
ips_pool = []
@weldpua2008
weldpua2008 / do-snapshot-retention-by-name.py
Created August 15, 2018 04:54
Retantion DigitalOcena snapshots by name
#!/usr/bin/env python
API_KEY = ''
import argparse
import sys
from dopy.manager import DoManager
if sys.version < '3':
integer_types = (int, long,)
else:
integer_types = (int,)