Skip to content

Instantly share code, notes, and snippets.

View holmberd's full-sized avatar

holmberd holmberd

View GitHub Profile
@holmberd
holmberd / nginx-ssl-sni.md
Last active February 21, 2023 01:57
How Nginx determines which SSL certificate to use for multiple domains pointing at a single IP

How Nginx determines which server block to route the request through.

Nginx tests only the request’s header field Host to determine which server the request should be routed to. If its value does not match any server name, or the request does not contain this header field at all, then nginx will route the request to the default server, the first server block if no default is specified, or determine the default alphabetical order.

How does TLS SNI help to determine which SSL certificate to use.

TLS does not provide a mechanism for a client to tell a server the name of the server it is contacting. It may be desirable for clients to provide this information to facilitate secure connections to servers that host multiple 'virtual' servers at a single underlying network address.

@holmberd
holmberd / titan-sec-key-linux.md
Last active February 5, 2023 21:25
Titan Security Key Linux Setup

Go to the udev rules folder

  • cd /etc/udev/rules.d

Pull down the file from the yubikey github

  • sudo wget https://raw.githubusercontent.com/Yubico/libu2f-host/master/70-u2f.rules

Reboot, or run the following to reload your rules

  • sudo udevadm control --reload

Refs:

@holmberd
holmberd / INSTALL
Created September 6, 2017 22:08 — forked from arya-oss/INSTALL.md
Ubuntu 16.04 Developer Tools installation
###### development tools
sudo apt-get install build-essential python-dev git nodejs-legacy npm gnome-tweak-tool openjdk-8-jdk
### Python packages
sudo apt-get install python-pip python-virtualenv python-numpy python-matplotlib
### pip packages
pip install django flask django-widget-tweaks django-ckeditor beautifulsoup4 requests classifier SymPy ipython
@holmberd
holmberd / ga-cross-domain-tracking.md
Last active October 13, 2022 21:41
Google Analytics - Cross Domain Manual Link Tracking

Manually decorate a URL with the linker parameter for Google Tag Manager or Google Analytics

In the case where you manually want to decorate a link with the linker parameter, i.e. the link is not a valid anchor link, or the final tracking page is accessed by user in a non direct way: File Download, Extension Installation, ect...

Google Analytics

/**
 * Returns the Google Analytics tracker linker parameter.
@holmberd
holmberd / ssh-banner.md
Last active October 6, 2022 09:04
SSH welcome banner with FIGlet

SSH Welcome banner with FIGlet

  • sudo apt-get install figlet
  • sudo touch /etc/update-motd.d/10-my-banner
  • sudo chmod +x /etc/update-motd.d/10-my-banner

10-my-banner.sh:

#!/bin/sh
@holmberd
holmberd / aws-s3-bucket-ls-date.md
Created July 15, 2019 16:57
AWS S3 Bucket - List records by date

AWS S3 Bucket - List files by date

With s3 ls

ls-s3.sh:

#!/bin/bash
DATE=$1 || $(date +%Y-%m-%d)
echo "List records for date $DATE"
aws s3 ls s3://bucket-name/directory/ | grep ${DATE}
@holmberd
holmberd / game_of_life_example.py
Last active May 18, 2022 14:52
Game of life Python [1]
CELL_ALIVE_CHAR = '*'
CELL_DEAD_CHAR = '.'
class Location:
def __init__(self, row_index, col_index):
self.row = row_index
self.col = col_index
class Cell:
def __init__(self, state):
@holmberd
holmberd / game_of_life_example.js
Last active May 18, 2022 14:52
Game of life Javascript [1]
/**
* Conway's Game of Life
*
* The world of the Game of Life is an infinite two-dimensional orthogonal grid of square
* "cells", each of which is in one of two possible states, alive or dead.
*
* Rules:
* 1. Any live cell with fewer than two live neighbours dies, as if by underpopulation.
* 2. Any live cell with two or three live neighbours lives on to the next generation.
* 3. Any live cell with more than three live neighbours dies, as if by overpopulation.
@holmberd
holmberd / web-components.js
Last active March 29, 2022 15:04
Web Components height/width
static get observedAttributes() {
return ['height', 'width'];
}
get height() {
return this.hasAttribute('height') && Number(this.getAttribute('height').replace('px', ''));
}
set height(val) {
if (val) {
@holmberd
holmberd / game_of_life_bad.js
Last active November 26, 2021 19:27
Game of life Javascript [2]
/**
* Conway's Game of Life
*
* The world of the Game of Life is an infinite two-dimensional orthogonal grid of square
* "cells", each of which is in one of two possible states, alive or dead.
*
* Rules:
* 1. Any live cell with fewer than two live neighbours dies, as if by underpopulation.
* 2. Any live cell with two or three live neighbours lives on to the next generation.
* 3. Any live cell with more than three live neighbours dies, as if by overpopulation.