Skip to content

Instantly share code, notes, and snippets.

View HauptJ's full-sized avatar
:octocat:
Tschüss STL

Joshua Haupt HauptJ

:octocat:
Tschüss STL
View GitHub Profile
@HauptJ
HauptJ / regex_count_example.ps1
Created April 13, 2024 22:55
PowerShell Script to Count Occurrences of Regular Expressions in a File
# PowerShell Script to Count Occurrences of Regular Expressions in a File
# Specify the path to the file
$filePath = "C:\Users\redacted\test.txt"
# Define the list of regular expressions to search for
$regexPatterns = @("\bwinget\b", "\bmsstore\b", "\bUnknown\b")
# Check if the file exists
if (Test-Path $filePath) {
@HauptJ
HauptJ / hash_table_example.ps1
Created April 13, 2024 19:56
PowerShell Hash Table Example with CLI Parameters and Try Catch Error Handling
# Input CLI params with default values
param (
$number=1,
$shape="Square",
$color="Blue"
)
try {
# Ordered hash table
[hashtable]$hash = [ordered]@{Number = $number; Shape = $shape; Color = $color}
terraform {
required_providers {
digitalocean = {
source = "digitalocean/digitalocean"
version = "~> 2.0"
}
}
}
# Set the variable value in *.tfvars file
@HauptJ
HauptJ / playbook.yml
Last active April 14, 2024 12:52
Ansible Playbook to install and configure T-POT on Debian 11
---
- hosts: all
become: true
vars_prompt:
- name: ssh_username
prompt: Enter SSH username
private: false
- name: tpot_username
@HauptJ
HauptJ / httpd_config.conf
Created May 28, 2023 01:51
OpenLiteSpeed WordPress IPv6 Cloudflare Secure Listener Config
listener wordpresssslv6 {
address [ANY]:443
secure 1
keyFile /usr/local/lsws/conf/example.key
certFile /usr/local/lsws/conf/example.crt
map wordpress example.com, www.example.com
}
@HauptJ
HauptJ / httpd_config.conf
Created May 28, 2023 00:24
OpenLiteSpeed WordPress IPv4 and IPv6 Listener Config
listener wordpress {
address *:80
secure 0
map wordpress example.com, www.example.com
}
listener wordpressssl {
address *:443
secure 1
keyFile /usr/local/lsws/conf/example.key
@HauptJ
HauptJ / httpd_config.conf
Last active May 28, 2023 00:04
OpenLiteSpeed WordPress IPv4 Listener Config
listener wordpress {
address *:80
secure 0
map wordpress example.com, www.example.com
}
listener wordpressssl {
address *:443
secure 1
keyFile /usr/local/lsws/conf/example.key
@HauptJ
HauptJ / httpd_config.conf
Created May 27, 2023 23:25
OpenLiteSpeed accessControl config for CloudFlare IPv6 X-Forwarded-For pass through
accessControl {
allow ALL, 2400:cb00::/32T, 2606:4700::/32T, 2803:f800::/32T, 2405:b500::/32T, 2405:8100::/32T, 2a06:98c0::/29T, 2c0f:f248::/32T
}
@HauptJ
HauptJ / config.rb
Created August 4, 2020 21:37
Config file for the Vagrantfile used to test Hyper-V and Virtualbox coexistence - https://gist.github.com/HauptJ/2e3e2413482591822fd2425c22fba20d
# VM Config
$ssh_user = "vagrant"
$vcpus = "4"
$vmem = "4096"
$centos8_box = "generic/centos8"
$centos8_box_ver = "3.0.10"
# Synced Folders
@HauptJ
HauptJ / Vagrantfile
Last active August 4, 2020 21:39
Vagrantfile to test Hyper-V and Virtualbox coexistence - Config: https://gist.github.com/HauptJ/5210bf544cd90eb8e8dd4a2c1624d294
# -*- mode: ruby -*-
# vi: set ft=ruby :
# NOTE: Variable overrides are in ./config.rb
require "yaml"
require "fileutils"
# Use a variable file for overrides:
CONFIG = File.expand_path("config.rb")
if File.exist?(CONFIG)
require CONFIG