Skip to content

Instantly share code, notes, and snippets.

View lifeblood's full-sized avatar

Daniel Shaw lifeblood

View GitHub Profile
# Exit on Error
set -e
OUTPUT_DIR=/secrets
CA_FILE=$OUTPUT_DIR/elastic-stack-ca.p12
CERT_FILE=$OUTPUT_DIR/elastic-certificates.p12
printf "====== Generating Elasticsearch Certifications ======\n"
printf "=====================================================\n"
if [ -f "$CA_FILE" ]; then
frontend ssl
mode tcp
bind 0.0.0.0:443 name frontend-ssl
option tcplog
log global
tcp-request inspect-delay 3s
tcp-request content accept if { req.ssl_hello_type 1 }
use_backend main-ssl if { req.ssl_hello_type 1 }
use_backend ssh if !{ req.ssl_hello_type 1 } { payload(0,7) -m bin 5353482d322e30 }
use_backend openvpn if !{ req.ssl_hello_type 1 } !{ req.len 0 }
@lifeblood
lifeblood / rescan.sh
Created May 16, 2023 12:55 — forked from rafaelfoster/rescan.sh
Rescan the devices (can detect new space when disk is resized OR new devices that were attached)
# Reference: http://blog.gurudelleccelsopicco.org/2009/09/online-lun-expansion-and-partition-resizing-without-reboot-under-linux/
echo 1 > /sys/block/[DEVICE]/device/rescan
# DETECT IF NEW DISKS ARE ATTACHED TO THE HOST
# Reference: http://www.cyberciti.biz/tips/vmware-add-a-new-hard-disk-without-rebooting-guest.html
ls /sys/class/scsi_host
@lifeblood
lifeblood / gist:36bdb9b184aff813af61017fbf732c60
Created April 30, 2023 17:27 — forked from zakkak/gist:ab08672ff9d137bbc0b2d0792a73b7d2
Resizing a filesystem using qemu-img and fdisk

Occasionally we will deploy a virtual instance into our KVM infrastructure and realize after the fact that we need more local disk space available. This is the process we use to expand the disk image. This process assumes the following:

  • You're using legacy disk partitions. The process for LVM is similar and I will describe that in another post.
  • The partition you need to resize is the last partition on the disk.

This process will work with either a qcow2 or raw disk image. For

@lifeblood
lifeblood / mem_used.sh
Created January 1, 2023 10:42 — forked from chikien276/mem_used.sh
Human readable memory usage in Linux per process
ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }'
@lifeblood
lifeblood / jenkins_tail.go
Created March 8, 2021 03:30 — forked from chirauki/jenkins_tail.go
Tail jenkins console output in local console
package main
import (
"flag"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
"strconv"
@lifeblood
lifeblood / CHANGELOG.md
Created December 27, 2020 06:21 — forked from juampynr/CHANGELOG.md
Sample CHANGELOG

Change Log

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

[Unreleased] - yyyy-mm-dd

Here we write upgrading notes for brands. It's a team effort to make them as

#!/bin/bash
# chkconfig: 2345 20 80
# description: Description comes here....
# Source function library.
. /etc/init.d/functions
start() {
# code to start app comes here
# example: daemon program_name &
#!/bin/bash
time=$(date "+%Y-%m-%d %H:%M:%S")
cd /home/deploy/laradock
docker-compose exec workspace mysqldump -h mysql -u root --password=root default | gzip > /home/backup/db-$(date +\%F-\%T).sql.gz
@lifeblood
lifeblood / SSH-Autocomplete.md
Last active March 11, 2020 07:01
SSH Autocomplete

chatops: docker run --name=errbot -v /home/errbot:/errbot -d dustise/errbot-image

_ssh() 
{
    local cur prev opts
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
 prev="${COMP_WORDS[COMP_CWORD-1]}"