Skip to content

Instantly share code, notes, and snippets.

View df-a's full-sized avatar
🎯
Focusing

df-a

🎯
Focusing
View GitHub Profile

OpenSSL Directory Structure

/opt
    └── ssl
        β”œβ”€β”€ bin
        β”œβ”€β”€ include
        β”‚Β Β  └── openssl
        β”œβ”€β”€ lib64
 β”‚Β Β  β”œβ”€β”€ engines-3
@df-a
df-a / ansible-ssh-keepalive.md
Last active March 10, 2023 12:35
Keep Ansible connection alive

The SSH keepalive value determines how often an idle SSH connection will send a message to the remote host to keep the connection alive. If the connection is idle for longer than the keepalive value, the connection will be closed.

To prevent Ansible from hanging due to idle SSH connections, it is recommended to set an appropriate SSH keepalive value. A common value for this parameter is 60 seconds. This value can be set in the ssh_args parameter in your Ansible inventory file, like this:

ansible_ssh_common_args='-o ServerAliveInterval=60'

Alternatively, you can set this value in your SSH configuration file (~/.ssh/config) using the following syntax:

@df-a
df-a / nginx-gatsby.conf
Created October 12, 2022 23:39
NGinx Gatsby Config
# found here
# https://raghuvirkasturi.com/yearly-ritual/
worker_processes auto;
user [whatever user you use];
events {
worker_connections 1024;
}
http {
@df-a
df-a / yaml-to-json.md
Created October 7, 2022 17:56
Convert yaml to json using python

python3 -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin, Loader=yaml.FullLoader), sys.stdout, indent=4)' < input.yaml > output.json

@df-a
df-a / 01nginx-tls-sni.md
Created October 7, 2022 01:23 — forked from kekru/01nginx-tls-sni.md
nginx TLS SNI routing, based on subdomain pattern

Nginx TLS SNI routing, based on subdomain pattern

Nginx can be configured to route to a backend, based on the server's domain name, which is included in the SSL/TLS handshake (Server Name Indication, SNI).
This works for http upstream servers, but also for other protocols, that can be secured with TLS.

prerequisites

  • at least nginx 1.15.9 to use variables in ssl_certificate and ssl_certificate_key.
  • check nginx -V for the following:
    ...
    TLS SNI support enabled
@df-a
df-a / nginx-tls.conf
Created October 3, 2022 02:24 — forked from gavinhungry/nginx-tls.conf
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <[email protected]>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are not included here.
#
# Additional tips:
#
@df-a
df-a / words.js
Created August 10, 2022 09:13 — forked from devbyray/words.js
const words = [
// Borrowed from xkcd password generator which borrowed it from wherever
"ability","able","aboard","about","above","accept","accident","according",
"account","accurate","acres","across","act","action","active","activity",
"actual","actually","add","addition","additional","adjective","adult","adventure",
"advice","affect","afraid","after","afternoon","again","against","age",
"ago","agree","ahead","aid","air","airplane","alike","alive",
"all","allow","almost","alone","along","aloud","alphabet","already",
"also","although","am","among","amount","ancient","angle","angry",
"animal","announced","another","answer","ants","any","anybody","anyone",
@df-a
df-a / folder_splitter.py
Created May 12, 2022 12:41 — forked from zupo/folder_splitter.py
Split a folder with many files into subfolders with N files. Usage: python folder_splitter.py path/to/target/folder
# -*- coding: utf-8 -*-
# @author: Peter Lamut
import argparse
import os
import shutil
N = 10 # the number of files in seach subfolder folder
@df-a
df-a / FreeNAS.md
Created January 13, 2022 05:10 — forked from nojuan/FreeNAS.md
Utimate FreeNAS Setup

FreeNAS

This page is constantly being edited and worked on. Most of these should work but some might be broken.

Here are straight-forward instructions to setting up a bunch of different software on FreeNAS. If you make a terrible error, just throw up another plugin sandbox and repeat.

ToC