Skip to content

Instantly share code, notes, and snippets.

View websafe's full-sized avatar

Thomas Szteliga websafe

View GitHub Profile
@jdeathe
jdeathe / openssl-self-signed-san-certificate.md
Last active June 24, 2022 03:48
How to generate a self-signed SAN SSL/TLS certificate using openssl

How to generate a self-signed SAN SSL/TLS certificate using openssl

Generating a self-signed certificate is a common task and the command to generate one with openssl is well known and well documented. Generating a certificate that includes subjectAltName is not so straght forward however. The following example demonstrates how to generate a SAN certificate without making a permanent change to the openssl configuration.

Generate a list of all required DNS names, (Note: CN will be discarded).

$ export SAN="DNS:www.domain.localdomain,DNS:domain.localdomain"
@oscarkuo
oscarkuo / backup-kvm-vms.sh
Created January 15, 2017 06:05
Backup KVM virtual machine hard disk images
#!/bin/bash
set -e
VMPATHS=()
VMNAMES=()
VMCONFS=()
SSPATHS=()
TGZNAME=/srv/backups/vmbackup-`date '+%y%m%d-%H%M%S'`.tar.gz
TGZLINK=/srv/backups/vmbackup-current.tar.gz
@DRN88
DRN88 / easyrsa3-quick-wildcardcert
Last active January 15, 2024 16:54
easyrsa3-quick-wildcardcert
#!/bin/bash
FQDN="domain.local"
CERT_FILENAME="wildcard.${FQDN}"
CERT_COMMONNAME="*.${FQDN}"
wget "https://github.com/OpenVPN/easy-rsa/archive/master.zip"
unzip master.zip
mv easy-rsa-master/easyrsa3/ .
rm -rf master.zip easy-rsa-master/
@tomfanning
tomfanning / Backup-VMs.ps1
Last active March 23, 2019 02:20
Backup Hyper-V VMs using save-vm, export-vm, result-vm with basic rotation
$ErrorActionPreference = "Stop"
# https://gist.github.com/tomfanning/617bde27596de3b1ca62
$backuptarget = "b:\HyperV"
$compression = $false
$VMs = Get-VM
foreach ($vm in $vms){
@chrahunt
chrahunt / se-image-paste.user.js
Last active December 30, 2021 11:50
Add image-pasting capability to StackEdit markdown editor.
// ==UserScript==
// @name StackEdit Image Extension
// @namespace http://chri.sh/
// @version 0.4.1
// @description Add image-pasting capability to StackEdit editor.
// @author chrahunt
// @match https://stackedit.io/editor
// @run-at document-end
// @grant none
// @downloadURL https://gist.github.com/chrahunt/c27686b095a390c26ff8/raw/se-image-paste.user.js
@16am
16am / Remove original size image.txt
Last active November 27, 2020 00:27
Remove original size image from WordPress Upload Directory after upload
add_filter( 'wp_generate_attachment_metadata', 'delete_fullsize_image' );
function delete_fullsize_image( $metadata )
{
$upload_dir = wp_upload_dir();
$full_image_path = trailingslashit( $upload_dir['basedir'] ) . $metadata['file'];
$deleted = unlink( $full_image_path );
return $metadata;
}