Skip to content

Instantly share code, notes, and snippets.

View ericwastaken's full-sized avatar

Eric Soto ericwastaken

View GitHub Profile
@ericwastaken
ericwastaken / index.html
Created January 14, 2025 21:18
Hello World doesn't have to be ugly! This is a simple self-contained HTML "Hello World" with some style.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello World</title>
<style>
/* Reset some default browser styles */
body, h1, p {
margin: 0;
@ericwastaken
ericwastaken / instsall_docker.sh
Last active December 4, 2024 20:36
Install Docker Engine on RHEL8 or RHEL9
#!/bin/bash
# This script installs Docker Community Edition on RHEL 9 and performs necessary post-installation steps.
# Based on the instructions at https://docs.docker.com/engine/install/rhel/
#
# License: ATTRIBUTION-SHAREALIKE 4.0 INTERNATIONAL (https://creativecommons.org/licenses/by-sa/4.0/)
# By: Eric A. Soto, [email protected]
# Exit immediately if a command exits with a non-zero status
set -e
@ericwastaken
ericwastaken / ocrmypdf.sh
Created November 17, 2024 06:08
A shell script that runs OCRmyPDF with options suitable for document archival in PDFs while supporting text search and file optimization. Meant to be used in any platform that supports Homebrew, but can be adapted to any other Linux/Unix platform so long as the OCRmyPDF and tesseract dependencies are installed.
#!/bin/bash
# This script performs OCR on a PDF file using OCRmyPDF,
# optimizes images and document layout.
#
# Uses OCRmyPDF - https://github.com/ocrmypdf/OCRmyPDF
#
# Dependencies:
# - `brew install tesseract-lang`` # Option 2: for all
# language packs (to support spanish and others)
@ericwastaken
ericwastaken / generate-self-signed-certs.sh
Last active October 3, 2024 19:31
Bash to generate a self-signed cert
#!/bin/bash
set -e
# Edit these two variables to control the cert minting process
CERT_DIR=/path/to/dir/where/you/want/the/certs
HOSTNAME="enter-your-fully-qualified-hostname-here"
# Check for dependencies
if ! command -v openssl &> /dev/null
@ericwastaken
ericwastaken / nc-ps.ps1
Created March 29, 2024 01:10
NetCat (nc) very simple clone on Powershell
<#
.SYNOPSIS
Checks if a specified port on a given hostname is open or closed, with a simplified output.
.DESCRIPTION
This script uses the Test-NetConnection cmdlet to attempt a TCP connection to a specified hostname and port.
It then checks the result of this attempt to determine if the port is open (indicating the host is listening on that port)
or if the port is closed/not reachable. The result is printed to the console with a color-coded message.
.PARAMETER hostname
@ericwastaken
ericwastaken / run-script-at-interval.ps1
Created July 30, 2023 04:39
Powershell run script at interval
######################################################################
# Runs another powershell script at a given interval.
# Syntax:
# .\run-script-at-interval.ps1 [script path] [interval in seconds]
# Example:
# .\run-script-at-interval.ps1 .\script-to-run.ps1 60
######################################################################
param (
[string]$ScriptPath,
@ericwastaken
ericwastaken / ps-post-benchmark.ps1
Last active July 30, 2023 04:09
Powershell Request Post Benchmark (Powershell CURL POST benchmark alternative)
##########################################################
# ps-post-benchmark.ps1
#
# A powershell script to make a POST to a remote URI
# and measure the response time.
#
# Useful when a client only has Powershell.
#
# Copyright 2023 [email protected]
#
@ericwastaken
ericwastaken / DockerCheatSheet.md
Last active July 10, 2023 19:58
A Docker / Docker Compose Cheat Sheet

Docker / Docker Compose Cheat Sheet

Docker

Add this to Dockerfile to add aliases of your choice (works for images that have /bin/bash)

# Add alias to user profile
RUN echo "alias ll='ls -la'" >> /root/.bashrc
@ericwastaken
ericwastaken / How-to-load-an-environment-file-in-bash.md
Last active April 16, 2022 06:09
An example Bash script that reads variables from an environment file

An example Bash script that reads variables from an environment file

This will load variables into a BASH SCRIPT from an environment file.

Create an environment file with the following structure. Call it "secrets.env" but it can be called anything!

MY_SECRET="Some Secret"
@ericwastaken
ericwastaken / dump-query-template.env
Last active April 16, 2022 06:07
Shell script interface for Elasticsearch Dump
# Pass headers into Elasticsearch:
# - Authorization can be used to pass BASIC AUTH with a TOKEN. Use
# a tool of your choice to convert your username/password into
# the proper token for basic auth.
ED_HEADERS='{"Authorization": "Basic YOUR-BASIC-AUTH-TOKEN-HERE"}'
# Host must end in "/"
# Include ":port-number" if necessary (otherwise, 443 is inferred by https)
ED_HOST="https://your-host.com:port-number/"