Skip to content

Instantly share code, notes, and snippets.

View lifeblood's full-sized avatar

Daniel Shaw lifeblood

View GitHub Profile
@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 / 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
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 }
# 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
@lifeblood
lifeblood / network.md
Last active March 29, 2024 05:30
Linux网卡配置

添加网站

ip addr add 192.168.0.77/24 dev eth0 
cat /etc/systemconfig/network-scripts/ifcfg-eht0


BOOTPROTO=static

IPADDR=172.18.14.223
PREFIX=24
@lifeblood
lifeblood / termination_state.txt
Created April 22, 2024 13:51 — forked from bavovna/termination_state.txt
HAProxy termination_state
From https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#8.5
Session state at disconnection
TCP and HTTP logs provide a session termination indicator in the
"termination_state" field, just before the number of active connections. It is
2-characters long in TCP mode, and is extended to 4 characters in HTTP mode,
each of which has a special meaning :
- On the first character, a code reporting the first event which caused the